Commits

Michał Górny committed 4c11221

Tests: check whether eselect is respected.

Comments (0)

Files changed (3)

 
 LOG_COMPILER = sh $(srcdir)/tests/runner.sh "$(PYTHON_IMPLS)"
 
-TESTS = tests/epython-test
+TESTS = tests/epython-test tests/eselect-test
 
 EXTRA_DIST += NEWS
 NEWS: configure.ac Makefile.am

tests/epython-test

 #!/bin/sh
-# Test whether EPYTHON is respected.
 
 echo "${TEST_NAME} -- test whether EPYTHON is respected"
 

tests/eselect-test

+#!/bin/sh
+
+echo "${TEST_NAME} -- test whether eselect-python is respected"
+
+# Usually, the newest version of Python is eselected. For that reason,
+# this test makes sense only if Python 3 is the main Python interpreter
+# (and thus a 'better' implementation could be selected).
+
+set -- ${PYTHON_IMPLS}
+
+SEL_PY=$(get_eselected)
+
+while true; do
+	if [ ${#} -lt 2 ]; then
+		# we can't test a preference without at least two impls ;)
+		echo 'Best Python eselected, unable to perform test.' >&2
+		do_exit 77
+	fi
+
+	# Repeat until we find the eselected python.
+	if [ "${1}" = "${SEL_PY}" ]; then
+		break
+	else
+		shift
+	fi
+done
+
+ESELECT=${1}
+BETTER=${2}
+
+echo "other impl: ${BETTER}" >&2
+
+unset EPYTHON
+
+write_impl "${ESELECT}" "#!/usr/bin/env true"
+write_impl "${BETTER}"  "#!/usr/bin/env false"
+
+do_test "${TEST_TMP}"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.