Skip to content

Commit 8e533b7

Browse files
committed
Change chain.sh to allow for custom goto binary building
This changes the chain.sh (and adds a READFME.md to explain) so that a test can be written that uses its own script to build the goto binary.
1 parent 35afe57 commit 8e533b7

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This subdirectory is for tests where goto-cc is used to produce
2+
a goto binary that is then passed to goto-analyzer. There is also
3+
the option to have a custom script to produce the goto binary
4+
should this require special handling or multiple steps. This
5+
script is run if the root name of the test file has a script with
6+
the same filename. For example, if the desc file specifies
7+
test.c as the test file then the chain.sh script will check for
8+
the existence of test.sh and if test.sh exists then it will be used
9+
to build the goto binary (assumed to be test.gb).

regression/goto-cc-goto-analyzer/chain.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ is_windows=$3
99
options=${*:4:$#-4}
1010
name=${*:$#}
1111
name=${name%.c}
12+
buildgoto=${name}.sh
1213

13-
if [[ "${is_windows}" == "true" ]]; then
14-
"${goto_cc}" "${name}.c"
15-
mv "${name}.exe" "${name}.gb"
14+
if test -f ${buildgoto}; then
15+
./${buildgoto} ${goto_cc} ${is_windows}
1616
else
17-
"${goto_cc}" "${name}.c" -o "${name}.gb"
17+
if [[ "${is_windows}" == "true" ]]; then
18+
"${goto_cc}" "${name}.c"
19+
mv "${name}.exe" "${name}.gb"
20+
else
21+
"${goto_cc}" "${name}.c" -o "${name}.gb"
22+
fi
1823
fi
1924

2025
"${goto_analyzer}" "${name}.gb" ${options}

0 commit comments

Comments
 (0)