cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit fd836460ae1f1879bd27cff2e4a60d29ab24de43
parent 494420db4966e36d8550a86f4252ab4a888369c1
Author: Michael Forney <mforney@mforney.org>
Date:   Mon,  9 Mar 2020 00:37:34 -0700

runtests: Add support for preprocessor tests

Diffstat:
Mruntests | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/runtests b/runtests @@ -1,14 +1,28 @@ #!/bin/sh +: ${CCQBE:=./cproc-qbe} + if [ $# = 0 ] ; then set -- test/*.c fi numfail=0 -out=$(mktemp) -trap 'rm "$out"' EXIT +got=$(mktemp) +trap 'rm "$got"' EXIT + for test ; do - if ${CCQBE:=./cproc-qbe} -o $out $test && diff -Nu "${test%.c}.qbe" "$out" ; then + name=${test%.c} + if [ -f "$name.qbe" ] ; then + want=$name.qbe + set -- $CCQBE -o "$got" "$test" + elif [ -f "$name.pp" ] ; then + want=$name.pp + set -- $CCQBE -E -o "$got" "$test" + else + echo "invalid test '$test'" >&2 + set -- false + fi + if "$@" && diff -Nu "$want" "$got" ; then result="PASS" else result="FAIL"