mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
selftest: Always set PYTHON to something sensible (if it isn't set)
Lots of test scripts need to run with the correct version of python. With the correct shebang the script should run with the correct version, the problem is that not all scripts are part of the installation, some scripts are part of the source code, and the shebang is not dynamically generated as yet. It is safer if we are somewhat version neutral at the moment and ignore the shebang and always run scripts from the test environment with the python version (determined by PYTHON env variable) If this env variable isn't set then set it according to the python version that is running the tests Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
3eb7281ff3
commit
f4c0343dc4
@ -121,6 +121,21 @@ def cmd_testonly(opt):
|
||||
env.TESTS = Options.options.TESTS
|
||||
|
||||
env.SUBUNIT_FORMATTER = os.getenv('SUBUNIT_FORMATTER')
|
||||
|
||||
# Lots of test scripts need to run with the correct version
|
||||
# of python. With the correct shebang the script should run with the
|
||||
# correct version, the problem is that not all scripts are part
|
||||
# of the installation, some scripts are part of the source code,
|
||||
# and the shebang is not dynamically generated as yet.
|
||||
# It is safer if we are somewhat version neutral at the moment and
|
||||
# ignore the shebang and always run scripts from the test environment
|
||||
# with the python version (determined by PYTHON env variable) If this
|
||||
# env variable isn't set then set it according to the python version
|
||||
# that is running the tests
|
||||
if not os.getenv('PYTHON', None):
|
||||
from sys import executable as exe
|
||||
os.environ['PYTHON'] = os.path.basename(exe)
|
||||
|
||||
if not env.SUBUNIT_FORMATTER:
|
||||
if Options.options.PERF_TEST:
|
||||
env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit-json --prefix=${SELFTEST_PREFIX}'
|
||||
|
Loading…
Reference in New Issue
Block a user