-
Notifications
You must be signed in to change notification settings - Fork 856
Testing: Add verbose logging feature, and stop excessive spec logging #8684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
2f5fe79
1291974
d114c3b
134b87e
7f5b2c2
63e6f5a
20c32b3
29b0d0d
f6ff35e
dae3414
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| import re | ||
| import subprocess | ||
|
|
||
| from . import shared | ||
|
|
||
| QUOTED = re.compile(r'\(module\s*(\$\S*)?\s+(quote|binary)') | ||
|
|
||
| MODULE_DEFINITION_OR_INSTANCE = re.compile(r'(?m)\(module\s+(instance|definition)') | ||
|
|
@@ -147,7 +149,7 @@ def run_command(cmd, expected_status=0, stdout=None, stderr=None, | |
| assert stderr == subprocess.PIPE or stderr is None, \ | ||
| "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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this one kind of important?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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: This is worse than the |
||
|
|
||
| out, err, code = _subprocess_run(cmd, stdout=subprocess.PIPE, stderr=stderr, encoding='UTF-8') | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets drop
file=stdoutin all these calls too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't
sys.stdout, we need to thread this through so that the threads can capture the stdout and write it in batchesUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. edit: raced with comment above, this was for sbc100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re:
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:
+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:
Overwriting
sys.stdoutisn'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes I forget, this approach works in emscripten because we use
multiprocessingrather than multi-threading. I suppose we could do that here too, although I'm not sure it worth it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I reverted the batching removal.