Files
git/t/unit-tests/generate-clar-decls.sh
Patrick Steinhardt 67f75dfe1b Makefile: extract script to generate clar declarations
Extract the script to generate function declarations for the clar unit
testing framework into a standalone script. This is done such that we
can reuse it in other build systems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2024-10-21 16:53:07 -04:00

17 lines
265 B
Bash
Executable File

#!/bin/sh
if test $# -lt 2
then
echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
exit 1
fi
OUTPUT="$1"
shift
for suite in "$@"
do
sed -ne "s/^\(void test_$(basename "${suite%.c}")__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
exit 1
done >"$OUTPUT"