citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit eb4a4d599879bc3dde9c14c23ef622feb4ab9bb0
parent 1dcc5a8c12013cb36a9dd31955ff3a1ca5dfb6c2
Author: Kyle Milz <kyle@0x30.net>
Date:   Fri, 12 Aug 2016 14:29:59 -0600

test: don't set PATH to in tree tools

Diffstat:
Mt/check_empty.t | 2+-
Mt/inst_basic_link.t | 4++--
Mt/inst_binop.t | 4++--
Mt/inst_correct.t | 4++--
Mt/inst_dowhile.t | 4++--
Mt/inst_fail.t | 21++++++++-------------
Mt/inst_for.t | 4++--
Mt/inst_if.t | 4++--
Mt/inst_link_multiple.t | 5++---
Mt/inst_log.t | 2+-
Mt/inst_nopath.t | 17++++++++---------
Mt/inst_preprocess.t | 22++++++++++------------
Mt/inst_return.t | 4++--
Mt/inst_stdout.t | 4++--
Mt/inst_switch.t | 4++--
Mt/inst_two_src.t | 4++--
Mt/inst_while.t | 4++--
Mt/rt_ver.t | 2+-
Mt/wrap_badarg.t | 3+--
Mtest/utils.sh | 3+--
20 files changed, 55 insertions(+), 66 deletions(-)

diff --git a/t/check_empty.t b/t/check_empty.t @@ -4,7 +4,7 @@ echo 1..2 . test/utils.sh setup -citrun-check > check.out +$TEST_TOOLS/citrun-check > check.out cat <<EOF > check.good Checking .done diff --git a/t/inst_basic_link.t b/t/inst_basic_link.t @@ -15,10 +15,10 @@ echo "ok 2 - source files wrote" # Check that a command as simple as this works. # -cc main.c +$TEST_TOOLS/citrun-wrap cc main.c echo "ok 3 - source compiled" -citrun-check > citrun-check.txt +$TEST_TOOLS/citrun-check > citrun-check.txt echo "ok 4 - processed citrun.log" cat <<EOF > citrun-check.txt.good diff --git a/t/inst_binop.t b/t/inst_binop.t @@ -64,8 +64,8 @@ Totals: 1 Binary operators EOF -citrun-inst -c enum.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c enum.c +$TEST_TOOLS/citrun-check > check.out diff -u enum.c.inst_good enum.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_correct.t b/t/inst_correct.t @@ -54,8 +54,8 @@ Totals: 7 Binary operators EOF -cc -o fib fib.c -citrun-check > check.out +$TEST_TOOLS/citrun-wrap cc -o fib fib.c +$TEST_TOOLS/citrun-check > check.out diff -u check.good check.out && echo "ok 2 citrun.log diff" diff --git a/t/inst_dowhile.t b/t/inst_dowhile.t @@ -46,8 +46,8 @@ Totals: 1 Binary operators EOF -citrun-inst -c while.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c while.c +$TEST_TOOLS/citrun-check > check.out diff -u while.c.inst_good while.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_fail.t b/t/inst_fail.t @@ -1,18 +1,13 @@ #!/bin/sh +echo 1..3 -echo 1..2 +. test/utils.sh +setup -tmpfile=`mktemp` -logfile=`mktemp` +echo "int main(void) { return 0; " > bad.c -echo "int main(void) { return 0; " > $tmpfile.c +$TEST_TOOLS/citrun-wrap gcc -c bad.c 2> err.out +[ $? -eq 1 ] && echo ok 2 +grep -q "error: expected" err.out && echo ok 3 -export PATH="`pwd`/src:${PATH}" -gcc -c $tmpfile.c 2> $logfile - -[ $? -eq 1 ] && echo ok 1 -grep -q "error: expected" $logfile && echo ok 2 - -rm $tmpfile.c -rm $tmpfile -rm $logfile +$TEST_TOOLS/citrun-check diff --git a/t/inst_for.t b/t/inst_for.t @@ -49,8 +49,8 @@ Totals: 2 Binary operators EOF -citrun-inst -c for.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c for.c +$TEST_TOOLS/citrun-check > check.out diff -u for.c.inst_good for.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_if.t b/t/inst_if.t @@ -61,8 +61,8 @@ Totals: 2 Binary operators EOF -citrun-inst -c if.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c if.c +$TEST_TOOLS/citrun-check > check.out diff -u if.c.inst_good if.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_link_multiple.t b/t/inst_link_multiple.t @@ -38,9 +38,8 @@ cat <<EOF > Jamfile Main program : one.c two.c three.c ; EOF -jam && echo "ok - source compiled" - -citrun-check > check.out && echo ok +$TEST_TOOLS/citrun-wrap jam && echo "ok - source compiled" +$TEST_TOOLS/citrun-check > check.out && echo ok cat <<EOF > check.good Checking ..done diff --git a/t/inst_log.t b/t/inst_log.t @@ -34,7 +34,7 @@ Main program : source_0.c ; EOF echo "ok 3 - Jamfile wrote" -jam && echo "ok 4 - source compiled" +$TEST_TOOLS/citrun-wrap jam && echo "ok 4 - source compiled" sed -e "s,^.*: ,," \ -e "s,'.*',''," \ diff --git a/t/inst_nopath.t b/t/inst_nopath.t @@ -1,18 +1,17 @@ #!/bin/sh - +# # Test that not having PATH set errors out. # -echo 1..2 -tmpfile=`mktemp` +echo 1..3 + +. test/utils.sh +setup # Save locations to tools because after unset PATH they are not available. grep=`which grep` -rm=`which rm` unset PATH -src/gcc -c nomatter.c 2> $tmpfile - -[ $? -eq 1 ] && echo ok 1 -$grep -q "PATH must be set" $tmpfile && echo ok 2 +$TEST_TOOLS/gcc -c nomatter.c 2> err.out -$rm $tmpfile +[ $? -eq 1 ] && echo ok 2 +$grep -q "PATH must be set" err.out && echo ok 3 diff --git a/t/inst_preprocess.t b/t/inst_preprocess.t @@ -1,17 +1,15 @@ #!/bin/sh +# +# Make sure preprocessor flag (-E) causes no instrumentation to be done. +# +echo 1..3 -echo 1..2 +. test/utils.sh +setup -tmpfile=`mktemp` -logfile=`mktemp` +echo "int main(void) { return 0; }" > prepro.c -echo "int main(void) { return 0; }" > $tmpfile +$TEST_TOOLS/citrun-wrap gcc -E prepro.c > combined.out 2>&1 -export PATH="`pwd`/src:${PATH}" -gcc -x c -E $tmpfile > $logfile 2>&1 - -[ $? -eq 0 ] && echo ok 1 -grep -q "int main(void) { return 0; }" $logfile && echo ok 2 - -rm $tmpfile -rm $logfile +[ $? -eq 0 ] && echo ok 2 +grep -q "int main(void) { return 0; }" combined.out && echo ok 3 diff --git a/t/inst_return.t b/t/inst_return.t @@ -52,8 +52,8 @@ Totals: 1 Binary operators EOF -citrun-inst -c return.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c return.c +$TEST_TOOLS/citrun-check > check.out diff -u return.c.inst_good return.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_stdout.t b/t/inst_stdout.t @@ -36,8 +36,8 @@ Totals: 9 Total statements EOF -cc -o hello hello.c -citrun-check > check.out +$TEST_TOOLS/citrun-wrap cc -o hello hello.c +$TEST_TOOLS/citrun-check > check.out export CITRUN_SOCKET= [ "`./hello`" = "hello, world!" ] && echo ok program prints diff --git a/t/inst_switch.t b/t/inst_switch.t @@ -57,8 +57,8 @@ Totals: 14 Total statements EOF -citrun-inst -c switch.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c switch.c +$TEST_TOOLS/citrun-check > check.out diff -u switch.c.inst_good switch.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/inst_two_src.t b/t/inst_two_src.t @@ -40,7 +40,7 @@ Totals: 6 Total statements EOF -cc -o main main.c other.c && echo "ok - source compiled" -citrun-check > check.out +$TEST_TOOLS/citrun-wrap cc -o main main.c other.c && echo "ok - source compiled" +$TEST_TOOLS/citrun-check > check.out diff -u check.good check.out && echo ok - citrun-check diff diff --git a/t/inst_while.t b/t/inst_while.t @@ -48,8 +48,8 @@ Totals: 2 Binary operators EOF -citrun-inst -c while.c -citrun-check > check.out +$TEST_TOOLS/citrun-inst -c while.c +$TEST_TOOLS/citrun-check > check.out diff -u while.c.inst_good while.c.citrun && echo "ok 2 - instrumented source diff" diff -u check.good check.out && echo "ok 3 - citrun.log diff" diff --git a/t/rt_ver.t b/t/rt_ver.t @@ -15,7 +15,7 @@ main(int argc, char *argv[]) EOF /usr/bin/cc -c main.c -/usr/bin/cc -o main main.o -pthread $CITRUN_TOOLS/libcitrun.a +/usr/bin/cc -o main main.o -pthread $TEST_TOOLS/libcitrun.a export CITRUN_SOCKET= main 2> out diff --git a/t/wrap_badarg.t b/t/wrap_badarg.t @@ -1,8 +1,7 @@ #!/bin/sh - echo 1..2 -out=`./src/citrun-wrap -v` +out=`src/citrun-wrap -v` [ $? -eq 1 ] && echo ok 1 - return code [ "$out" = "usage: citrun-wrap <build cmd>" ] && echo ok 2 - stdout diff --git a/test/utils.sh b/test/utils.sh @@ -4,7 +4,6 @@ function setup trap "rm -rf $tmpdir" EXIT echo "ok 1 - tmp dir created" - export CITRUN_TOOLS="`pwd`/src"; - export PATH="${CITRUN_TOOLS}:${PATH}" + export TEST_TOOLS="`pwd`/src"; cd $tmpdir }