Skip to content

Commit 9feb2fa

Browse files
committed
Add timeout to test/ninja/default_targets.py
Has timed out not completing in the CI. Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent ad29bd7 commit 9feb2fa

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
2626
to a string containing the value without the key. For example, if
2727
"print(repr(env.Dump('CC'))" previously returned "'gcc'", it will now
2828
return "{'CC': 'gcc'}".
29+
- Add a timeout to test/ninja/default_targets.py - it's gotten stuck on
30+
the GitHub Windows action and taken the run to the full six hour timeout.
31+
Usually runs in a few second, so set the timeout to 3min (120).
2932

3033

3134
RELEASE 4.8.0 - Sun, 07 Jul 2024 17:22:20 -0700

test/ninja/default_targets.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2121
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2222
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
2423

2524
import os
2625

@@ -32,45 +31,42 @@
3231
try:
3332
import ninja
3433
except ImportError:
35-
test.skip_test("Could not find module in python")
34+
test.skip_test("Could not find 'ninja'; skipping test.\n")
3635

3736
_python_ = TestSCons._python_
3837
_exe = TestSCons._exe
3938

40-
ninja_bin = os.path.abspath(os.path.join(
41-
ninja.__file__,
42-
os.pardir,
43-
'data',
44-
'bin',
45-
'ninja' + _exe))
39+
ninja_bin = os.path.abspath(
40+
os.path.join(ninja.__file__, os.pardir, 'data', 'bin', 'ninja' + _exe)
41+
)
4642

4743
test.dir_fixture('ninja-fixture')
4844

4945
test.file_fixture('ninja_test_sconscripts/sconstruct_default_targets', 'SConstruct')
5046

47+
# this test has had some hangs on the GitHut Windows runner, add timeout.
48+
5149
# generate simple build
52-
test.run(stdout=None)
50+
test.run(stdout=None, timeout=120)
5351
test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
5452
test.must_contain_all(test.stdout(), 'Executing:')
55-
test.must_contain_all(test.stdout(), 'ninja%(_exe)s -f' % locals())
53+
test.must_contain_all(test.stdout(), f'ninja{_exe} -f')
5654
test.must_not_exist([test.workpath('out1.txt')])
5755
test.must_exist([test.workpath('out2.txt')])
5856

5957
# clean build and ninja files
60-
test.run(arguments='-c', stdout=None)
61-
test.must_contain_all_lines(test.stdout(), [
62-
'Removed out2.txt',
63-
'Removed build.ninja'])
58+
test.run(arguments='-c', stdout=None, timeout=120)
59+
test.must_contain_all_lines(test.stdout(), ['Removed out2.txt', 'Removed build.ninja'])
6460

6561
# only generate the ninja file
66-
test.run(arguments='--disable-execute-ninja', stdout=None)
62+
test.run(arguments='--disable-execute-ninja', stdout=None, timeout=120)
6763
test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
6864
test.must_not_exist(test.workpath('out1.txt'))
6965
test.must_not_exist(test.workpath('out2.txt'))
7066

7167
# run ninja independently
7268
program = test.workpath('run_ninja_env.bat') if IS_WINDOWS else ninja_bin
73-
test.run(program=program, stdout=None)
69+
test.run(program=program, stdout=None, timeout=120)
7470
test.must_not_exist([test.workpath('out1.txt')])
7571
test.must_exist(test.workpath('out2.txt'))
7672

test/ninja/ninja_test_sconscripts/sconstruct_default_targets

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
import SCons
66

7-
SetOption('experimental','ninja')
7+
SetOption('experimental', 'ninja')
88
DefaultEnvironment(tools=[])
9-
109
env = Environment(tools=[])
1110
env.Tool('ninja')
12-
env.Command('out1.txt', 'foo.c', 'echo test > $TARGET' )
13-
out2_node = env.Command('out2.txt', 'foo.c', 'echo test > $TARGET', NINJA_FORCE_SCONS_BUILD=True)
11+
env.Command('out1.txt', 'foo.c', 'echo test > $TARGET')
12+
out2_node = env.Command(
13+
'out2.txt', 'foo.c', 'echo test > $TARGET', NINJA_FORCE_SCONS_BUILD=True
14+
)
1415
alias = env.Alias('def', out2_node)
1516

1617
env.Default(alias)

0 commit comments

Comments
 (0)