Skip to content

Conversation

@juj
Copy link
Collaborator

@juj juj commented Nov 20, 2025

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:


C:\emsdk\emscripten\main>test\runner --log-test-environment
======================== Test Setup ========================
Test time: Thursday, November 20, 2025 22:28:18 UTC
Python: "C:\emsdk\python\3.13.3_64bit\python.exe". Version: 3.13.3 (tags/v3.13.3:6280bb5, Apr  8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)]
Emscripten test runner path: "C:\emsdk\emscripten\main\test\runner.py"

Emscripten repository: "C:\emsdk\emscripten\main"
emscripten-version.txt: 4.0.21-git

Emscripten commit cce3a701889bbc5b107056b0de3fab8d5ce6f885
Author: Jukka Jylänki <[email protected]>
Date:   Fri Nov 21 00:26:51 2025 +0200

    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.

EM_CONFIG: "C:\emsdk\.emscripten"

import os
emsdk_path = os.path.dirname(os.getenv('EM_CONFIG')).replace('\\', '/')
LLVM_ROOT = emsdk_path + '/llvm/git/build_main_vs2022_64/Release/bin'
NODE_JS = emsdk_path + '/node/22.16.0_64bit/bin/node.exe'
EMSDK_CMAKE = emsdk_path + '/cmake/4.2.0-rc3_64bit/bin/cmake.exe'
PYTHON = emsdk_path + '/python/3.13.3_64bit/python.exe'
EMSCRIPTEN_ROOT = emsdk_path + '/emscripten/main'
BINARYEN_ROOT = emsdk_path + '/binaryen/main_vs2022_64bit_binaryen'
MINGW_ROOT = emsdk_path + '/mingw/7.1.0_64bit'
NINJA = emsdk_path + '/ninja/git-release_64bit/bin'
EMSDK_ACTIVATED_TEST_BROWSER = emsdk_path + '/firefox/78.15.0esr_64bit/firefox.exe'

NODE_JS: ['C:/emsdk/node/22.16.0_64bit/bin/node.exe']. Version: v22.16.0
BINARYEN_ROOT: C:/emsdk/binaryen/main_vs2022_64bit_binaryen
wasm-opt version: wasm-opt version 124 (version_124-122-g8a66d2a7d)
Binaryen git directory: "C:\emsdk\binaryen\main"

Binaryen commit 8a66d2a7d48a0014dce5e22a2fa8eee12eb09b7c
Author: Alon Zakai <[email protected]>
Date:   Thu Nov 6 11:53:49 2025 -0800

    GUFA: Represent imported functions as globals (#8025)

    The meaning of Global in PossibleContents changes from "an actual wasm
    Global" to "an immutable global wasm thing, either a Global or a Function."
    Imported wasm Functions are effectively immutable values in the global
    scope - not concrete, specifically-known functions - so this is more correct.

    In particular, two imported Globals (of compatible types) might or might not
    be the same, and likewise with imported Functions. And that is not the case
    for defined Functions - they are definitely different.

    This does not fix the issues related to imported function type handling -
    #7993 does that - but this refactoring makes it possible to properly
    optimize imported functions afterward.

    This does make the PossibleContents object grow from 32 to 40 bytes,
    which might be why this adds 3-4% overhead to GUFA, but I don't see a
    good way to avoid that, unfortunately. Keeping our ability to optimize
    imported functions might be worth that 3-4% (we recently saw a few digits
    improvement due to properly optimizing imported externs, for example,
    from #8005).

LLVM_ROOT: C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin
LLVM git directory: "C:/emsdk/llvm/git\src"

LLVM commit d65be16ab6adf00af21e75d29049ae5de0f3a38a
Author: Ryan Cowan <[email protected]>
Date:   Mon Nov 17 15:55:40 2025 +0000

    [AArch64][GlobalISel] Add combine for build_vector(unmerge, unmerge, undef, undef) (#165539)

    This PR adds a new combine to the `post-legalizer-combiner` pass. The
    new combine checks for vectors being unmerged and subsequently padded
    with `G_IMPLICIT_DEF` values by building a new vector. If such a case is
    found, the vector being unmerged is instead just concatenated with a
    `G_IMPLICIT_DEF` that is as wide as the vector being unmerged.

    This removes unnecessary `mov` instructions in a few places.

Clang: "C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe"
clang version 22.0.0git (https://github.com/llvm/llvm-project.git d65be16ab6adf00af21e75d29049ae5de0f3a38a)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\emsdk\llvm\git\build_main_vs2022_64\Release\bin

EMTEST_BROWSER: "C:\\emsdk\\firefox\\78.15.0esr_64bit\\firefox.exe" -new-instance -wait-for-browser
Firefox version: 78
Not detected as a Safari browser

EMSDK: "C:/emsdk"

Emsdk commit fe91d96cfd53f505a2ce561b01320124bff438a1
Author: Jukka Jylänki <[email protected]>
Date:   Mon Nov 17 18:41:28 2025 +0200

    Use exit_with_error

==================== End of Test Setup =====================

juj added 3 commits November 21, 2025 00:28
…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.
Copy link
Collaborator

@sbc100 sbc100 left a 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
Copy link
Collaborator

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}"')
Copy link
Collaborator

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'))
Copy link
Collaborator

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()}')
Copy link
Collaborator

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}')
Copy link
Collaborator

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}')
Copy link
Collaborator

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')
Copy link
Collaborator

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:
Copy link
Collaborator

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe git show -s ?

Copy link
Collaborator

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()
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants