Skip to content

testdata: add a PGO regression test for the toolexec wrapper - #12

Merged
mauri870 merged 1 commit into
masterfrom
toolexec-pgo-test
Nov 3, 2026
Merged

mauri870 merged 1 commit into
masterfrom
toolexec-pgo-test

Conversation

@mauri870

@mauri870 mauri870 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

toolexec_reproducible.txt checks that two separate builds of a rewritten package give the same archive. It doesn't cover the failure that motivated #11. With PGO, go test compiles a package once for a main package's binary and again for its test binary. It then compiles the test against one copy and links the other, and the linker reports a fingerprint mismatch when the two differ.

toolexec_pgo.txt reproduces that. A main package with a default.pgo has a test that imports the rewritten package, so the test binary gets a PGO copy of its own. The profile is written by a small program inside the script, because a CPU profile with no samples is enough to turn PGO on. Without #11, go test ./... fails with the same link error seen in goav1:

link: fingerprint mismatch: example.com/app/vec has d0f77d59987fdb10, import from example.com/app/cmd/bench expecting 205082f863ae44a6

toolexec_reproducible.txt is also brought in line with the other toolexec scripts:

  • it checks the wrapper's log against a log.want section;
  • it checks that both builds print nothing;
  • it limits the log to the package under test with LOOPVEC_TOOLEXEC_LOG_PKGS.

Tested locally:

toolexec_reproducible.txt checks that two separate builds of a
rewritten package give the same archive, but not the failure that
motivated #11: with PGO, go test compiles a package once for a main
package's binary and again for its test binary, compiles the test
against one copy and links the other, and the linker reports a
fingerprint mismatch when the two differ.

toolexec_pgo.txt reproduces that. A main package with a default.pgo
has a test that imports the rewritten package, so the test binary gets
a PGO copy of its own. The profile is written by a small program in the
script, since a CPU profile with no samples is enough to turn PGO on.
Without #11, go test ./... fails with the same link error seen in
goav1.

toolexec_reproducible.txt now checks the wrapper's log against a
log.want section and that both builds print nothing, and limits the log
to the package under test, like the other toolexec scripts.
@mauri870
mauri870 enabled auto-merge (squash) November 3, 2026 20:52
@mauri870
mauri870 merged commit 7678112 into master Nov 3, 2026
1 of 2 checks passed
mauri870 added a commit that referenced this pull request Nov 3, 2026
In 2196e07 I added `test-qemu-arm64` without a `-timeout`, so the root
package gets `go test`'s default of 10 minutes. On CI, the arm64 qemu
step has taken anywhere from 237 to 438 seconds. The tip job of #12,
which adds one more toolexec script, hit the limit:

```
panic: test timed out after 10m0s
	running tests:
		TestScripts/flag_precedence (2m3s)
		TestScripts/min_max_int (2m10s)
```

Nothing was stuck. The emulated suite is just slow, and runner speed
varies. Locally under qemu, `toolexec_pgo` takes about as long as the
other toolexec scripts, around 25 seconds of wall time with the scripts
running in parallel.

This change passes `-timeout=30m` to the target. `make test-qemu-arm64`
passes locally with the change.

After this merges, #12 needs a rerun, or a rebase onto master.
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.

1 participant