From 85dd9e8333f227dcdcbe86ae45f239a2b5cef030 Mon Sep 17 00:00:00 2001 From: Patrick Housley Date: Fri, 18 Oct 2019 18:01:59 -0500 Subject: [PATCH] test: test configure ninja - Updated the tooltest target to run unittest module - Renamed test/tools/test-js2c.py to be discoverable by unittest module - Added test class for `configure` shell script - Added a test to ensure `configure` script exits with status code zero when passed the `--ninja` flag Closes: https://github.com/nodejs/node/issues/29415 PR-URL: https://github.com/nodejs/node/pull/30033 Reviewed-By: Sam Roberts Reviewed-By: Christian Clauss --- Makefile | 2 +- test/tools/test_configure.py | 29 +++++++++++++++++++++++ test/tools/{test-js2c.py => test_js2c.py} | 0 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/tools/test_configure.py rename test/tools/{test-js2c.py => test_js2c.py} (100%) diff --git a/Makefile b/Makefile index 8d4e6bbe6474b9..d46b4a0c18a3d6 100644 --- a/Makefile +++ b/Makefile @@ -300,7 +300,7 @@ jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addo .PHONY: tooltest tooltest: - @$(PYTHON) test/tools/test-js2c.py + @$(PYTHON) -m unittest discover -s ./test/tools .PHONY: coverage-run-js coverage-run-js: diff --git a/test/tools/test_configure.py b/test/tools/test_configure.py new file mode 100644 index 00000000000000..c4e65192c9b3d1 --- /dev/null +++ b/test/tools/test_configure.py @@ -0,0 +1,29 @@ +import sys +import os +import unittest +import subprocess + + +class ConfigureTests(unittest.TestCase): + def setUp(self): + self.working_dir = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + '..', '..' + ) + ) + + def test_ninja(self): + subprocess.check_call( + './configure --ninja', + cwd=self.working_dir, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + + +if (__name__ == '__main__' and + sys.platform in ['linux', 'linux2', 'darwin', 'cygwin']): + + unittest.main() diff --git a/test/tools/test-js2c.py b/test/tools/test_js2c.py similarity index 100% rename from test/tools/test-js2c.py rename to test/tools/test_js2c.py