commit d622393fa9cce23a46c2212a6511333a10ffa123
parent 6b2ceca46ccd001f29e0b75a2942e26c90eb7991
Author: Kyle Milz <kyle@0x30.net>
Date: Sat, 13 Aug 2016 02:53:05 -0600
test: no need to call setup anymore
Diffstat:
23 files changed, 47 insertions(+), 59 deletions(-)
diff --git a/t/check_empty.t b/t/check_empty.t
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Verify the output when 0 citrun.log files are found.
+#
echo 1..2
-
. test/utils.sh
-setup
$TEST_TOOLS/citrun-check > check.out
diff --git a/t/inst_basic_link.t b/t/inst_basic_link.t
@@ -1,8 +1,9 @@
-#!/bin/sh -e
+#!/bin/sh
+#
+# Check that the most basic of compile command lines works.
+#
echo 1..5
-
. test/utils.sh
-setup
cat <<EOF > main.c
int main(void) { return 0; }
diff --git a/t/inst_binop.t b/t/inst_binop.t
@@ -3,9 +3,7 @@
# Test that binary operators in strange cases work. Includes enums and globals.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > enum.c
enum ASDF {
diff --git a/t/inst_correct.t b/t/inst_correct.t
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Check that a simple program can execute successfully with instrumentation.
+#
echo 1..5
-
. test/utils.sh
-setup
cat <<EOF > fib.c
#include <stdlib.h>
diff --git a/t/inst_dowhile.t b/t/inst_dowhile.t
@@ -1,11 +1,9 @@
-#!/bin/sh -e
+#!/bin/sh
#
# Make sure that do while loop condition instrumentation works.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > while.c
int main(int argc, char *argv[]) {
diff --git a/t/inst_fail.t b/t/inst_fail.t
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Check that a program that won't compile natively is handled properly.
+#
echo 1..3
-
. test/utils.sh
-setup
echo "int main(void) { return 0; " > bad.c
diff --git a/t/inst_for.t b/t/inst_for.t
@@ -3,9 +3,7 @@
# Test that for loop condition instrumenting works.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > for.c
int main(int argc, char *argv[]) {
diff --git a/t/inst_funcdef.t b/t/inst_funcdef.t
@@ -1,11 +1,9 @@
-#!/bin/sh -e
+#!/bin/sh
#
# Check that really long function declarations are instrumented properly.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > funcdef.c
void
diff --git a/t/inst_if.t b/t/inst_if.t
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Check that if statement conditions are instrumented properly.
+#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > if.c
int main(int argc, char *argv[]) {
@@ -55,5 +56,4 @@ $TEST_TOOLS/citrun-inst -c if.c > citrun.log
$TEST_TOOLS/citrun-check > check.out
inst_diff if.c 2
-#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
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Check that linking more than one instrumented object file together works.
+#
echo 1..4
-
. test/utils.sh
-setup
cat <<EOF > one.c
void second_func();
diff --git a/t/inst_log.t b/t/inst_log.t
@@ -1,8 +1,10 @@
-#!/bin/sh -e
+#!/bin/sh
+#
+# Check that a raw citrun.log file is in good shape.
+# citrun-check relies on this output, and citrun-check is used quite a bit.
+#
echo 1..6
-
. test/utils.sh
-setup
cat <<EOF > source_0.c
#include <stdlib.h>
diff --git a/t/inst_macro.t b/t/inst_macro.t
@@ -4,9 +4,7 @@
# end of binary operators.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > macro.c
#define MAYBE 1023;
diff --git a/t/inst_nopath.t b/t/inst_nopath.t
@@ -3,9 +3,7 @@
# Test that not having PATH set errors out.
#
echo 1..3
-
. test/utils.sh
-setup
# Save locations to tools because after unset PATH they are not available.
grep=`which grep`
diff --git a/t/inst_preamble.t b/t/inst_preamble.t
@@ -3,9 +3,7 @@
# Test that the instrumentation preamble is what we think it is.
#
echo 1..2
-
. test/utils.sh
-setup
touch preamble.c
$TEST_TOOLS/citrun-inst -c preamble.c > citrun.log
diff --git a/t/inst_preprocess.t b/t/inst_preprocess.t
@@ -3,9 +3,7 @@
# Make sure preprocessor flag (-E) causes no instrumentation to be done.
#
echo 1..3
-
. test/utils.sh
-setup
echo "int main(void) { return 0; }" > prepro.c
diff --git a/t/inst_return.t b/t/inst_return.t
@@ -1,8 +1,9 @@
-#!/bin/sh -e
+#!/bin/sh
+#
+# Check that return statement values (if any) are instrumented correctly.
+#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > return.c
int foo() {
diff --git a/t/inst_src_ext.t b/t/inst_src_ext.t
@@ -3,9 +3,7 @@
# Check that the advertised source file extensions work.
#
echo 1..2
-
. test/utils.sh
-setup
touch main.{c,cc,cxx,cpp,C}
$TEST_TOOLS/citrun-wrap cc -c main.c
diff --git a/t/inst_stdout.t b/t/inst_stdout.t
@@ -1,8 +1,9 @@
#!/bin/sh
+#
+# Simple program that prints output.
+#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > hello.c
#include <stdio.h>
diff --git a/t/inst_switch.t b/t/inst_switch.t
@@ -3,9 +3,7 @@
# Make sure that switch statement condition instrumentation works.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > switch.c
int main(void) {
diff --git a/t/inst_two_src.t b/t/inst_two_src.t
@@ -1,8 +1,10 @@
-#!/bin/sh -e
+#!/bin/sh
+#
+# Check that two source files given on the same command line both get
+# instrumented fully.
+#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > main.c
int main(void) {
diff --git a/t/inst_while.t b/t/inst_while.t
@@ -3,9 +3,7 @@
# Make sure that while loop condition instrumentation works.
#
echo 1..3
-
. test/utils.sh
-setup
cat <<EOF > while.c
int main(int argc, char *argv[]) {
diff --git a/t/rt_ver.t b/t/rt_ver.t
@@ -1,8 +1,10 @@
#!/bin/sh
+#
+# Check that linking object files of one citrun version with libcitrun of
+# another shows a warning message.
+#
echo 1..2
-
. test/utils.sh
-setup
cat <<EOF > main.c
#include <stddef.h>
diff --git a/test/utils.sh b/test/utils.sh
@@ -1,12 +1,9 @@
-function setup
-{
- tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX`
- trap "rm -rf $tmpdir" EXIT
- echo "ok 1 - tmp dir created"
+tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX`
+trap "rm -rf $tmpdir" EXIT
+echo "ok 1 - tmp dir created"
- export TEST_TOOLS="`pwd`/src";
- cd $tmpdir
-}
+export TEST_TOOLS="`pwd`/src";
+cd $tmpdir
function inst_diff
{