citrun

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

commit ad05e70ac6c01ca8defd360d7b3179a322441d78
parent b482b34275185a64226171240ad88060e31b10f6
Author: Kyle Milz <kyle@0x30.net>
Date:   Tue, 23 Aug 2016 23:53:27 -0600

test: merge CITRUN_TESTING and TEST_TOOLS env vars

Diffstat:
Msrc/process_dir.cc | 2+-
Msrc/runtime.c | 2+-
Mt/check_baddir.sh | 2+-
Mt/check_empty.sh | 2+-
Mt/inst_basic_link.sh | 4++--
Mt/inst_binop.sh | 4++--
Mt/inst_correct.sh | 4++--
Mt/inst_dowhile.sh | 4++--
Mt/inst_fail.sh | 4++--
Mt/inst_for.sh | 4++--
Mt/inst_funcdef.sh | 4++--
Mt/inst_if.sh | 4++--
Mt/inst_link_multiple.sh | 4++--
Mt/inst_log.sh | 2+-
Mt/inst_macro.sh | 4++--
Mt/inst_path.sh | 6+++---
Mt/inst_preamble.sh | 2+-
Mt/inst_preprocess.t | 2+-
Mt/inst_return.sh | 4++--
Mt/inst_src_ext.sh | 12++++++------
Mt/inst_stdout.sh | 4++--
Mt/inst_switch.sh | 4++--
Mt/inst_two_src.sh | 4++--
Mt/inst_while.sh | 4++--
Mt/rt_badver.sh | 4++--
Mt/rt_exectotals.sh | 2+-
Mt/rt_file_names.sh | 2+-
Mt/rt_header.sh | 2+-
Mt/rt_source.sh | 6+++---
Mtest/package.sh | 8++++----
Mtest/project.sh | 4++--
Mtest/utils.sh | 3+--
Mtt/bash.sh | 2+-
Mtt/git.sh | 4++--
Mtt/nmap.sh | 4++--
Mtt/nvi.sh | 4++--
Mtt/openssl.sh | 4++--
37 files changed, 70 insertions(+), 71 deletions(-)

diff --git a/src/process_dir.cc b/src/process_dir.cc @@ -7,7 +7,7 @@ ProcessDir::ProcessDir() { - if (std::getenv("CITRUN_TESTING") != NULL) + if (std::getenv("CITRUN_TOOLS") != NULL) m_procdir = "runtime/"; else m_procdir = "/tmp/citrun/"; diff --git a/src/runtime.c b/src/runtime.c @@ -131,7 +131,7 @@ create_memory_file() assert(shm_fd == 0); assert(shm_len == 0); - if (getenv("CITRUN_TESTING") != NULL) { + if (getenv("CITRUN_TOOLS") != NULL) { template = "runtime/XXXXXXXXXX"; process_dir = "runtime"; } else { diff --git a/t/check_baddir.sh b/t/check_baddir.sh @@ -4,7 +4,7 @@ echo 1..2 . test/utils.sh -$TEST_TOOLS/citrun-check some_nonexistent_dir > check.out +$CITRUN_TOOLS/citrun-check some_nonexistent_dir > check.out cat <<EOF > check.good citrun-check: some_nonexistent_dir: no such directory diff --git a/t/check_empty.sh b/t/check_empty.sh @@ -4,7 +4,7 @@ echo 1..2 . test/utils.sh -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-check > check.out cat <<EOF > check.good No log files found. diff --git a/t/inst_basic_link.sh b/t/inst_basic_link.sh @@ -9,7 +9,7 @@ int main(void) { return 0; } EOF echo "ok 2 - source files wrote" -$TEST_TOOLS/citrun-wrap cc main.c +$CITRUN_TOOLS/citrun-wrap cc main.c echo "ok 3 - source compiled" cat <<EOF > check.good @@ -25,5 +25,5 @@ Totals: 1 Return statement values 3 Total statements EOF -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-check > check.out check_diff 4 diff --git a/t/inst_binop.sh b/t/inst_binop.sh @@ -58,8 +58,8 @@ Totals: 1 Binary operators EOF -$TEST_TOOLS/citrun-inst -c enum.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c enum.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff enum.c 2 check_diff 3 diff --git a/t/inst_correct.sh b/t/inst_correct.sh @@ -44,8 +44,8 @@ Totals: 7 Binary operators EOF -$TEST_TOOLS/citrun-wrap cc -o fib fib.c -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-wrap cc -o fib fib.c +$CITRUN_TOOLS/citrun-check > check.out check_diff 2 diff --git a/t/inst_dowhile.sh b/t/inst_dowhile.sh @@ -36,8 +36,8 @@ Totals: 1 Binary operators EOF -$TEST_TOOLS/citrun-inst -c while.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c while.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff while.c 2 check_diff 3 diff --git a/t/inst_fail.sh b/t/inst_fail.sh @@ -6,7 +6,7 @@ echo 1..4 echo "int main(void) { return 0; " > bad.c -$TEST_TOOLS/citrun-wrap cc -c bad.c 2> err.out +$CITRUN_TOOLS/citrun-wrap cc -c bad.c 2> err.out [ $? -eq 1 ] && echo ok 2 grep -q "error: expected" err.out && echo ok 3 @@ -24,5 +24,5 @@ Totals: 3 Total statements EOF -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-check > check.out check_diff 4 diff --git a/t/inst_for.sh b/t/inst_for.sh @@ -35,8 +35,8 @@ Totals: 2 Binary operators EOF -$TEST_TOOLS/citrun-inst -c for.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c for.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff for.c 2 check_diff 3 diff --git a/t/inst_funcdef.sh b/t/inst_funcdef.sh @@ -37,8 +37,8 @@ Totals: 1 Total statements EOF -$TEST_TOOLS/citrun-inst -c funcdef.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c funcdef.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff funcdef.c 2 check_diff 3 diff --git a/t/inst_if.sh b/t/inst_if.sh @@ -46,8 +46,8 @@ Totals: 2 Binary operators EOF -$TEST_TOOLS/citrun-inst -c if.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c if.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff if.c 2 check_diff 3 diff --git a/t/inst_link_multiple.sh b/t/inst_link_multiple.sh @@ -32,8 +32,8 @@ cat <<EOF > Jamfile Main program : one.c two.c three.c ; EOF -$TEST_TOOLS/citrun-wrap jam && echo "ok - source compiled" -$TEST_TOOLS/citrun-check > check.out && echo ok +$CITRUN_TOOLS/citrun-wrap jam && echo "ok - source compiled" +$CITRUN_TOOLS/citrun-check > check.out && echo ok cat <<EOF > check.good Summary: diff --git a/t/inst_log.sh b/t/inst_log.sh @@ -35,7 +35,7 @@ Main program : source_0.c ; EOF echo "ok 3 - Jamfile wrote" -$TEST_TOOLS/citrun-wrap jam && echo "ok 4 - source compiled" +$CITRUN_TOOLS/citrun-wrap jam && echo "ok 4 - source compiled" sed -e "s,^.*: ,," \ -e "s,'.*',''," \ diff --git a/t/inst_macro.sh b/t/inst_macro.sh @@ -35,8 +35,8 @@ Totals: 7 Total statements EOF -$TEST_TOOLS/citrun-inst -c macro.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c macro.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff macro.c 2 check_diff 3 diff --git a/t/inst_path.sh b/t/inst_path.sh @@ -20,18 +20,18 @@ tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX` trap "$rm -rf $tmpdir" EXIT echo "ok 1 - tmp dir created" -export TEST_TOOLS="`pwd`/src"; +export CITRUN_TOOLS="`pwd`/src"; cd $tmpdir # Save locations to tools because after unset PATH they are not available. grep=`which grep` unset PATH -$TEST_TOOLS/cc -c nomatter.c +$CITRUN_TOOLS/cc -c nomatter.c [ $? -eq 1 ] && echo ok 2 export PATH="" -$TEST_TOOLS/cc -c nomatter.c 2> /dev/null +$CITRUN_TOOLS/cc -c nomatter.c 2> /dev/null [ $? -eq 1 ] && echo ok 3 $cat <<EOF > citrun.log.good diff --git a/t/inst_preamble.sh b/t/inst_preamble.sh @@ -5,7 +5,7 @@ echo 1..2 . test/utils.sh touch preamble.c -$TEST_TOOLS/citrun-inst -c preamble.c > citrun.log +$CITRUN_TOOLS/citrun-inst -c preamble.c > citrun.log cat <<EOF > preamble.c.good #ifdef __cplusplus diff --git a/t/inst_preprocess.t b/t/inst_preprocess.t @@ -7,7 +7,7 @@ echo 1..3 echo "int main(void) { return 0; }" > prepro.c -$TEST_TOOLS/citrun-wrap gcc -E prepro.c > combined.out 2>&1 +$CITRUN_TOOLS/citrun-wrap gcc -E prepro.c > combined.out 2>&1 [ $? -eq 0 ] && echo ok 2 grep -q "int main(void) { return 0; }" combined.out && echo ok 3 diff --git a/t/inst_return.sh b/t/inst_return.sh @@ -46,8 +46,8 @@ Totals: 1 Binary operators EOF -$TEST_TOOLS/citrun-inst -c return.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c return.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff return.c 2 check_diff 3 diff --git a/t/inst_src_ext.sh b/t/inst_src_ext.sh @@ -5,12 +5,12 @@ echo 1..2 . test/utils.sh touch main.{c,cc,cxx,cpp,C} -$TEST_TOOLS/citrun-wrap cc -c main.c -$TEST_TOOLS/citrun-wrap c++ -c main.cc -$TEST_TOOLS/citrun-wrap c++ -c main.cxx -$TEST_TOOLS/citrun-wrap c++ -c main.cpp +$CITRUN_TOOLS/citrun-wrap cc -c main.c +$CITRUN_TOOLS/citrun-wrap c++ -c main.cc +$CITRUN_TOOLS/citrun-wrap c++ -c main.cxx +$CITRUN_TOOLS/citrun-wrap c++ -c main.cpp # This one isn't supported -$TEST_TOOLS/citrun-wrap cc -c main.C +$CITRUN_TOOLS/citrun-wrap cc -c main.C cat <<EOF > check.good Summary: @@ -22,5 +22,5 @@ Totals: 4 Lines of source code EOF -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-check > check.out check_diff 2 diff --git a/t/inst_stdout.sh b/t/inst_stdout.sh @@ -28,8 +28,8 @@ Totals: 9 Total statements EOF -$TEST_TOOLS/citrun-wrap cc -o hello hello.c -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-wrap cc -o hello hello.c +$CITRUN_TOOLS/citrun-check > check.out [ "`./hello`" = "hello, world!" ] && echo ok program prints diff --git a/t/inst_switch.sh b/t/inst_switch.sh @@ -47,8 +47,8 @@ Totals: 14 Total statements EOF -$TEST_TOOLS/citrun-inst -c switch.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c switch.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff switch.c 2 check_diff 3 diff --git a/t/inst_two_src.sh b/t/inst_two_src.sh @@ -31,7 +31,7 @@ Totals: 6 Total statements EOF -$TEST_TOOLS/citrun-wrap cc -o main main.c other.c && echo "ok - source compiled" -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-wrap cc -o main main.c other.c && echo "ok - source compiled" +$CITRUN_TOOLS/citrun-check > check.out check_diff 3 diff --git a/t/inst_while.sh b/t/inst_while.sh @@ -38,8 +38,8 @@ Totals: 2 Binary operators EOF -$TEST_TOOLS/citrun-inst -c while.c > citrun.log -$TEST_TOOLS/citrun-check > check.out +$CITRUN_TOOLS/citrun-inst -c while.c > citrun.log +$CITRUN_TOOLS/citrun-check > check.out inst_diff while.c 2 check_diff 3 diff --git a/t/rt_badver.sh b/t/rt_badver.sh @@ -15,8 +15,8 @@ main(int argc, char *argv[]) } EOF -/usr/bin/cc -include $TEST_TOOLS/runtime.h -c main.c -/usr/bin/cc -o main main.o $TEST_TOOLS/libcitrun.a +/usr/bin/cc -include $CITRUN_TOOLS/runtime.h -c main.c +/usr/bin/cc -o main main.o $CITRUN_TOOLS/libcitrun.a ./main 2> out [ $? -eq 1 ] && echo ok 2 - runtime errored program out diff --git a/t/rt_exectotals.sh b/t/rt_exectotals.sh @@ -7,7 +7,7 @@ echo 1..3 ./program 45 & pid=$! -$TEST_TOOLS/citrun-dump -t > execs.out +$CITRUN_TOOLS/citrun-dump -t > execs.out [ `grep -c "." execs.out` -eq 60 ] && echo ok 2 - citrun-dump -t output enough lines sort -n execs.out > execs.sorted diff --git a/t/rt_file_names.sh b/t/rt_file_names.sh @@ -6,7 +6,7 @@ echo 1..2 ./program 1 -$TEST_TOOLS/citrun-dump -f > filelist.out +$CITRUN_TOOLS/citrun-dump -f > filelist.out cat <<EOF > filelist.good one.c 26 diff --git a/t/rt_header.sh b/t/rt_header.sh @@ -16,5 +16,5 @@ Found dead program with PID '%PID%' Working directory: '%CWD%' EOF -$TEST_TOOLS/citrun-dump > dump.out +$CITRUN_TOOLS/citrun-dump > dump.out test_diff 2 "citrun-dump diff" dump.good dump.out diff --git a/t/rt_source.sh b/t/rt_source.sh @@ -7,9 +7,9 @@ echo 1..4 ./program 3 -$TEST_TOOLS/citrun-dump -s one.c > one.c.runtime -$TEST_TOOLS/citrun-dump -s two.c > two.c.runtime -$TEST_TOOLS/citrun-dump -s three.c > three.c.runtime +$CITRUN_TOOLS/citrun-dump -s one.c > one.c.runtime +$CITRUN_TOOLS/citrun-dump -s two.c > two.c.runtime +$CITRUN_TOOLS/citrun-dump -s three.c > three.c.runtime # Bug in parsing source line by line in c++ echo >> one.c diff --git a/test/package.sh b/test/package.sh @@ -1,4 +1,4 @@ -# exports TEST_TOOLS and puts us in a temporary directory. +# exports CITRUN_TOOLS and puts us in a temporary directory. . test/utils.sh # $1 is passed in by the source ('.') statements in the tests. @@ -21,18 +21,18 @@ function pkg_check_deps function pkg_build { - make -C $TEST_PORT PORTPATH="$TEST_TOOLS:\${WRKDIR}/bin:$PATH" build + make -C $TEST_PORT PORTPATH="$CITRUN_TOOLS:\${WRKDIR}/bin:$PATH" build test_ret ${1} "instrumented build exit code" $? } function pkg_test { - #make -C $TEST_PORT PORTPATH="$TEST_TOOLS:\${WRKDIR}/bin:$PATH" test || true + #make -C $TEST_PORT PORTPATH="$CITRUN_TOOLS:\${WRKDIR}/bin:$PATH" test || true } function pkg_check { - $TEST_TOOLS/citrun-check $TEST_WRKDIST > check.out + $CITRUN_TOOLS/citrun-check $TEST_WRKDIST > check.out check_diff ${1} } diff --git a/test/project.sh b/test/project.sh @@ -1,4 +1,4 @@ -# exports TEST_TOOLS and puts us in a temporary directory. +# exports CITRUN_TOOLS and puts us in a temporary directory. . test/utils.sh cat <<EOF > one.c @@ -57,4 +57,4 @@ cat <<EOF > Jamfile Main program : one.c two.c three.c ; EOF -$TEST_TOOLS/citrun-wrap jam +$CITRUN_TOOLS/citrun-wrap jam diff --git a/test/utils.sh b/test/utils.sh @@ -7,8 +7,7 @@ set -o nounset tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX` trap "rm -rf $tmpdir" EXIT -export TEST_TOOLS="`pwd`/src" -export CITRUN_TESTING=1 +export CITRUN_TOOLS="`pwd`/src" cd $tmpdir echo "ok 1 - tmp dir created" diff --git a/tt/bash.sh b/tt/bash.sh @@ -40,4 +40,4 @@ pkg_check 5 #echo ok 5 - bash started # #sleep 1 -#$TEST_TOOLS/citrun-dump +#$CITRUN_TOOLS/citrun-dump diff --git a/tt/git.sh b/tt/git.sh @@ -319,8 +319,8 @@ xdiff/xutils.c 496 zlib.c 274 EOF -$TEST_TOOLS/citrun-dump -$TEST_TOOLS/citrun-dump -f > filelist.out +$CITRUN_TOOLS/citrun-dump +$CITRUN_TOOLS/citrun-dump -f > filelist.out filelist_diff 7 kill $pid diff --git a/tt/nmap.sh b/tt/nmap.sh @@ -140,8 +140,8 @@ $TEST_WRKDIST/nmap krwm.net & pid=$! sleep 2 -$TEST_TOOLS/citrun-dump -$TEST_TOOLS/citrun-dump -f > filelist.out +$CITRUN_TOOLS/citrun-dump +$CITRUN_TOOLS/citrun-dump -f > filelist.out filelist_diff 6 kill $pid diff --git a/tt/nvi.sh b/tt/nvi.sh @@ -42,12 +42,12 @@ Found dead program with PID '' Working directory: '' EOF -$TEST_TOOLS/citrun-dump | sed -e "s,'.*',''," > dump.out +$CITRUN_TOOLS/citrun-dump | sed -e "s,'.*',''," > dump.out test_diff 6 "citrun-dump output" dump.good dump.out # Compiler file names are full paths so this is useless atm. #cat <<EOF > filelist.good #EOF -#$TEST_TOOLS/citrun-dump -f > filelist.out +#$CITRUN_TOOLS/citrun-dump -f > filelist.out pkg_clean 7 diff --git a/tt/openssl.sh b/tt/openssl.sh @@ -41,7 +41,7 @@ pid=$! sleep 3 -$TEST_TOOLS/citrun-dump +$CITRUN_TOOLS/citrun-dump test_total_execs 6 @@ -730,7 +730,7 @@ x_x509a.c 197 xcbc_enc.c 217 xts128.c 205 EOF -$TEST_TOOLS/citrun-dump -f > filelist.out +$CITRUN_TOOLS/citrun-dump -f > filelist.out filelist_diff 7 kill -INT $pid