-
Notifications
You must be signed in to change notification settings - Fork 940
bazel: fix installed binary Tcl init failure #10116
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
4 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # Copyright (c) 2026, The OpenROAD Authors | ||
|
|
||
| load("@rules_shell//shell:sh_test.bzl", "sh_test") | ||
|
|
||
| sh_test( | ||
| name = "install_test", | ||
| srcs = ["install_test.sh"], | ||
| args = ["$(rootpath //packaging:tarfile)"], | ||
| data = ["//packaging:tarfile"], | ||
| tags = ["local"], | ||
| ) | ||
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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Install smoke test | ||
|
|
||
| Verifies that the binary produced by `//packaging:tarfile` starts correctly | ||
| after extraction (Tcl initialisation, runfiles resolution, etc.). | ||
|
|
||
| ## Running | ||
|
|
||
| ```sh | ||
| bazelisk test //test/install/... | ||
| ``` | ||
|
|
||
| ## What it checks | ||
|
|
||
| 1. Extracts the packaging tarball into a temporary directory (same layout | ||
| that `bazelisk run //packaging:install` produces). | ||
| 2. Launches the binary with a trivial Tcl script (`puts "install_test_ok"`). | ||
| 3. Asserts the expected output appears, proving Tcl initialised and the | ||
| interpreter is functional. | ||
|
|
||
| ## Background | ||
|
|
||
| The installed binary relies on Bazel runfiles for Tcl library files | ||
| (`init.tcl`, tclreadline, etc.). These live under | ||
| `openroad.runfiles/_main/bazel/tcl_resources_dir/`. If the runfiles | ||
| tree is damaged during packaging or installation the binary fails with | ||
| `application-specific initialization failed:` (GitHub issue #10115). |
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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # Copyright (c) 2026, The OpenROAD Authors | ||
| # | ||
| # Smoke test: extract the packaging tarball and verify the installed | ||
| # binary can start (Tcl initialisation succeeds). | ||
| set -euo pipefail | ||
|
|
||
| TARFILE="$1" | ||
|
|
||
| DEST_DIR=$(mktemp -d) | ||
| trap 'rm -rf "$DEST_DIR"' EXIT | ||
|
|
||
| cp "$TARFILE" "$DEST_DIR" | ||
| cd "$DEST_DIR" | ||
| tar -xf openroad.tar | ||
| rm -f openroad.tar | ||
|
|
||
| # Remove repo_mapping (same as install.sh) | ||
| if [ -e openroad.repo_mapping ]; then | ||
| chmod u+w openroad.repo_mapping | ||
| rm -rf openroad.repo_mapping | ||
| fi | ||
|
|
||
| # Clear Bazel runfiles env vars so the installed binary resolves its own | ||
| # runfiles tree (not the test runner's). | ||
| unset RUNFILES_DIR RUNFILES_MANIFEST_FILE TEST_SRCDIR | ||
|
|
||
| # Verify the binary starts and can evaluate a trivial Tcl expression. | ||
| echo 'puts "install_test_ok"' > test_script.tcl | ||
| if OUTPUT=$(./openroad -no_init -no_splash -exit test_script.tcl 2>&1) && echo "$OUTPUT" | grep -q "install_test_ok"; then | ||
| echo "PASS: installed binary started successfully" | ||
| else | ||
| echo "FAIL: installed binary failed to start or produced unexpected output" | ||
| echo "Output was: $OUTPUT" | ||
| exit 1 | ||
| fi |
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.
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.
The
localtag disables sandboxing and remote execution for this test, which can negatively impact build performance and reproducibility. Unless this test specifically requires access to host resources that cannot be provided in a sandbox (e.g., specific hardware or global paths), it is recommended to remove this tag to allow for better caching and parallel execution.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.
the test needs to be verified, i.e. that it is no more complicated than it needs to be to test this. Testing install like this is tricky because we're testing that an install used outside of bazel and not relying on pwd works. So an "hors format" bazel test.