Repository navigation
Commit 23d4833
committed
test(watcher): poll-only-watched-projects waits for the watched reindex, not one poll
watcher_poll_only_watched_projects failed on the macOS LSan job of PR
DeusData#2295, whose diff was Java-only, with
`FAIL tests/test_watcher.c:2971: index_call_count == 0, expected 1`
(8211 passed, 1 failed). The LSan report that followed points into the
aborted test body (watcher and store never freed after the early FAIL):
a consequence, not a separate leak.
The assert expected ONE touch+poll after a dirty change to reindex
exactly once. That needs every git probe of the poll to succeed. A poll
whose git spawn is refused under runner load is a fail-closed no-op by
design (DeusData#937: the baseline stays uncommitted and the next poll retries),
and that path returns without a log line. This is the same test race
that DeusData#2376 fixed in watcher_unwatch_drains_pending_free and
watcher_sustained_failure_logs_once_issue2015, not a production defect.
Holding one exhausted spawn with
cbm_subprocess_force_spawn_eagain_for_testing at that poll reproduces
the CI output exactly: watch, baseline, then
`FAIL tests/test_watcher.c:2971: index_call_count == 0, expected 1 == 1`,
with no watcher.changed and no watcher.git.failed.
The old test was also partly inert. The Go original (TestPollAllOnlyWatched,
from the DeusData#49 fix that replaced scan-all with an explicit watch list)
registered BOTH projects in the store and asserted that the unwatched
one gets no watcher state. The C port dropped the store registration, so
nothing let the watcher learn about B, and the B half could not fail.
The test now:
- registers A and B in the store, and watches only A;
- asserts that the baseline poll indexes nothing and does not adopt B;
- makes both worktrees dirty (a dirty change, not a commit, so a late
baseline still sees it);
- polls until A's reindex has happened, asserting after EVERY poll that B
has no watcher state (cbm_watcher_index_failure_count == -1), was never
reindexed, and that the watch count is still 1;
- asserts that A was reindexed exactly once.
No timer or deadline decides the verdict. A watcher that never reindexes
A hangs, which the runner reports as a failure, never a pass.
Evidence (macOS arm64, ASan/UBSan test-runner, CBM_SANITIZED, so one
exhausted spawn = 10 injected refusals), with temporary injection that
has since been removed:
- CI-shaped (baseline OK, first change poll refused): consumed=10 at
loop poll 1, watcher.changed at loop poll 2, PASS.
- Heavy (baseline poll plus loop polls 1-3 refused): loop poll 4 takes
the baseline, poll 5 reindexes A; loop polls=5 watched=1 other=0, PASS.
- Mutation, the pre-DeusData#49 scan-all (poll_once adopts every stored project):
`FAIL tests/test_watcher.c:3001: cbm_watcher_index_failure_count(w,
"projB-ow") == 0, expected -1 == -1`, both unforced and with the heavy
refusals (A's and B's baseline spawns both refused). The other 82
watcher tests stay green under that mutation, so this is the only
test guarding DeusData#49.
Final tree: build/c/test-runner watcher, 5/5 runs, 83 passed each.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 1f9b4db commit 23d4833
1 file changed
Lines changed: 65 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2905 | 2905 | | |
2906 | 2906 | | |
2907 | 2907 | | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
2908 | 2923 | | |
2909 | | - | |
2910 | | - | |
2911 | | - | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
2912 | 2943 | | |
2913 | 2944 | | |
2914 | 2945 | | |
| |||
2941 | 2972 | | |
2942 | 2973 | | |
2943 | 2974 | | |
| 2975 | + | |
| 2976 | + | |
2944 | 2977 | | |
2945 | | - | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
2946 | 2981 | | |
2947 | 2982 | | |
2948 | 2983 | | |
2949 | 2984 | | |
2950 | | - | |
| 2985 | + | |
| 2986 | + | |
2951 | 2987 | | |
2952 | | - | |
2953 | | - | |
2954 | | - | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
2955 | 2995 | | |
2956 | | - | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
2957 | 3001 | | |
2958 | 3002 | | |
2959 | 3003 | | |
| |||
2965 | 3009 | | |
2966 | 3010 | | |
2967 | 3011 | | |
2968 | | - | |
2969 | | - | |
2970 | | - | |
2971 | | - | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
2972 | 3024 | | |
2973 | 3025 | | |
2974 | 3026 | | |
| |||
0 commit comments