Testing: Add verbose logging feature, and stop excessive spec logging#8684
Testing: Add verbose logging feature, and stop excessive spec logging#8684kripken wants to merge 6 commits intoWebAssembly:mainfrom
Conversation
|
If this seems good I would like to improve other test suites than |
|
Looks great to me. Looks like there's no change to the logging if there's a failure, right? i.e. it will still print the same error message as before? |
|
Yes. Example output after I turned a should-be-invalid module into a valid one in e.g. This is essentially unchanged from before. |
|
Hmm, the import of shared from support seems to break the lit tests... 😞 |
| disassembled_file = f"{base_name}-ab.wast" if base_name is not None else "ab.wast" | ||
|
|
||
| print(' (binary format check)', file=stdout) | ||
| verbose_log(' (binary format check)', file=stdout) |
There was a problem hiding this comment.
Lets drop file=stdout in all these calls too?
There was a problem hiding this comment.
This isn't sys.stdout, we need to thread this through so that the threads can capture the stdout and write it in batches
There was a problem hiding this comment.
Done. edit: raced with comment above, this was for sbc100
There was a problem hiding this comment.
Oh I see. In that case I think we should perhaps revisit how this works.
If stdout is being captured then its find to print as much as we want there.
I guess the problem is that some of these functions are run both in stdout-capturing and not-stdout-capturing modes?
Would it make more sense for the capturing to be done via global sys.stdout = <buffering_thing> rather than threading this stdout through like this?
There was a problem hiding this comment.
@stevenfontanella is that batching necessary? I'm not sure I see a difference after removing it, which, I admit, I did without understanding what it was 😄 - but things seem to work now?
There was a problem hiding this comment.
Yes, its an important part of the parallelism in the spec running I think. You don't want stdout/stderr from the different tests to be interleaved so you need to capture and present it (or hide) atomically.
There was a problem hiding this comment.
re:
If stdout is being captured then its find to print as much as we want there.
If we want the output to be less verbose, I think we still want the logic to be the same either way? The stdout is captured but still output to the terminal, just in batches.
re:
is that batching necessary?
+1 to Sam, it's still necessary as long as each test may output more than 1 line, which definitely seems to be the case at least in verbose mode after this PR. Maybe you didn't see any interleaving because you weren't running in verbose mode?
re:
Would it make more sense for the capturing to be done via global sys.stdout = <buffering_thing> rather than threading this stdout through like this?
Overwriting sys.stdout isn't quite enough because globals are shared among all threads and we want each thread to have its own buffer. I asked Gemini at one point and it come up with this, that could be a potential thing to look into. Another more clear fix is to move things into classes and just pass in a logging abstraction per-thread.
There was a problem hiding this comment.
Ah, yes I forget, this approach works in emscripten because we use multiprocessing rather than multi-threading. I suppose we could do that here too, although I'm not sure it worth it.
| "Can't redirect stderr if using expected_err" | ||
| stderr = subprocess.PIPE | ||
| print('executing: ', ' '.join(cmd), file=stdout) | ||
| shared.verbose_log('executing: ', ' '.join(cmd), file=stdout) |
There was a problem hiding this comment.
Isn't this one kind of important?
There was a problem hiding this comment.
I actually would like to remove this because of all the noise, but maybe you're right, and it is why the lit tests broke... I removed this part. Output now looks like this:
$ ./check.py spec
[ checking wasm-shell spec testcases... ]
Running with 14 workers
.. address-offset-range.fail.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell /home/azakai/Dev/2-binaryen/test/spec/address-offset-range.fail.wast
.. binary.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell /home/azakai/Dev/2-binaryen/test/spec/binary.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell test-spec-binary.transformed
.. br_on_cast_desc_eq.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell /home/azakai/Dev/2-binaryen/test/spec/br_on_cast_desc_eq.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-opt test-spec-br_on_cast_desc_eq_split0.wast -O -all -q
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell test-spec-br_on_cast_desc_eq.transformed
.. break-drop.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell /home/azakai/Dev/2-binaryen/test/spec/break-drop.wast
executing: /home/azakai/Dev/2-binaryen/bin/wasm-opt test-spec-break-drop_split0.wast -O -all -q
executing: /home/azakai/Dev/2-binaryen/bin/wasm-shell test-spec-break-drop.transformed
This is worse than the lit output, but better than before...
New logging:
Old logging, available with
--verbose: