commit c2b500d70917276383f32ff66b124628f8cf28e9
parent 6a94823932461e3415ba255957b153a14b7c48f9
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 18 Dec 2016 23:26:22 -0700
t: always call enter_tmpdir
Diffstat:
32 files changed, 12 insertions(+), 49 deletions(-)
diff --git a/t/check_empty.sh b/t/check_empty.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 1
-enter_tmpdir
output_good="Summary:
0 Source files used as input"
diff --git a/t/check_spaces.sh b/t/check_spaces.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 2
-enter_tmpdir
ok "are dirs with spaces in name created" mkdir dir\ a dir\ b
echo "Found source file" > dir\ a/citrun.log
diff --git a/t/e2e_ansi.sh b/t/e2e_ansi.sh
@@ -6,7 +6,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
cat <<EOF > main.c
int
diff --git a/t/e2e_basic.sh b/t/e2e_basic.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 7
-enter_tmpdir
cat <<EOF > fib.c
#include <stdio.h>
diff --git a/t/e2e_stdout.sh b/t/e2e_stdout.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > hello.c
#include <stdio.h>
diff --git a/t/inst_basic_link.sh b/t/inst_basic_link.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
cat <<EOF > main.c
int main(void) { return 0; }
diff --git a/t/inst_binop.sh b/t/inst_binop.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > enum.c
enum ASDF {
diff --git a/t/inst_dowhile.sh b/t/inst_dowhile.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > while.c
int main(int argc, char *argv[]) {
diff --git a/t/inst_fail.sh b/t/inst_fail.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
echo "int main(void) { return 0; " > bad.c
diff --git a/t/inst_for.sh b/t/inst_for.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > for.c
int main(int argc, char *argv[]) {
diff --git a/t/inst_funcdef.sh b/t/inst_funcdef.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > funcdef.c
void
diff --git a/t/inst_if.sh b/t/inst_if.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > if.c
int main(int argc, char *argv[]) {
diff --git a/t/inst_link_multiple.sh b/t/inst_link_multiple.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
cat <<EOF > one.c
void second_func();
diff --git a/t/inst_log.sh b/t/inst_log.sh
@@ -6,7 +6,6 @@
. t/utils.subr
plan 3
-enter_tmpdir
cat <<EOF > main.c
#include <stdlib.h>
diff --git a/t/inst_macro.sh b/t/inst_macro.sh
@@ -6,7 +6,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > macro.c
#define MAYBE 1023;
diff --git a/t/inst_path.sh b/t/inst_path.sh
@@ -7,10 +7,6 @@
. t/utils.subr
plan 2
-# We need the absolute path to this faux compiler because we're killing PATH
-# below.
-cc=`pwd`/src/cc
-
# Hang onto an absolute reference to 'expr' for libtap.
alias expr=`which expr`
alias rm=`which rm`
@@ -18,12 +14,9 @@ alias rm=`which rm`
unset PATH
output_good='citrun-inst: Error: PATH is not set.'
ok_program "run citrun-inst as cc with no PATH" 1 "$output_good" \
- $cc -c nomatter.c
+ $treedir/src/cc -c nomatter.c
export PATH=""
output_good="citrun-inst: Error: CITRUN_SHARE not in PATH."
ok_program "run citrun-inst as cc with empty PATH" 1 "$output_good" \
- $cc -c nomatter.c 2> /dev/null
-
-# XXX: An empty citrun.log file is left behind.
-rm citrun.log
+ $treedir/src/cc -c nomatter.c 2> /dev/null
diff --git a/t/inst_preamble.sh b/t/inst_preamble.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 3
-enter_tmpdir
touch preamble.c
ok "running citrun-inst" citrun-inst -c preamble.c
diff --git a/t/inst_preprocess.sh b/t/inst_preprocess.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 3
-enter_tmpdir
echo "int main(void) { return 0; }" > prepro.c
diff --git a/t/inst_return.sh b/t/inst_return.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > return.c
int foo() {
diff --git a/t/inst_src_ext.sh b/t/inst_src_ext.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 8
-enter_tmpdir
touch main.{c,cc,cxx,cpp,C}
ok "extension .c" citrun-wrap cc -c main.c
diff --git a/t/inst_switch.sh b/t/inst_switch.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > switch.c
int main(void) {
diff --git a/t/inst_two_src.sh b/t/inst_two_src.sh
@@ -6,7 +6,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
cat <<EOF > main.c
int main(void) {
diff --git a/t/inst_while.sh b/t/inst_while.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 5
-enter_tmpdir
cat <<EOF > while.c
int main(int argc, char *argv[]) {
diff --git a/t/lib_badver.sh b/t/lib_badver.sh
@@ -6,7 +6,6 @@
. t/utils.subr
plan 2
-enter_tmpdir
cat <<EOF > main.c
#include <stddef.h>
diff --git a/t/utils.subr b/t/utils.subr
@@ -1,6 +1,12 @@
. t/libtap.subr
export PATH="`pwd`/src:${PATH}"
+export CITRUN_PROCDIR="procdir/"
+
+treedir=`pwd`
+
+tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX` || exit 1
+cd $tmpdir
strip_preamble()
{
@@ -21,13 +27,3 @@ strip_millis()
{
ok "are milliseconds sanitized" sed -i -e "/Milliseconds spent/d" $1
}
-
-enter_tmpdir()
-{
- # Assume that a script wanting to enter a tmpdir also wants a local
- # process file directory.
- export CITRUN_PROCDIR="procdir/"
-
- tmpdir=`mktemp -d /tmp/citrun.XXXXXXXXXX` || exit 1
- cd $tmpdir
-}
diff --git a/t/wrap_badarg.sh b/t/wrap_badarg.sh
@@ -1,6 +1,9 @@
#!/bin/sh -u
+#
+# Make sure calling citrun-wrap with arguments fails.
+#
. t/utils.subr
plan 1
output_good="usage: citrun-wrap <build cmd>"
-ok_program "citrun-wrap -ASD" 1 "$output_good" src/citrun-wrap -ASD
+ok_program "citrun-wrap -ASD" 1 "$output_good" citrun-wrap -ASD
diff --git a/t/wrap_badsrc.sh b/t/wrap_badsrc.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 4
-enter_tmpdir
output_good="citrun-inst: stat: No such file or directory"
ok_program "is citrun-wrap failing" 1 "$output_good" citrun-wrap cc -o main main.c
diff --git a/t/wrap_cmake.sh b/t/wrap_cmake.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 7
-enter_tmpdir
cat <<EOF > main.c
int
diff --git a/t/wrap_jam.sh b/t/wrap_jam.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 6
-enter_tmpdir
cat <<EOF > main.c
int
diff --git a/t/wrap_make.sh b/t/wrap_make.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 6
-enter_tmpdir
cat <<EOF > main.c
int
diff --git a/t/wrap_ninja.sh b/t/wrap_ninja.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 6
-enter_tmpdir
cat <<EOF > main.c
int
diff --git a/t/wrap_parallel.sh b/t/wrap_parallel.sh
@@ -5,7 +5,6 @@
. t/utils.subr
plan 12
-enter_tmpdir
cat <<EOF > main1.c
int