aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/external/c-testsuite/scripts/make-search-index
diff options
context:
space:
mode:
Diffstat (limited to 'test/external/c-testsuite/scripts/make-search-index')
-rwxr-xr-xtest/external/c-testsuite/scripts/make-search-index62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/external/c-testsuite/scripts/make-search-index b/test/external/c-testsuite/scripts/make-search-index
new file mode 100755
index 0000000..a5658b1
--- /dev/null
+++ b/test/external/c-testsuite/scripts/make-search-index
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+set -e
+set -u
+
+if ! test -f README.md
+then
+ echo "run from the base directory." >&2
+ exit 1
+fi
+
+if test -d ./.tmsu/
+then
+ rm -r ./.tmsu/
+fi
+
+tmsu init
+
+tmsu tag -c arch-x86_64 portable \
+ needs-cpp needs-libc
+tmsu imply c89 c99
+tmsu imply c99 c11
+tmsu imply needs-libc needs-cpp
+
+
+for suite in single-exec
+do
+ for t in ./tests/"$suite"/*.c
+ do
+ tmsu tag "$t" "suite=$suite"
+
+ while read -r tagline
+ do
+ if test -z "$tagline"
+ then
+ continue
+ fi
+ tmsu tag --tags="$tagline" "$t"
+ done < "$t.tags"
+ done
+done
+
+
+# Validation
+
+q="(not c89) and (not c99) and (not c11)"
+n=$(tmsu files "$q" | wc -l)
+if test "$n" != "0"
+then
+ echo "Tests without a specified standard, aborting:"
+ tmsu files "$q"
+ exit 1
+fi
+
+q="not portable and not arch-x86_64"
+n=$(tmsu files "$q" | wc -l)
+if test "$n" != "0"
+then
+ echo "Tests without a specified arch, aborting:"
+ tmsu files "$q"
+ exit 1
+fi