Repository navigation
Conversation
| print('Total output size gzipped=' + str(total_output_size_gz) + ' bytes, expected total size gzipped=' + str(total_expected_size_gz) + ', delta=' + str(total_output_size_gz - total_expected_size_gz) + print_percent(total_output_size_gz, total_expected_size_gz)) | ||
|
|
||
| if os.environ.get('EMTEST_REBASELINE'): | ||
| open(results_file, 'w').write(json.dumps(obtained_results)) |
There was a problem hiding this comment.
Can you call call self.assertFileContents(results_file, obtained_results) rather then duplicating the logic?
There was a problem hiding this comment.
If you format the JSON nicely the fails will be reported pretty clearly via the output of the diff I think.. so you can remove the check below?
There was a problem hiding this comment.
That would cause the code to verify both gzip compressed and non-compressed sizes, but I do not want to test gzip compressed sizes, just print them, since strictly optimizing for gzip compressed sizes is not productive. (also there is no guarantee that different systems will produce identical gzip compressed output)
There was a problem hiding this comment.
I still think why you can replace lines 9739 through 9747 with
expected = json.dumps(obtained_results, indent=2) + '\n'
self.assertFileContents(results_file, expected)
If you want to print something and not compare it then isn't the best way simply not to include it in the expected string. (Otherwise you will get cases where the tests pass by EMTEST_REBASELINE still produces a diff.. which is a little confusing I think).
The side effect of doing it this way is that the tests will "fail fast", but I actually prefer this over the method of storing the failure on the side and delaying reporting until later. Plus EMTEST_REBASELINE makes it easy to run through all them effectively skipping over the failures.
There was a problem hiding this comment.
Otherwise you will get cases where the tests pass by EMTEST_REBASELINE still produces a diff.. which is a little confusing I think).
The .gz sizes are included so that the effect on their size changes can be easily tracked when doing changes locally. We have not tracked them before, and it would be informative to know how they change, we'd lose that if so.
Also using assertFileContents would mean dropping the current allowance for slop that we have now. Neither compiler produces identical results across OSes and systems, for unknown reasons. That would probably require first fixing up all sources of nondeterminism in the compiler backends first.
28083ad to
4f49de8
Compare
|
I also recently landed a change to make the |
sbc100
left a comment
There was a problem hiding this comment.
OK sounds good.
Can you now remove the "success" variable and just self.assertEqual(total_output_size, total_expected_size)?
The current failure mode of AssertionError: False is not true is rather confusing, and I think all the benefit of continuing after a failure can be had by just adding EMTEST_REBASELINE and re-running.
| "a.html.gz": 8602, | ||
| "total": 20613, | ||
| "total_gz": 8602 | ||
| } No newline at end of file |
There was a problem hiding this comment.
These are programmatically generated. Could add an explicit + '\n' to the write, but why? It is not as if these files are #included anywhere that we'd need to care about concatenation rules...
There was a problem hiding this comment.
Yeah, please just add the '\n' when you write the file.
For consistency I think all text files (especially those under source control) should end in a newline. Tools like vim and github's UI hightlight the lack of newlines and I tend to agree with them.
30ce80b to
73e16c3
Compare
|
This rebaselining approach is a bit tricky with nondeterministic output. Fortunately it looks like that only fastcomp backend has nondeterminism, so I adjusted this to only allow slop for fastcomp, and loosened the slop amount so that it passes on the CI. |
sbc100
left a comment
There was a problem hiding this comment.
Non-determinism is worrying, but this change lgtm.
…TEST_REBASELINE=1 env. var. Add a new test for printf+random number generation+SINGLE_FILE combination
7fc2d5b to
b7d53f8
Compare
|
Unfortunately it looks like there is nondeterminism in wasm backend as well, although I believe the nondeterminism comes closure. Posted #10546 about that. |
This adds EMTEST_REBASELINE=1 support to test other.test_minimal_runtime_code_size.
Also adds a new code size test that stresses
printf(), different random number generation functions, andSINGLE_FILE=1support.