Skip to content

Commit aae2b43

Browse files
Seyi007gitster
authored andcommitted
t/unit-tests: handle dashes in test suite filenames
"generate-clar-decls.sh" script is designed to extract function signatures that match a specific pattern derived from the unit test file's name. The script does not know to massage file names with dashes, which will make it search for functions that look like, for example, `test_mem-pool_*`. Having dashes in function names is not allowed though, so these patterns won't ever match a legal function name. Adapt script to translate dashes (`-`) in test suite filenames to underscores (`_`) to correctly extract the function signatures and run the corresponding tests. This will be used by subsequent commits which follows the same construct. Mentored-by: Patrick Steinhardt <[email protected]> Signed-off-by: Seyi Kuforiji <[email protected]> Acked-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 757161e commit aae2b43

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/unit-tests/generate-clar-decls.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ do
1414
suite_name=$(basename "$suite")
1515
suite_name=${suite_name%.c}
1616
suite_name=${suite_name#u-}
17+
suite_name=$(echo "$suite_name" | tr '-' '_')
1718
sed -ne "s/^\(void test_${suite_name}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
1819
exit 1
1920
done >"$OUTPUT"

0 commit comments

Comments
 (0)