Debian Codegraph @

tests/check_included_tables.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # Test that included tables do not have metadata
4
5 has_metadata() {
6 file=$1
7 while read -r line; do
8 if [ -z "$line" ]; then
9 :
10 elif [[ "$line" =~ ^# ]]; then
11 if [[ "$line" =~ ^#\+ ]]; then
12 return 0
13 fi
14 else
15 break
16 fi
17 done < $file
18 return 1
19 }
20
21 ret=0
22 while read -r table; do
23 if has_metadata $table; then
24 echo "Table $table has metadata and is also included somewhere" >&2
25 ret=1
26 fi
27 done <<< $(
28 for table in $(dirname $0)/../tables/*; do
29 cat "$table" | grep '^include ' | sed "s|^include *\([^ ]*\).*$|$(dirname $table)/\1|g"
30 done | sort | uniq
31 )
32 exit $ret
33
34 # TODO: Test that all tables without metadata are included at least once