Skip to content

Commit c4ec810

Browse files
nadilasclaude
andcommitted
test: add 3 tests for subset filtering, unknown domain, and forward-dep error paths
Covers critical paths not exercised by existing tests: - subset filtering on full 8-patch set (domain exclusion logic) - unknown subset domain exits non-zero with clear message - forward dependency ("comes later") produces distinct error vs "not present" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 35028c7 commit c4ec810

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

scripts/rebase-libc.test.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# 8. --validate --subset filesystem validates filesystem-only subset
1818
# 9. --validate reports clear error for socket patches without filesystem
1919
# 10. --help includes --validate and --subset documentation
20+
# 11. --subset dns on full 8-patch set validates only DNS patches
21+
# 12. --subset with unknown domain exits non-zero
22+
# 13. dependency that comes later in series produces distinct error
2023
#
2124
# Usage:
2225
# ./rebase-libc.test.sh Run all tests
@@ -380,6 +383,60 @@ else
380383
fail "--help missing --validate and/or --subset. Output: ${OUTPUT}"
381384
fi
382385

386+
# ── Test 11: --subset filters domain from full patch set ──────────────
387+
388+
log "Test 11: --subset dns on full 8-patch set validates only DNS patches"
389+
390+
PATCHES="${_tmpdir}/test11-patches"
391+
mkdir -p "${PATCHES}"
392+
make_valid_patch_set "${PATCHES}"
393+
394+
EXIT_CODE=0
395+
OUTPUT=$(run_validate "${PATCHES}" --subset dns 2>&1) || EXIT_CODE=$?
396+
397+
# Should pass (DNS subset is self-consistent) and only validate 3 patches
398+
if [ ${EXIT_CODE} -eq 0 ] && echo "${OUTPUT}" | grep -q "3 patch"; then
399+
pass "--subset dns on full set validates only 3 DNS patches"
400+
else
401+
fail "--subset dns on full set should pass with 3 patches (exit=${EXIT_CODE}). Output: ${OUTPUT}"
402+
fi
403+
404+
# ── Test 12: --subset with unknown domain exits non-zero ──────────────
405+
406+
log "Test 12: --subset with unknown domain exits non-zero"
407+
408+
PATCHES="${_tmpdir}/test12-patches"
409+
mkdir -p "${PATCHES}"
410+
make_valid_patch_set "${PATCHES}"
411+
412+
EXIT_CODE=0
413+
OUTPUT=$(run_validate "${PATCHES}" --subset bogus 2>&1) || EXIT_CODE=$?
414+
415+
if [ ${EXIT_CODE} -ne 0 ] && echo "${OUTPUT}" | grep -qi "no patches found.*bogus\|bogus"; then
416+
pass "--subset with unknown domain exits non-zero"
417+
else
418+
fail "--subset bogus should fail (exit=${EXIT_CODE}). Output: ${OUTPUT}"
419+
fi
420+
421+
# ── Test 13: dependency that comes later produces distinct error ───────
422+
423+
log "Test 13: dependency that comes later in series produces distinct error"
424+
425+
PATCHES="${_tmpdir}/test13-patches"
426+
mkdir -p "${PATCHES}"
427+
# Create patches where 0001 declares a dependency on 0002 (which exists but comes after)
428+
make_patch "${PATCHES}" "0001-dns.patch" "dns" "0002" "warpgrid:shim/dns"
429+
make_patch "${PATCHES}" "0002-fs.patch" "filesystem" "none" "warpgrid:shim/filesystem"
430+
431+
EXIT_CODE=0
432+
OUTPUT=$(run_validate "${PATCHES}" 2>&1) || EXIT_CODE=$?
433+
434+
if [ ${EXIT_CODE} -ne 0 ] && echo "${OUTPUT}" | grep -qi "comes later"; then
435+
pass "--validate distinguishes 'comes later' from 'not present'"
436+
else
437+
fail "--validate should report 'comes later' for forward deps (exit=${EXIT_CODE}). Output: ${OUTPUT}"
438+
fi
439+
383440
# ── Summary ──────────────────────────────────────────────────────────
384441

385442
echo ""

0 commit comments

Comments
 (0)