summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-03-14 21:27:24 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2022-03-14 21:27:24 (GMT)
commit53a9b7cc192bc589a28ef2f73ee6b8428c1b1549 (patch)
tree2b3b117386210c8d1943299443b7b0b1ea92acb7 /test
parente3cbfd6ae3986513148872308e2ddd0584364da4 (diff)
downloadSCons-53a9b7cc192bc589a28ef2f73ee6b8428c1b1549.zip
SCons-53a9b7cc192bc589a28ef2f73ee6b8428c1b1549.tar.gz
SCons-53a9b7cc192bc589a28ef2f73ee6b8428c1b1549.tar.bz2
update test/ninja/force_scons_callback.py to test using NINJA_SCONS_DAEMON_PORT to explicitly set the daemon port
Diffstat (limited to 'test')
-rw-r--r--test/ninja/force_scons_callback.py57
-rw-r--r--test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback11
2 files changed, 37 insertions, 31 deletions
diff --git a/test/ninja/force_scons_callback.py b/test/ninja/force_scons_callback.py
index 59b54a0..c99ed58 100644
--- a/test/ninja/force_scons_callback.py
+++ b/test/ninja/force_scons_callback.py
@@ -37,47 +37,50 @@ except ImportError:
_python_ = TestSCons._python_
_exe = TestSCons._exe
-ninja_bin = os.path.abspath(os.path.join(
- ninja.__file__,
- os.pardir,
- 'data',
- 'bin',
- 'ninja' + _exe))
+ninja_bin = os.path.abspath(
+ os.path.join(ninja.__file__, os.pardir, "data", "bin", "ninja" + _exe)
+)
-test.dir_fixture('ninja-fixture')
+test.dir_fixture("ninja-fixture")
-test.file_fixture('ninja_test_sconscripts/sconstruct_force_scons_callback', 'SConstruct')
+test.file_fixture(
+ "ninja_test_sconscripts/sconstruct_force_scons_callback", "SConstruct"
+)
# generate simple build
test.run(stdout=None)
-test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
-test.must_contain_all(test.stdout(), 'Executing:')
-test.must_contain_all(test.stdout(), 'ninja%(_exe)s -f' % locals())
-if test.stdout().count('Defer to SCons to build') != 1:
+test.must_contain_all_lines(test.stdout(), ["Generating: build.ninja"])
+test.must_contain_all(test.stdout(), "Executing:")
+test.must_contain_all(test.stdout(), "ninja%(_exe)s -f" % locals())
+if test.stdout().count("Defer to SCons to build") != 1:
test.fail_test()
-test.must_match('out.txt', 'foo.c' + os.linesep)
-test.must_match('out2.txt', "test2.cpp" + os.linesep)
+test.must_match("out.txt", "foo.c" + os.linesep)
+test.must_match("out2.txt", "test2.cpp" + os.linesep)
# clean build and ninja files
-test.run(arguments='-c', stdout=None)
-test.must_contain_all_lines(test.stdout(), [
- 'Removed out.txt',
- 'Removed out2.txt',
- 'Removed build.ninja'])
+test.run(arguments="-c", stdout=None)
+test.must_contain_all_lines(
+ test.stdout(), ["Removed out.txt", "Removed out2.txt", "Removed build.ninja"]
+)
# only generate the ninja file
-test.run(arguments='--disable-execute-ninja', stdout=None)
-test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
-test.must_not_exist(test.workpath('out.txt'))
-test.must_not_exist(test.workpath('out2.txt'))
+test.run(arguments="--disable-execute-ninja", stdout=None)
+test.must_contain_all_lines(test.stdout(), ["Generating: build.ninja"])
+test.must_not_exist(test.workpath("out.txt"))
+test.must_not_exist(test.workpath("out2.txt"))
# run ninja independently
-program = test.workpath('run_ninja_env.bat') if IS_WINDOWS else ninja_bin
+program = test.workpath("run_ninja_env.bat") if IS_WINDOWS else ninja_bin
test.run(program=program, stdout=None)
-if test.stdout().count('Defer to SCons to build') != 1:
+if test.stdout().count("Defer to SCons to build") != 1:
test.fail_test()
-test.must_match('out.txt', 'foo.c' + os.linesep)
-test.must_match('out2.txt', "test2.cpp" + os.linesep)
+test.must_match("out.txt", "foo.c" + os.linesep)
+test.must_match("out2.txt", "test2.cpp" + os.linesep)
+
+# only generate the ninja file with specific NINJA_SCONS_DAEMON_PORT
+test.run(arguments="PORT=9999 --disable-execute-ninja", stdout=None)
+# Verify that port # propagates to call to ninja_run_daemon.py
+test.must_contain(test.workpath("build.ninja"), "ninja_run_daemon.py 9999")
test.pass_test()
diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback b/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback
index 55729a6..ef3562b 100644
--- a/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback
+++ b/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback
@@ -1,8 +1,11 @@
-SetOption('experimental','ninja')
+SetOption("experimental", "ninja")
DefaultEnvironment(tools=[])
env = Environment(tools=[])
-env.Tool('ninja')
+daemon_port = ARGUMENTS.get("PORT", False)
+if daemon_port:
+ env["NINJA_SCONS_DAEMON_PORT"] = int(daemon_port)
+env.Tool("ninja")
-env.Command('out.txt', 'foo.c', 'echo $SOURCE> $TARGET', NINJA_FORCE_SCONS_BUILD=True)
-env.Command('out2.txt', 'test2.cpp', 'echo $SOURCE> $TARGET') \ No newline at end of file
+env.Command("out.txt", "foo.c", "echo $SOURCE> $TARGET", NINJA_FORCE_SCONS_BUILD=True)
+env.Command("out2.txt", "test2.cpp", "echo $SOURCE> $TARGET")