Message ID | 20250116161559.91038-2-kuforiji98@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | aae2b431b003e7c55a1e359062c8547e6521098f |
Headers | show |
Series | t/unit-tests: convert unit-tests to use clar | expand |
On Thu, Jan 16, 2025 at 05:15:56PM +0100, Seyi Kuforiji wrote: > The script is designed to extract function signatures that match a > specific pattern derived from the unit test file's name. > `generate-clar-decls.sh` does not pick up dashes in filenames, which > prevents the scripts from being run. As said in my first round, saying "scripts" here is misleading as the unit tests aren't scripts in the first place. How about: The "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. Patrick
diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh index 3b315c64b3..abf6a2ea2a 100755 --- a/t/unit-tests/generate-clar-decls.sh +++ b/t/unit-tests/generate-clar-decls.sh @@ -14,6 +14,7 @@ do suite_name=$(basename "$suite") suite_name=${suite_name%.c} suite_name=${suite_name#u-} + suite_name=$(echo "$suite_name" | tr '-' '_') sed -ne "s/^\(void test_${suite_name}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" || exit 1 done >"$OUTPUT"
The script is designed to extract function signatures that match a specific pattern derived from the unit test file's name. `generate-clar-decls.sh` does not pick up dashes in filenames, which prevents the scripts from being run. 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 <ps@pks.im> Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> --- t/unit-tests/generate-clar-decls.sh | 1 + 1 file changed, 1 insertion(+)