-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add test runner option --log-test-environment #25843
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?
Conversation
…and print detailed information about Emscripten tool setup: Emcc, Clang, Binaryen, Node, Python and LLVM. This helps CI maintainers emit info to test run logs of the active setup for reference.
sbc100
left a comment
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.
Seems like useful thing!
|
|
||
|
|
||
| def print_repository_info(directory, repository_name): | ||
| import subprocess |
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.
No need for this import here
| print(f'Emscripten test runner path: "{os.path.realpath(__file__)}"') | ||
|
|
||
| if os.path.isdir(os.path.join(config.EMSCRIPTEN_ROOT, '.git')): | ||
| print(f'\nEmscripten repository: "{config.EMSCRIPTEN_ROOT}"') |
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.
I'm trying to remove EMSCRIPTEN_ROOT as a thing. You can just use path_from_root() or __rootpath__ in this file.
As of today we only support running tests againt the version of emscripten in which the test runner lives.
| if os.path.isdir(os.path.join(config.EMSCRIPTEN_ROOT, '.git')): | ||
| print(f'\nEmscripten repository: "{config.EMSCRIPTEN_ROOT}"') | ||
|
|
||
| emscripten_version = os.path.realpath(os.path.join(config.EMSCRIPTEN_ROOT, 'emscripten-version.txt')) |
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.
path_from_root('emscripten-version.txt')
|
|
||
| emscripten_version = os.path.realpath(os.path.join(config.EMSCRIPTEN_ROOT, 'emscripten-version.txt')) | ||
| if os.path.isfile(emscripten_version): | ||
| print(f'emscripten-version.txt: {utils.read_file(emscripten_version).strip()}') |
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.
You can just use utils.EMSCRIPTEN_VERSION here (its is populated from this file)
| print(f'\n{utils.read_file(config.EM_CONFIG).strip()}\n') | ||
|
|
||
| node_js_version = subprocess.run(config.NODE_JS + ['--version'], stdout=subprocess.PIPE, text=True).stdout.strip() | ||
| print(f'NODE_JS: {config.NODE_JS}. Version: {node_js_version}') |
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.
We already have this available via utils.get_node_version()
|
|
||
| print(f'BINARYEN_ROOT: {config.BINARYEN_ROOT}') | ||
| wasm_opt_version = subprocess.run([os.path.join(config.BINARYEN_ROOT, 'bin', 'wasm-opt.exe'), '--version'], stdout=subprocess.PIPE, text=True).stdout.strip() | ||
| print(f'wasm-opt version: {wasm_opt_version}') |
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.
We have building.check_binaryen() that does this so we could maybe refactor that to export building.get_binaryen_version()?
| print_repository_info(llvm_git_root, 'LLVM') | ||
|
|
||
| clang_version = subprocess.run([shared.CLANG_CC, '--version'], stdout=subprocess.PIPE, text=True).stdout.strip() | ||
| print(f'Clang: "{shared.CLANG_CC}"\n{clang_version}\n') |
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.
We have shared.get_clang_version() for this.
|
|
||
| print(f'EMTEST_BROWSER: {browser_common.EMTEST_BROWSER}') | ||
| firefox_version = browser_common.get_firefox_version() | ||
| if firefox_version != 2**31 - 1: |
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.
Maybe use is_firefox here ?
|
|
||
| def print_repository_info(directory, repository_name): | ||
| import subprocess | ||
| current_commit = subprocess.run(['git', 'log', '-n1'], cwd=directory, stdout=subprocess.PIPE, text=True).stdout.strip() |
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.
Maybe git show -s ?
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.
Can you use utils.run_process instead of using subprocess directly (at least where possible). I'm trying to keep all subprocess usage using those helpers.
| import subprocess | ||
| current_commit = subprocess.run(['git', 'log', '-n1'], cwd=directory, stdout=subprocess.PIPE, text=True).stdout.strip() | ||
| print(f'\n{repository_name} {current_commit}\n') | ||
| local_changes = subprocess.run(['git', 'diff'], cwd=directory, stdout=subprocess.PIPE, text=True).stdout.strip() |
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.
Maybe just remove the stdout=subprocess.PIPE so that the output goes directly to stdout?
Add test runner option --log-test-environment, which will introspect and print detailed information about Emscripten tool setup: Emcc, Clang, Binaryen, Node, Python and LLVM. This helps CI maintainers emit info to test run logs of the active setup for reference.
test/runner --log-test-environment <tests_to_run>will then print a following log info dump before starting the tests: