diff --git a/test/README.md b/test/README.md index 0ce3c4e7..45e6d22a 100644 --- a/test/README.md +++ b/test/README.md @@ -40,10 +40,10 @@ output.log # the captured printed output--only for errors To add a test, create a new C file in [`src/misc`]: ```c -// filter.py(TARGET_TRIPLE): !wasm32-wasip2 -// add-flags.py(CFLAGS): ... -// add-flags.py(LDFLAGS): ... -// add-flags.py(RUN): ... +//! filter.py(TARGET_TRIPLE): !wasm32-wasip2 +//! add-flags.py(CFLAGS): ... +//! add-flags.py(LDFLAGS): ... +//! add-flags.py(RUN): ... void main() { ... } ``` diff --git a/test/scripts/add-flags.py b/test/scripts/add-flags.py index 8a26c46c..643a922b 100755 --- a/test/scripts/add-flags.py +++ b/test/scripts/add-flags.py @@ -9,7 +9,7 @@ # Example: # ``` # $ head one.c -# // add-flags.py(CFLAGS): -DFOO +# //! add-flags.py(CFLAGS): -DFOO # $ ./add-flags.py CFLAGS one.c # -DFOO @@ -19,17 +19,17 @@ import logging """ -Match a C comment like the following: `// add-flags.py: `. +Match a C comment like the following: `//! add-flags.py: `. """ -PATTERN = re.compile('\\s*//\\s*add-flags\\.py\\(([^)]+)\\):\\s*(.*)') +PATTERN = re.compile('\\s*//\\!\\s*add-flags\\.py\\(([^)]+)\\):\\s*(.*)') def find_flags(name, file): with open(file, 'r') as f: for lineno, line in enumerate(f, start=1): match = PATTERN.match(line) - pos = f'[{file}:{lineno}]' if match and match[1] == name: + pos = f'[{file}:{lineno}]' logging.debug(f'{pos} found flags') return match[2].strip() diff --git a/test/scripts/filter.py b/test/scripts/filter.py index 1fb22573..6df11717 100755 --- a/test/scripts/filter.py +++ b/test/scripts/filter.py @@ -3,7 +3,7 @@ # Filter out test files that do not match a configuration variable. # # This script accepts a list of files as arguments and looks for a comment like -# the following in each: `// filter.py(): `. The +# the following in each: `//! filter.py(): `. The # `VARIABLE` value is looked up in the environment and compared with the # expression. An `EXPRESSION` is a comma-separated list of terms: either # `` or `!`. If the `VARIABLE` value matches the expression, the @@ -12,9 +12,9 @@ # Example: # ``` # $ head one.c -# // filter.py(FOO): bar +# //! filter.py(FOO): bar # $ head two.c -# // filter.py(FOO):!bar, baz +# //! filter.py(FOO):!bar, baz # $ FOO=bar ./filter.py one.c two.c # one.c # $ FOO=baz ./filter.py one.c two.c @@ -55,9 +55,9 @@ def matches_expression(value, expr, pos): """ -Match a C comment like the following: `// filter.py(): `. +Match a C comment like the following: `//! filter.py(): `. """ -PATTERN = re.compile('\\s*//\\s*filter\\.py\\(([^)]+)\\):\\s*(.*)') +PATTERN = re.compile('\\s*//\\!\\s*filter\\.py\\(([^)]+)\\):\\s*(.*)') def line_matches(line, env, pos): diff --git a/test/src/libc-test/functional/argv.c b/test/src/libc-test/functional/argv.c index 741c7bc2..41dda8ae 100644 --- a/test/src/libc-test/functional/argv.c +++ b/test/src/libc-test/functional/argv.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/argv.c" diff --git a/test/src/libc-test/functional/basename.c b/test/src/libc-test/functional/basename.c index 7549ea45..feb49eef 100644 --- a/test/src/libc-test/functional/basename.c +++ b/test/src/libc-test/functional/basename.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/basename.c" diff --git a/test/src/libc-test/functional/clocale_mbfuncs.c b/test/src/libc-test/functional/clocale_mbfuncs.c index 34b8c4c9..d2bc5752 100644 --- a/test/src/libc-test/functional/clocale_mbfuncs.c +++ b/test/src/libc-test/functional/clocale_mbfuncs.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/clocale_mbfuncs.c" diff --git a/test/src/libc-test/functional/clock_gettime.c b/test/src/libc-test/functional/clock_gettime.c index 2ef8ac0b..1744dfb7 100644 --- a/test/src/libc-test/functional/clock_gettime.c +++ b/test/src/libc-test/functional/clock_gettime.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/clock_gettime.c" diff --git a/test/src/libc-test/functional/crypt.c b/test/src/libc-test/functional/crypt.c index d0792772..a49662cd 100644 --- a/test/src/libc-test/functional/crypt.c +++ b/test/src/libc-test/functional/crypt.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/crypt.c" diff --git a/test/src/libc-test/functional/dirname.c b/test/src/libc-test/functional/dirname.c index 59ba9c75..df9ea4ef 100644 --- a/test/src/libc-test/functional/dirname.c +++ b/test/src/libc-test/functional/dirname.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/dirname.c" diff --git a/test/src/libc-test/functional/env.c b/test/src/libc-test/functional/env.c index 1da8f66f..9dba36a5 100644 --- a/test/src/libc-test/functional/env.c +++ b/test/src/libc-test/functional/env.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/env.c" diff --git a/test/src/libc-test/functional/fnmatch.c b/test/src/libc-test/functional/fnmatch.c index 6e1eefeb..26ae512e 100644 --- a/test/src/libc-test/functional/fnmatch.c +++ b/test/src/libc-test/functional/fnmatch.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/fnmatch.c" diff --git a/test/src/libc-test/functional/iconv_open.c b/test/src/libc-test/functional/iconv_open.c index ceaedcd1..945c5726 100644 --- a/test/src/libc-test/functional/iconv_open.c +++ b/test/src/libc-test/functional/iconv_open.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/iconv_open.c" diff --git a/test/src/libc-test/functional/mbc.c b/test/src/libc-test/functional/mbc.c index ef540675..7b353ec2 100644 --- a/test/src/libc-test/functional/mbc.c +++ b/test/src/libc-test/functional/mbc.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/mbc.c" diff --git a/test/src/libc-test/functional/memstream.c b/test/src/libc-test/functional/memstream.c index 012d3312..c3fccf3a 100644 --- a/test/src/libc-test/functional/memstream.c +++ b/test/src/libc-test/functional/memstream.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/memstream.c" diff --git a/test/src/libc-test/functional/qsort.c b/test/src/libc-test/functional/qsort.c index 4ecae8a4..ba8debf8 100644 --- a/test/src/libc-test/functional/qsort.c +++ b/test/src/libc-test/functional/qsort.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/qsort.c" diff --git a/test/src/libc-test/functional/random.c b/test/src/libc-test/functional/random.c index 8c452573..b6282112 100644 --- a/test/src/libc-test/functional/random.c +++ b/test/src/libc-test/functional/random.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/random.c" diff --git a/test/src/libc-test/functional/search_hsearch.c b/test/src/libc-test/functional/search_hsearch.c index 8184280b..9a5eb9ad 100644 --- a/test/src/libc-test/functional/search_hsearch.c +++ b/test/src/libc-test/functional/search_hsearch.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/search_hsearch.c" diff --git a/test/src/libc-test/functional/search_insque.c b/test/src/libc-test/functional/search_insque.c index ecc1df24..21bf2cde 100644 --- a/test/src/libc-test/functional/search_insque.c +++ b/test/src/libc-test/functional/search_insque.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/search_insque.c" diff --git a/test/src/libc-test/functional/search_lsearch.c b/test/src/libc-test/functional/search_lsearch.c index f3285a24..e681fb54 100644 --- a/test/src/libc-test/functional/search_lsearch.c +++ b/test/src/libc-test/functional/search_lsearch.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/search_lsearch.c" diff --git a/test/src/libc-test/functional/search_tsearch.c b/test/src/libc-test/functional/search_tsearch.c index 94bf8a80..45804c5a 100644 --- a/test/src/libc-test/functional/search_tsearch.c +++ b/test/src/libc-test/functional/search_tsearch.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/search_tsearch.c" diff --git a/test/src/libc-test/functional/snprintf.c b/test/src/libc-test/functional/snprintf.c index 471351ec..67f64da3 100644 --- a/test/src/libc-test/functional/snprintf.c +++ b/test/src/libc-test/functional/snprintf.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/snprintf.c" diff --git a/test/src/libc-test/functional/sscanf.c b/test/src/libc-test/functional/sscanf.c index 003c1eec..ad63e275 100644 --- a/test/src/libc-test/functional/sscanf.c +++ b/test/src/libc-test/functional/sscanf.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/sscanf.c" diff --git a/test/src/libc-test/functional/strftime.c b/test/src/libc-test/functional/strftime.c index 7b187804..787f7e90 100644 --- a/test/src/libc-test/functional/strftime.c +++ b/test/src/libc-test/functional/strftime.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strftime.c" diff --git a/test/src/libc-test/functional/string.c b/test/src/libc-test/functional/string.c index 1f8bc987..52e181ef 100644 --- a/test/src/libc-test/functional/string.c +++ b/test/src/libc-test/functional/string.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string.c" diff --git a/test/src/libc-test/functional/string_memcpy.c b/test/src/libc-test/functional/string_memcpy.c index 868da19d..cfc94784 100644 --- a/test/src/libc-test/functional/string_memcpy.c +++ b/test/src/libc-test/functional/string_memcpy.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_memcpy.c" diff --git a/test/src/libc-test/functional/string_memmem.c b/test/src/libc-test/functional/string_memmem.c index 38f2d3a8..d2362c4c 100644 --- a/test/src/libc-test/functional/string_memmem.c +++ b/test/src/libc-test/functional/string_memmem.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_memmem.c" diff --git a/test/src/libc-test/functional/string_memset.c b/test/src/libc-test/functional/string_memset.c index a62ca6c0..d5672dac 100644 --- a/test/src/libc-test/functional/string_memset.c +++ b/test/src/libc-test/functional/string_memset.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_memset.c" diff --git a/test/src/libc-test/functional/string_strchr.c b/test/src/libc-test/functional/string_strchr.c index 6d20432f..c9c2d269 100644 --- a/test/src/libc-test/functional/string_strchr.c +++ b/test/src/libc-test/functional/string_strchr.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_strchr.c" diff --git a/test/src/libc-test/functional/string_strcspn.c b/test/src/libc-test/functional/string_strcspn.c index ab45e8e4..052e1e68 100644 --- a/test/src/libc-test/functional/string_strcspn.c +++ b/test/src/libc-test/functional/string_strcspn.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_strcspn.c" diff --git a/test/src/libc-test/functional/string_strstr.c b/test/src/libc-test/functional/string_strstr.c index 3f03f843..f0d2dbc7 100644 --- a/test/src/libc-test/functional/string_strstr.c +++ b/test/src/libc-test/functional/string_strstr.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/string_strstr.c" diff --git a/test/src/libc-test/functional/strtod.c b/test/src/libc-test/functional/strtod.c index f4b43be2..9bb36cff 100644 --- a/test/src/libc-test/functional/strtod.c +++ b/test/src/libc-test/functional/strtod.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strtod.c" diff --git a/test/src/libc-test/functional/strtod_long.c b/test/src/libc-test/functional/strtod_long.c index a91f4cdd..5779e277 100644 --- a/test/src/libc-test/functional/strtod_long.c +++ b/test/src/libc-test/functional/strtod_long.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strtod_long.c" diff --git a/test/src/libc-test/functional/strtod_simple.c b/test/src/libc-test/functional/strtod_simple.c index b23d469b..bbd817a1 100644 --- a/test/src/libc-test/functional/strtod_simple.c +++ b/test/src/libc-test/functional/strtod_simple.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strtod_simple.c" diff --git a/test/src/libc-test/functional/strtof.c b/test/src/libc-test/functional/strtof.c index cfca95da..a5682c13 100644 --- a/test/src/libc-test/functional/strtof.c +++ b/test/src/libc-test/functional/strtof.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strtof.c" diff --git a/test/src/libc-test/functional/strtol.c b/test/src/libc-test/functional/strtol.c index f5258fe5..b874d302 100644 --- a/test/src/libc-test/functional/strtol.c +++ b/test/src/libc-test/functional/strtol.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/strtol.c" diff --git a/test/src/libc-test/functional/strtold.c b/test/src/libc-test/functional/strtold.c index 7195ef49..8f467fed 100644 --- a/test/src/libc-test/functional/strtold.c +++ b/test/src/libc-test/functional/strtold.c @@ -1,3 +1,3 @@ -// add-flags.py(CFLAGS): -I. -// add-flags.py(LDFLAGS): -lc-printscan-long-double +//! add-flags.py(CFLAGS): -I. +//! add-flags.py(LDFLAGS): -lc-printscan-long-double #include "build/download/libc-test/src/functional/strtold.c" diff --git a/test/src/libc-test/functional/swprintf.c b/test/src/libc-test/functional/swprintf.c index a9d44854..278b177d 100644 --- a/test/src/libc-test/functional/swprintf.c +++ b/test/src/libc-test/functional/swprintf.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/swprintf.c" diff --git a/test/src/libc-test/functional/tgmath.c b/test/src/libc-test/functional/tgmath.c index 3f5f4626..3a9d3c33 100644 --- a/test/src/libc-test/functional/tgmath.c +++ b/test/src/libc-test/functional/tgmath.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/tgmath.c" diff --git a/test/src/libc-test/functional/udiv.c b/test/src/libc-test/functional/udiv.c index 15233d25..162b6002 100644 --- a/test/src/libc-test/functional/udiv.c +++ b/test/src/libc-test/functional/udiv.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/udiv.c" diff --git a/test/src/libc-test/functional/wcsstr.c b/test/src/libc-test/functional/wcsstr.c index ca84a72c..9c5581dd 100644 --- a/test/src/libc-test/functional/wcsstr.c +++ b/test/src/libc-test/functional/wcsstr.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/wcsstr.c" diff --git a/test/src/libc-test/functional/wcstol.c b/test/src/libc-test/functional/wcstol.c index 111bd504..04d19dd1 100644 --- a/test/src/libc-test/functional/wcstol.c +++ b/test/src/libc-test/functional/wcstol.c @@ -1,2 +1,2 @@ -// add-flags.py(CFLAGS): -I. +//! add-flags.py(CFLAGS): -I. #include "build/download/libc-test/src/functional/wcstol.c" diff --git a/test/src/misc/fts.c b/test/src/misc/fts.c index 850c54c6..1126f9b7 100644 --- a/test/src/misc/fts.c +++ b/test/src/misc/fts.c @@ -1,4 +1,4 @@ -// add-flags.py(RUN): --dir fs::/ +//! add-flags.py(RUN): --dir fs::/ /* * We modified musl-fts not to use fchdir() and we made FTS_NOCHDIR