9e597a8f98e918d3c118943293cc7f45ec37768a braney Tue Sep 8 10:12:21 2026 -0700 lib/tests: add pathSimplifyTest, covering path canonicalization Covers eatSlashSlashInPath and eatExcessDotsInPath, which had no test. The test has two halves. The first prints the canonical form of 41 named paths and the makefile diffs that against expected/, so a change in behavior shows up as a diff. Those paths include the cases from #37263: a ".." that climbs out of a relative path, a "." next to a "..", and a ".." at the root of an absolute path. The second half enumerates every path over the alphabets "/.a" up to length 9 and "/.ab" up to length 7, 51369 in all, and compares the answer against a reference written inside the test. The reference builds a stack of components instead of walking one buffer with two pointers, so the two are unlikely to share a mistake. Only the count and the number of disagreements go in the expected file, which keeps it small while the check stays broad. A test that cannot fail is worth nothing, so this was checked against the version of osunix.c from before the fix: it reports 32 differing named lines and 1949 disagreements with the reference there, and none against the current code. refs #37263 diff --git src/lib/tests/makefile src/lib/tests/makefile index 87bd4827076..ba04435e7d6 100644 --- src/lib/tests/makefile +++ src/lib/tests/makefile @@ -1,39 +1,46 @@ kentSrc = ../.. include ../../inc/common.mk MYLIBDIR = ../../lib/${MACHTYPE} MYLIBS = ${MYLIBDIR}/jkweb.a BIN_DIR = bin/${MACHTYPE} pipelineTester = ${BIN_DIR}/pipelineTester test: errCatchTest htmlPageTest htmlExpandUrlTest htmlSanitizeTest pipelineTests dyStringTest \ mimeTests base64Tests quotedPTests safeTest hashTest fetchUrlTest gff3Test \ tabixTest vcfTest hacTreeTest mmHashTest testSumDoubles jsonQueryTest \ - dnaCodonTest + dnaCodonTest pathSimplifyTest rm -r output fetchUrlTest testSumDoubles @echo tested all mkdirs: ${MKDIR} output ${BIN_DIR} testSumDoubles: testSumDoubles.o ${MYLIBS} @${MKDIR} $(dir $@) ${CC} ${COPT} -o ./testSumDoubles testSumDoubles.o ${MYLIBS} ${L} +pathSimplifyTest: pathSimplifyTest.o ${MYLIBS} mkdirs + @${MKDIR} $(dir $@) + ${CC} ${COPT} -o ${BIN_DIR}/pathSimplifyTest pathSimplifyTest.o ${MYLIBS} ${L} + ${STRIP} ${BIN_DIR}/pathSimplifyTest${EXE} + ${BIN_DIR}/pathSimplifyTest > output/pathSimplifyTest + diff expected/pathSimplifyTest output/pathSimplifyTest + dnaCodonTest: dnaCodonTest.o ${MYLIBS} mkdirs @${MKDIR} $(dir $@) ${CC} ${COPT} -o ${BIN_DIR}/dnaCodonTest dnaCodonTest.o ${MYLIBS} ${L} ${STRIP} ${BIN_DIR}/dnaCodonTest${EXE} ${BIN_DIR}/dnaCodonTest > output/dnaCodonTest diff expected/dnaCodonTest output/dnaCodonTest htmlSanitizeTest: htmlSanitizeTest.o ${MYLIBS} mkdirs @${MKDIR} $(dir $@) ${CC} ${COPT} -o ${BIN_DIR}/htmlSanitizeTest htmlSanitizeTest.o ${MYLIBS} ${L} ${STRIP} ${BIN_DIR}/htmlSanitizeTest${EXE} ${BIN_DIR}/htmlSanitizeTest > output/htmlSanitizeTest diff expected/htmlSanitizeTest output/htmlSanitizeTest errCatchTest: errCatchTest.o ${MYLIBS} mkdirs