diff options
author | Mats Wichmann <mats@linux.com> | 2024-07-16 13:29:41 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2024-07-16 13:29:41 (GMT) |
commit | 9feb2facd8666cc5ca89adba683afeffc2f60c3e (patch) | |
tree | fcbdaede6ad700fa1f910a52cd8cd04c8f4a2e8a /test | |
parent | ad29bd7a30b96569e7e7bc6de634ac08ef3fab8f (diff) | |
download | SCons-9feb2facd8666cc5ca89adba683afeffc2f60c3e.zip SCons-9feb2facd8666cc5ca89adba683afeffc2f60c3e.tar.gz SCons-9feb2facd8666cc5ca89adba683afeffc2f60c3e.tar.bz2 |
Add timeout to test/ninja/default_targets.py
Has timed out not completing in the CI.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/ninja/default_targets.py | 28 | ||||
-rw-r--r-- | test/ninja/ninja_test_sconscripts/sconstruct_default_targets | 9 |
2 files changed, 17 insertions, 20 deletions
diff --git a/test/ninja/default_targets.py b/test/ninja/default_targets.py index dc7c7c1..1b2f2b9 100644 --- a/test/ninja/default_targets.py +++ b/test/ninja/default_targets.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# import os @@ -32,45 +31,42 @@ test = TestSCons.TestSCons() try: import ninja except ImportError: - test.skip_test("Could not find module in python") + test.skip_test("Could not find 'ninja'; skipping test.\n") _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.file_fixture('ninja_test_sconscripts/sconstruct_default_targets', 'SConstruct') +# this test has had some hangs on the GitHut Windows runner, add timeout. + # generate simple build -test.run(stdout=None) +test.run(stdout=None, timeout=120) 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()) +test.must_contain_all(test.stdout(), f'ninja{_exe} -f') test.must_not_exist([test.workpath('out1.txt')]) test.must_exist([test.workpath('out2.txt')]) # clean build and ninja files -test.run(arguments='-c', stdout=None) -test.must_contain_all_lines(test.stdout(), [ - 'Removed out2.txt', - 'Removed build.ninja']) +test.run(arguments='-c', stdout=None, timeout=120) +test.must_contain_all_lines(test.stdout(), ['Removed out2.txt', 'Removed build.ninja']) # only generate the ninja file -test.run(arguments='--disable-execute-ninja', stdout=None) +test.run(arguments='--disable-execute-ninja', stdout=None, timeout=120) test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja']) test.must_not_exist(test.workpath('out1.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 -test.run(program=program, stdout=None) +test.run(program=program, stdout=None, timeout=120) test.must_not_exist([test.workpath('out1.txt')]) test.must_exist(test.workpath('out2.txt')) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_default_targets b/test/ninja/ninja_test_sconscripts/sconstruct_default_targets index 1a92be3..ebcc563 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_default_targets +++ b/test/ninja/ninja_test_sconscripts/sconstruct_default_targets @@ -4,13 +4,14 @@ import SCons -SetOption('experimental','ninja') +SetOption('experimental', 'ninja') DefaultEnvironment(tools=[]) - env = Environment(tools=[]) env.Tool('ninja') -env.Command('out1.txt', 'foo.c', 'echo test > $TARGET' ) -out2_node = env.Command('out2.txt', 'foo.c', 'echo test > $TARGET', NINJA_FORCE_SCONS_BUILD=True) +env.Command('out1.txt', 'foo.c', 'echo test > $TARGET') +out2_node = env.Command( + 'out2.txt', 'foo.c', 'echo test > $TARGET', NINJA_FORCE_SCONS_BUILD=True +) alias = env.Alias('def', out2_node) env.Default(alias) |