blob: 3685432054d7178275de8d157287110cd8f76d02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#! /usr/bin/env bash
set -e
set -u
set -x
if ! test -f README.md
then
echo "run from the base directory." >&2
exit 1
fi
in=$1
if ! test -f $in
then
echo "$in does not exist" >&2
exit 1
fi
chosenfile=""
foundname="n"
for n in $(seq 10000)
do
paddedn=$(printf "%05d" "$n")
chosenfile="./tests/single-exec/$paddedn.c"
if test -f "$chosenfile"
then
continue
fi
foundname="y"
break
done
if test "$foundname" = "n"
then
echo "no numbers left." >&2
exit 1
fi
cat $in > "$chosenfile"
added="y"
tagfile="$chosenfile.tags"
echo "inferring tags..." 1>&2
echo "portable" > $tagfile
# Check for cstd
if gcc -pedantic --std=c89 -c -o /tmp/ctestsuite-infer.o $in
then
echo "c89" >> $tagfile
elif gcc -pedantic --std=c99 -c -o /tmp/ctestsuite-infer.o $in
then
echo "c99" >> $tagfile
elif gcc -pedantic --std=c11 -c -o /tmp/ctestsuite-infer.o $in
then
echo "c11" >> $tagfile
else
echo "unable to guess c std"
fi
if grep -q -e "#include" "$in"
then
# Since these are single file tests, the only
# thing we could include would be libc headers.
echo "needs-libc" >> $tagfile
fi
if grep -q -e "#include" -e "#define" -e "#if" -e "#ifdef" "$in"
then
echo "needs-cpp" >> $tagfile
fi
echo "$chosenfile"
|