Skip to content
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

Fixing a flaky test #4257

Merged
merged 3 commits into from
Feb 11, 2025
Merged

Fixing a flaky test #4257

merged 3 commits into from
Feb 11, 2025

Conversation

linzhp
Copy link
Contributor

@linzhp linzhp commented Feb 11, 2025

What type of PR is this?
Bug fix

What does this PR do? Why is it needed?
Adder_test.go generates two random int32 and adds them. There is a high chance that the sum overflow, which is an undefined behavior in C, and then caught by zig cc's ubsan (undefined behavior sanitizer), leading to test failure occasionally.

Generating smaller integers to avoid overflow.

Test plan

Run bazelisk test --runs_per_test 10 --extra_toolchains=@zig_sdk//toolchain:linux_amd64_gnu.2.31 //tests/core/cgo:opts_test

Before:

...
==================== Test output for //tests/core/cgo:opts_test (run 4 of 10):
SIGILL: illegal instruction
PC=0x4f19a7 m=4 sigcode=2
signal arrived during cgo execution
instruction bytes: 0x67 0xf 0xb9 0x0 0x8b 0x45 0xec 0x89 0x45 0xf0 0x8b 0x45 0xf4 0x3 0x45 0xf0
...
================================================================================
INFO: Found 1 test target...
Target //tests/core/cgo:opts_test up-to-date:
  bazel-bin/tests/core/cgo/opts_test_/opts_test
INFO: Elapsed time: 5.981s, Critical Path: 5.52s
INFO: 17 processes: 1 internal, 16 processwrapper-sandbox.
INFO: Build completed, 1 test FAILED, 17 total actions
//tests/core/cgo:opts_test                                               FAILED in 7 out of 10 in 0.1s
  Stats over 10 runs: max = 0.1s, min = 0.1s, avg = 0.1s, dev = 0.0s

After:

//tests/core/cgo:opts_test                                               PASSED in 0.1s
  Stats over 10 runs: max = 0.1s, min = 0.0s, avg = 0.1s, dev = 0.0s

@linzhp linzhp merged commit d27ac0a into bazel-contrib:master Feb 11, 2025
1 check passed
@linzhp linzhp deleted the flaky branch February 11, 2025 01:09
fmeum pushed a commit that referenced this pull request Feb 11, 2025
Sync test2json from upstream Go. All the code changes are from
golang/go. Only the comment was changed by this PR.

I tried to do that in #4250, but was blocked by a flaky test that was
fixed in #4257. Retrying...
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