diff --git a/test/cli.go b/test/cli.go index df5a686..3444579 100644 --- a/test/cli.go +++ b/test/cli.go @@ -13,6 +13,9 @@ func main() { failed := 0 for _, arg := range flag.Args() { cmd := exec.Command("bash", arg) + if os.Getenv("TMPDIR") != "" { + cmd.Env = append(cmd.Env, "TMPDIR="+os.Getenv("TMPDIR")) + } cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout if err := cmd.Run(); err != nil { diff --git a/test/cli/0001.sh b/test/cli/0001.sh index 47162fe..a1b6cfa 100644 --- a/test/cli/0001.sh +++ b/test/cli/0001.sh @@ -4,7 +4,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${t}" # This test is for basic running check of manifest, and check against tar and file system diff --git a/test/cli/0002.sh b/test/cli/0002.sh index c474103..56d139e 100644 --- a/test/cli/0002.sh +++ b/test/cli/0002.sh @@ -4,7 +4,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${t}" # This test is for basic running check of manifest, and check against tar and file system diff --git a/test/cli/0003.sh b/test/cli/0003.sh index a7e45be..3c992e2 100644 --- a/test/cli/0003.sh +++ b/test/cli/0003.sh @@ -4,7 +4,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) setfattr -n user.has.xattrs -v "true" "${t}" || exit 0 diff --git a/test/cli/0004.sh b/test/cli/0004.sh index 1488ef0..a86bd65 100644 --- a/test/cli/0004.sh +++ b/test/cli/0004.sh @@ -5,7 +5,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${t}" diff --git a/test/cli/0005.sh b/test/cli/0005.sh index a4732d6..c0680c4 100644 --- a/test/cli/0005.sh +++ b/test/cli/0005.sh @@ -4,7 +4,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${t}" diff --git a/test/cli/0006.sh b/test/cli/0006.sh index 70b0770..cd33f88 100644 --- a/test/cli/0006.sh +++ b/test/cli/0006.sh @@ -4,7 +4,7 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -t=$(mktemp -d /tmp/go-mtree.XXXXXX) +t=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${t}" # This test is for basic running check of manifest, and check against tar and file system diff --git a/test/cli/0007.sh b/test/cli/0007.sh index 3b21db1..ada1086 100644 --- a/test/cli/0007.sh +++ b/test/cli/0007.sh @@ -4,8 +4,8 @@ set -e name=$(basename $0) root="$(dirname $(dirname $(dirname $0)))" gomtree=$(readlink -f ${root}/gomtree) -left=$(mktemp -d /tmp/go-mtree.XXXXXX) -right=$(mktemp -d /tmp/go-mtree.XXXXXX) +left=$(mktemp -t -d go-mtree.XXXXXX) +right=$(mktemp -t -d go-mtree.XXXXXX) echo "[${name}] Running in ${left} and ${right}"