|
20 | 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21 | 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22 | 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23 |
| -# |
24 | 23 |
|
25 | 24 | import os
|
26 | 25 |
|
|
32 | 31 | try:
|
33 | 32 | import ninja
|
34 | 33 | except ImportError:
|
35 |
| - test.skip_test("Could not find module in python") |
| 34 | + test.skip_test("Could not find 'ninja'; skipping test.\n") |
36 | 35 |
|
37 | 36 | _python_ = TestSCons._python_
|
38 | 37 | _exe = TestSCons._exe
|
39 | 38 |
|
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 | +) |
46 | 42 |
|
47 | 43 | test.dir_fixture('ninja-fixture')
|
48 | 44 |
|
49 | 45 | test.file_fixture('ninja_test_sconscripts/sconstruct_default_targets', 'SConstruct')
|
50 | 46 |
|
| 47 | +# this test has had some hangs on the GitHut Windows runner, add timeout. |
| 48 | + |
51 | 49 | # generate simple build
|
52 |
| -test.run(stdout=None) |
| 50 | +test.run(stdout=None, timeout=120) |
53 | 51 | test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
|
54 | 52 | 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') |
56 | 54 | test.must_not_exist([test.workpath('out1.txt')])
|
57 | 55 | test.must_exist([test.workpath('out2.txt')])
|
58 | 56 |
|
59 | 57 | # 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']) |
64 | 60 |
|
65 | 61 | # 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) |
67 | 63 | test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
|
68 | 64 | test.must_not_exist(test.workpath('out1.txt'))
|
69 | 65 | test.must_not_exist(test.workpath('out2.txt'))
|
70 | 66 |
|
71 | 67 | # run ninja independently
|
72 | 68 | 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) |
74 | 70 | test.must_not_exist([test.workpath('out1.txt')])
|
75 | 71 | test.must_exist(test.workpath('out2.txt'))
|
76 | 72 |
|
|
0 commit comments