myxce/.wolf/bugs/bug-1889.md
Rongsong Shen 7b001cb0f7
chore(buglog): bug-1885..1889 fixed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 10:35:43 +00:00

57 lines
3 KiB
Markdown

---
id: "bug-1889"
status: "fixed"
status_updated: "2026-09-29"
status_note: ""
component: "lib"
severity: "wrong-result"
timestamp: "2026-09-29T10:32:13Z"
last_seen: "2026-09-29T10:32:13Z"
occurrences: 1
files: ["src/lib/testsuite/test_libxce_retry.c", "src/lib/testsuite/test.c", "src/lib/xcelimit.c"]
tags: ["lib", "test", "harness"]
related: []
fix_commits: ["9c51de88"]
---
# bug-1889: xcelib_test exits 0 on failures: nested UNITY_BEGIN in test_libxce_retry resets counts
## Description
**Observed:** `xcelib_test` printed
```
../lib/testsuite/test.c:479:test_fmt_limit_units_percent_limit_ignores_units_mode:FAIL: a percentage-based limit's value must render identically regardless of units_mode ...
56 Tests 0 Failures 0 Ignored
```
and exited 0, so meson reported the libxce suite OK on every run.
**Expected:** a failing test fails xcelib_test and the suite.
**Impact:** wrong result (test harness): any failure in a test group run before test_libxce_retry was silently dropped. One real failure was hidden: fmt_limit_units() printed a 0.8 percent limit as "80.000001%".
**Found by:** test (reported by the user as a failing test, 2026-09-29)
## Environment
- OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
- libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2)
- Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
- Build: asan (src/xce.build.discrete)
- Code: scheduler-framework @ 9c51de88-dirty
- Deployment: n/a (unit test)
## Reproduction
1. `src/xce.build.discrete/lib/xcelib_test; echo $?` at a commit before 9c51de88.
2. Observe the FAIL line, "0 Failures" and exit 0.
- Frequency: deterministic
- Evidence: output quoted above
## Root cause
`test_libxce_retry()`, one group of test.c's single runner, called `UNITY_BEGIN()`/`UNITY_END()` itself; `UNITY_BEGIN()` resets Unity's test and failure counters, so failures from earlier groups were lost and the final `UNITY_END()` returned 0. The hidden failure: fmt_limit_units() widened the float limit value before multiplying by 100 (0.8f -> 0.800000011920929 -> "80.000001%").
## Fix
Removed the nested UNITY_BEGIN/UNITY_END (the runner now reports 695 tests; this was the only hidden failure), and fmt_limit_units() scales in float then widens, giving the configured 80 (9c51de88). A scan of every testsuite found no other nested runner.
## Verification
- Test: test_fmt_limit_units_percent_limit_ignores_units_mode in src/lib/testsuite/test_limit.c: FAIL (now counted: 695 tests, 1 failure, exit 1) before the formatter fix, PASS after
- Suites: ASAN debug build (src/xce.build.discrete), `meson test --no-suite xceadmin`: 117/117 OK, 0 sanitizer reports; xcelib_test 695 tests 0 failures (2026-09-29)
- Live: 3-round sequential HA soak on rebuilt ASAN binaries (/home/claude/tmp/xce-bug1885-soak, 2026-09-29): PASS, 15 jobs, zero job loss, all 3 nodes led; SIMVERIFY 4 files 0 mismatches; each recording replays with detect_leaks=1 at exit 0, 0 mismatches; no sanitizer report in the scheduler or controller stderr
## References
- Related: none