diff options
author | Mats Wichmann <mats@linux.com> | 2020-08-03 18:48:26 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-08-03 18:48:26 (GMT) |
commit | 4893cd758301fdf3d8bc39f7ff3b04669056089e (patch) | |
tree | 29572e55300d18915a6678d027e4f9ccadf4905e /test/SideEffect | |
parent | 89debe97b83d1be239b72fa42dbd6beb9f8470d1 (diff) | |
download | SCons-4893cd758301fdf3d8bc39f7ff3b04669056089e.zip SCons-4893cd758301fdf3d8bc39f7ff3b04669056089e.tar.gz SCons-4893cd758301fdf3d8bc39f7ff3b04669056089e.tar.bz2 |
Update SideEffect testcase
The problems reported in the issue are not present any longer.
Since the issue proposed an enhanced testcase to show the problem,
committing the new version so we can detect any regression.
Closes issue #2154.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/SideEffect')
-rw-r--r-- | test/SideEffect/parallel.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/test/SideEffect/parallel.py b/test/SideEffect/parallel.py index 7ec53b3..d272e86 100644 --- a/test/SideEffect/parallel.py +++ b/test/SideEffect/parallel.py @@ -54,6 +54,8 @@ src, target = sys.argv[1:] with open(logfile, 'ab') as f: f.write(('%s -> %s\\n' % (src, target)).encode()) +with open(target, 'wb') as ofp, open(src, 'rb') as ifp: + ofp.write(ifp.read()) # Give the other threads a chance to start. time.sleep(1) @@ -79,6 +81,14 @@ test.write('baz.in', 'baz.in\n') test.run(arguments = "-j 4 .") +test.must_match('h1.out', 'h1.in\n') +test.must_match('g2.out', 'g2.in\n') +test.must_match('f3.out', 'f3.in\n') +test.must_exist('log.txt') +test.must_exist('log.out') + +stdout = test.stdout() + build_lines = [ 'build.py h1.in h1.out', @@ -86,7 +96,20 @@ build_lines = [ 'build.py f3.in f3.out', ] -test.must_contain_all_lines(test.stdout(), build_lines) +missing = [] +for line in build_lines: + if stdout.find(line) == -1: + missing.append(line) + +if missing: + print("===== standard output is missing the following lines:") + print(string.join(missing, '\n')) + print("===== STDOUT ========================================") + print(stdout) + test.fail_test() + + +log = test.read('log.txt', mode='r') log_lines = [ 'f3.in -> f3.out', @@ -94,8 +117,17 @@ log_lines = [ 'g2.in -> g2.out', ] -test.must_contain_all_lines(test.read('log.txt', mode='r'), log_lines) - +missing = [] +for line in log_lines: + if log.find(line) == -1: + missing.append(line) + +if missing: + print("===== log file 'log.txt' is missing the following lines:") + print(string.join(missing, '\n')) + print("===== STDOUT ===========================================") + print(log) + test.fail_test() test.pass_test() |