-
Notifications
You must be signed in to change notification settings - Fork 859
Run spec tests in parallel to reduce the execution time #8088
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb0d612
Add thread pool for spec tests
stevenfontanella 0295f43
PR Fixes + try fix for lower Python version to fix Alpine CI
stevenfontanella 8b6039f
PR fixes
stevenfontanella 659663c
Fix _process_communicate
stevenfontanella 97fe435
Try fixing std::array initialization
stevenfontanella 30892d5
Remove unrelated fix
stevenfontanella 184f986
Merge branch 'main' into multithread
stevenfontanella 008194e
Use more precise base name logic
stevenfontanella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import io | ||
| import filecmp | ||
| import os | ||
| import re | ||
|
|
@@ -185,16 +186,44 @@ def write_wast(filename, wast, asserts=[]): | |
| o.write(wast + '\n'.join(asserts)) | ||
|
|
||
|
|
||
| def run_command(cmd, expected_status=0, stderr=None, | ||
| # Hack to allow subprocess.Popen with stdout/stderr to StringIO, which doesn't have a fileno and doesn't work otherwise | ||
| def _process_communicate(*args, **kwargs): | ||
| overwrite_stderr = "stderr" in kwargs and isinstance(kwargs["stderr"], io.StringIO) | ||
| overwrite_stdout = "stdout" in kwargs and isinstance(kwargs["stdout"], io.StringIO) | ||
|
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. Ha, this looks very similar to the code we have in emscripten test suite for this same purpose: https://github.com/emscripten-core/emscripten/blob/cb4450380c27e9be81e7c239ec7af5005ad283cd/test/common.py#L1153-L1181 Great minds think alike (or use the same AI :) |
||
|
|
||
| if overwrite_stdout: | ||
| stdout_fd = kwargs["stdout"] | ||
| kwargs["stdout"] = subprocess.PIPE | ||
| if overwrite_stderr: | ||
| stderr_fd = kwargs["stderr"] | ||
| kwargs["stderr"] = subprocess.PIPE | ||
|
|
||
| proc = subprocess.Popen(*args, **kwargs) | ||
| out, err = proc.communicate() | ||
|
|
||
| if overwrite_stdout: | ||
| stdout_fd.write(out) | ||
| if overwrite_stderr: | ||
| stderr_fd.write(err) | ||
|
|
||
| return out, err, proc.returncode | ||
|
|
||
|
|
||
| def run_command(cmd, expected_status=0, stdout=None, stderr=None, | ||
| expected_err=None, err_contains=False, err_ignore=None): | ||
| ''' | ||
| stderr - None, subprocess.PIPE, subprocess.STDOUT or a file handle / io.StringIO to write stdout to | ||
| stdout - File handle to print debug messages to | ||
| returns the process's stdout | ||
| ''' | ||
| if expected_err is not None: | ||
| assert stderr == subprocess.PIPE or stderr is None, \ | ||
| "Can't redirect stderr if using expected_err" | ||
| stderr = subprocess.PIPE | ||
| print('executing: ', ' '.join(cmd)) | ||
| proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=stderr, universal_newlines=True, encoding='UTF-8') | ||
| out, err = proc.communicate() | ||
| code = proc.returncode | ||
| print('executing: ', ' '.join(cmd), file=stdout) | ||
|
|
||
| out, err, code = _process_communicate(cmd, stdout=subprocess.PIPE, stderr=stderr, universal_newlines=True, encoding='UTF-8') | ||
|
|
||
| if expected_status is not None and code != expected_status: | ||
| raise Exception(f"run_command `{' '.join(cmd)}` failed ({code}) {err or ''}") | ||
| if expected_err is not None: | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.