Print detailed information about the current test environment. Useful for logging test run configuration in a CI.
()
| 595 | |
| 596 | |
| 597 | def log_test_environment(): |
| 598 | """Print detailed information about the current test environment. Useful for logging test run configuration in a CI.""" |
| 599 | print('======================== Test Setup ========================') |
| 600 | print(f'Test time: {datetime.datetime.now(datetime.timezone.utc).strftime("%A, %B %d, %Y %H:%M:%S %Z")}') |
| 601 | print(f'Python: "{sys.executable}". Version: {sys.version}') |
| 602 | print(f'Emscripten test runner path: "{os.path.realpath(__file__)}"') |
| 603 | |
| 604 | if os.path.isdir(utils.path_from_root('.git')): |
| 605 | print(f'\nEmscripten repository: "{__rootpath__}"') |
| 606 | |
| 607 | emscripten_version = utils.path_from_root('emscripten-version.txt') |
| 608 | if os.path.isfile(emscripten_version): |
| 609 | print(f'emscripten-version.txt: {utils.EMSCRIPTEN_VERSION}') |
| 610 | |
| 611 | if os.path.isdir(os.path.join(__rootpath__, '.git')): |
| 612 | print_repository_info(__rootpath__, 'Emscripten') |
| 613 | |
| 614 | print(f'EM_CONFIG: "{config.EM_CONFIG}"') |
| 615 | if os.path.isfile(config.EM_CONFIG): |
| 616 | print(f'\n{utils.read_file(config.EM_CONFIG).strip()}\n') |
| 617 | |
| 618 | node_js_version = utils.run_process(config.NODE_JS + ['--version'], stdout=subprocess.PIPE).stdout.strip() |
| 619 | print(f'NODE_JS: {config.NODE_JS}. Version: {node_js_version}') |
| 620 | |
| 621 | print(f'JS_ENGINES: {config.JS_ENGINES}') |
| 622 | print(f'BINARYEN_ROOT: {config.BINARYEN_ROOT}') |
| 623 | wasm_opt_version = building.get_binaryen_version(building.get_binaryen_bin()).strip() |
| 624 | print(f'wasm-opt version: {wasm_opt_version}') |
| 625 | |
| 626 | binaryen_git_dir = config.BINARYEN_ROOT |
| 627 | # Detect emsdk directory structure (build root vs source root) |
| 628 | if re.match(r'main_.*_64bit_binaryen', os.path.basename(binaryen_git_dir)): |
| 629 | binaryen_git_dir = os.path.realpath(os.path.join(binaryen_git_dir, '..', 'main')) |
| 630 | if os.path.isdir(os.path.join(binaryen_git_dir, '.git')): |
| 631 | print(f'Binaryen git directory: "{binaryen_git_dir}"') |
| 632 | print_repository_info(binaryen_git_dir, 'Binaryen') |
| 633 | |
| 634 | print(f'LLVM_ROOT: {config.LLVM_ROOT}') |
| 635 | |
| 636 | # Find LLVM git directory in emsdk aware fashion |
| 637 | def find_llvm_git_root(dir): |
| 638 | while True: |
| 639 | if os.path.isdir(os.path.join(dir, ".git")): |
| 640 | return dir |
| 641 | if os.path.isdir(os.path.join(dir, "src", ".git")): |
| 642 | return os.path.join(dir, "src") |
| 643 | if os.path.dirname(dir) == dir: |
| 644 | return None |
| 645 | dir = os.path.dirname(dir) |
| 646 | |
| 647 | llvm_git_root = find_llvm_git_root(config.LLVM_ROOT) |
| 648 | if llvm_git_root: |
| 649 | print(f'LLVM git directory: "{llvm_git_root}"') |
| 650 | print_repository_info(llvm_git_root, 'LLVM') |
| 651 | |
| 652 | clang_version = utils.run_process([shared.CLANG_CC, '--version'], stdout=subprocess.PIPE).stdout.strip() |
| 653 | print(f'Clang: "{shared.CLANG_CC}"\n{clang_version}\n') |
| 654 |
no test coverage detected