diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-06-14 01:03:46 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2022-06-14 01:03:46 (GMT) |
commit | 32936b08e4aa969d76aedd2d8353bdacb03f1547 (patch) | |
tree | 7ee07aa4edf0b3779a5db8c22ae49464610f2019 | |
parent | 2a853ac85704a8e72d7d57d3aa0c7a7ed4edd48a (diff) | |
download | SCons-32936b08e4aa969d76aedd2d8353bdacb03f1547.zip SCons-32936b08e4aa969d76aedd2d8353bdacb03f1547.tar.gz SCons-32936b08e4aa969d76aedd2d8353bdacb03f1547.tar.bz2 |
Fixed some typos. Added skip_test() if psutil is not present for new test. Added note to CHANGES.txt/RELEASE.txt that psutil is required for the new test for this function
-rwxr-xr-x | CHANGES.txt | 1 | ||||
-rwxr-xr-x | RELEASE.txt | 1 | ||||
-rw-r--r-- | SCons/Tool/ninja/__init__.py | 4 | ||||
-rw-r--r-- | SCons/Tool/ninja/ninja_daemon_build.py | 4 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | test/ninja/shutdown_scons_daemon.py | 12 | ||||
-rw-r--r-- | testing/framework/TestCmd.py | 6 |
7 files changed, 21 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index d091601..29d0de1 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -137,6 +137,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER to connect to the server during start up. - Ninja: Added new alias "shutdown-ninja-scons-daemon" to allow ninja to shutdown the daemon. Also added cleanup to test framework to kill ninja scons daemons and clean ip daemon logs. + NOTE: Test for this requires python psutil module. It will be skipped if not present. - Ninja: Added command line variable NINJA_CMD_ARGS that allows to pass through ninja command line args. This can also be set in your Environment(). diff --git a/RELEASE.txt b/RELEASE.txt index a7fbe16..a8c1d48 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -27,6 +27,7 @@ NEW FUNCTIONALITY system environment as an alternative to bypassing Visual Studio autodetection entirely. - Ninja: Added new alias "shutdown-ninja-scons-daemon" to allow ninja to shutdown the daemon. Also added cleanup to test framework to kill ninja scons daemons and clean ip daemon logs. + NOTE: Test for this requires python psutil module. It will be skipped if not present. - Ninja: Added command line variable NINJA_CMD_ARGS that allows to pass through ninja command line args. This can also be set in your Environment(). - Added a global policy setting and an environment policy variable for specifying the action to diff --git a/SCons/Tool/ninja/__init__.py b/SCons/Tool/ninja/__init__.py index f21738d..7f1b9e8 100644 --- a/SCons/Tool/ninja/__init__.py +++ b/SCons/Tool/ninja/__init__.py @@ -465,7 +465,6 @@ def generate(env): # date-ness. SCons.Script.Main.BuildTask.needs_execute = lambda x: True - def ninja_Set_Default_Targets(env, tlist): """ Record the default targets if they were ever set by the user. Ninja @@ -501,6 +500,5 @@ def generate(env): env['TEMPFILEDIR'] = "$NINJA_DIR/.response_files" env["TEMPFILE"] = NinjaNoResponseFiles - env.Alias('run-ninja-scons-daemon', 'run_ninja_scons_daemon_phony') - env.Alias('shutdown-ninja-scons-daemon', 'shutdown_ninja_scons_daemon_phony')
\ No newline at end of file + env.Alias('shutdown-ninja-scons-daemon', 'shutdown_ninja_scons_daemon_phony') diff --git a/SCons/Tool/ninja/ninja_daemon_build.py b/SCons/Tool/ninja/ninja_daemon_build.py index c21ea0b..32c375d 100644 --- a/SCons/Tool/ninja/ninja_daemon_build.py +++ b/SCons/Tool/ninja/ninja_daemon_build.py @@ -54,10 +54,12 @@ logging.basicConfig( level=logging.DEBUG, ) + def log_error(msg): logging.debug(msg) sys.stderr.write(msg) + while True: try: if not os.path.exists(daemon_dir / "pidfile"): @@ -65,7 +67,7 @@ while True: logging.debug(f"ERROR: Server pid not found {daemon_dir / 'pidfile'} for request {sys.argv[3]}") exit(1) else: - logging.debug("WARNING: Unnecessary request to shutfown server, its already shutdown.") + logging.debug("WARNING: Unnecessary request to shutdown server, it's already shutdown.") exit(0) logging.debug(f"Sending request: {sys.argv[3]}") diff --git a/requirements.txt b/requirements.txt index 1be070c..e05c610 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ rst2pdf ninja # Needed for test/Parallel/failed-build/failed-build.py +# Also for test/ninja/shutdown_scons_daemon.py psutil diff --git a/test/ninja/shutdown_scons_daemon.py b/test/ninja/shutdown_scons_daemon.py index fffbadb..39dddda 100644 --- a/test/ninja/shutdown_scons_daemon.py +++ b/test/ninja/shutdown_scons_daemon.py @@ -23,18 +23,22 @@ # import os -import psutil from timeit import default_timer as timer import TestSCons from TestCmd import IS_WINDOWS -test = TestSCons.TestSCons() - try: import ninja except ImportError: - test.skip_test("Could not find module in python") + test.skip_test("Could not find ninja module in python") + +try: + import psutil +except ImportError: + test.skip_test("Could not find psutil module in python") + +test = TestSCons.TestSCons() _python_ = TestSCons._python_ _exe = TestSCons._exe diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index e0af333..18a0db4 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -386,7 +386,12 @@ def _caller(tblist, skip): atfrom = "\tfrom" return string + def clean_up_ninja_daemon(self, result_type): + """ + Kill any running scons daemon started by ninja and clean up it's working dir and + temp files. + """ if self: for path in Path(self.workdir).rglob('.ninja'): daemon_dir = Path(tempfile.gettempdir()) / ( @@ -412,6 +417,7 @@ def clean_up_ninja_daemon(self, result_type): if daemon_dir.exists(): shutil.rmtree(daemon_dir) + def fail_test(self=None, condition=True, function=None, skip=0, message=None): """Causes a test to exit with a fail. |