allow regress test data to be stored in locations other than /tmp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
diff --git a/README b/README
index 6fbe310..6f504d1 100644
--- a/README
+++ b/README
@@ -39,6 +39,14 @@ To test with packed repositories, run:
$ make regress GOT_TEST_PACK=1
+Because got unveils the /tmp directory by default using the /tmp directory
+for test data can hide bugs. However, /tmp remains the default because
+there is no better alternative that works out of the box. In order to
+store test data in a directory other than /tmp, such as ~/got-test, run:
+
+ $ mkdir ~/got-test
+ $ make regress GOT_TEST_ROOT=~/got-test
+
Man page files in the Got source tree can be viewed with 'man -l':
$ man -l got/got.1
diff --git a/regress/cmdline/Makefile b/regress/cmdline/Makefile
index 81d463f..081593c 100644
--- a/regress/cmdline/Makefile
+++ b/regress/cmdline/Makefile
@@ -3,79 +3,81 @@ REGRESS_TARGETS=checkout update status log add rm diff blame branch tag \
integrate stage unstage cat clone fetch tree
NOOBJ=Yes
+GOT_TEST_ROOT=/tmp
+
checkout:
- ./checkout.sh -q
+ ./checkout.sh -q -r $(GOT_TEST_ROOT)
update:
- ./update.sh -q
+ ./update.sh -q -r $(GOT_TEST_ROOT)
status:
- ./status.sh -q
+ ./status.sh -q -r $(GOT_TEST_ROOT)
log:
- ./log.sh -q
+ ./log.sh -q -r $(GOT_TEST_ROOT)
add:
- ./add.sh -q
+ ./add.sh -q -r $(GOT_TEST_ROOT)
rm:
- ./rm.sh -q
+ ./rm.sh -q -r $(GOT_TEST_ROOT)
diff:
- ./diff.sh -q
+ ./diff.sh -q -r $(GOT_TEST_ROOT)
blame:
- ./blame.sh -q
+ ./blame.sh -q -r $(GOT_TEST_ROOT)
branch:
- ./branch.sh -q
+ ./branch.sh -q -r $(GOT_TEST_ROOT)
tag:
- ./tag.sh -q
+ ./tag.sh -q -r $(GOT_TEST_ROOT)
ref:
- ./ref.sh -q
+ ./ref.sh -q -r $(GOT_TEST_ROOT)
commit:
- ./commit.sh -q
+ ./commit.sh -q -r $(GOT_TEST_ROOT)
revert:
- ./revert.sh -q
+ ./revert.sh -q -r $(GOT_TEST_ROOT)
cherrypick:
- ./cherrypick.sh -q
+ ./cherrypick.sh -q -r $(GOT_TEST_ROOT)
backout:
- ./backout.sh -q
+ ./backout.sh -q -r $(GOT_TEST_ROOT)
rebase:
- ./rebase.sh -q
+ ./rebase.sh -q -r $(GOT_TEST_ROOT)
import:
- ./import.sh -q
+ ./import.sh -q -r $(GOT_TEST_ROOT)
histedit:
- ./histedit.sh -q
+ ./histedit.sh -q -r $(GOT_TEST_ROOT)
integrate:
- ./integrate.sh -q
+ ./integrate.sh -q -r $(GOT_TEST_ROOT)
stage:
- ./stage.sh -q
+ ./stage.sh -q -r $(GOT_TEST_ROOT)
unstage:
- ./unstage.sh -q
+ ./unstage.sh -q -r $(GOT_TEST_ROOT)
cat:
- ./cat.sh -q
+ ./cat.sh -q -r $(GOT_TEST_ROOT)
clone:
- ./clone.sh -q
+ ./clone.sh -q -r $(GOT_TEST_ROOT)
fetch:
- ./fetch.sh -q
+ ./fetch.sh -q -r $(GOT_TEST_ROOT)
tree:
- ./tree.sh -q
+ ./tree.sh -q -r $(GOT_TEST_ROOT)
.include <bsd.regress.mk>
diff --git a/regress/cmdline/common.sh b/regress/cmdline/common.sh
index aa03589..d022c28 100644
--- a/regress/cmdline/common.sh
+++ b/regress/cmdline/common.sh
@@ -21,6 +21,7 @@ export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
export GOT_AUTHOR="$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"
export GOT_AUTHOR_8="flan_hac"
export GOT_LOG_DEFAULT_LIMIT=0
+export GOT_TEST_ROOT="/tmp"
export MALLOC_OPTIONS=S
@@ -168,7 +169,7 @@ test_init()
echo "No test name provided" >&2
return 1
fi
- local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
+ local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
mkdir $testroot/repo
git_init $testroot/repo
if [ -z "$no_tree" ]; then
@@ -199,10 +200,11 @@ test_cleanup()
test_parseargs()
{
- args=`getopt q $*`
+ args=`getopt qr: $*`
if [ $? -ne 0 ]; then
echo "Supported options:"
echo " -q: quiet mode"
+ echo " -r PATH: use PATH as test data root directory"
exit 2
fi
set -- $args
@@ -211,6 +213,8 @@ test_parseargs()
in
-q)
export GOT_TEST_QUIET=1; shift;;
+ -r)
+ export GOT_TEST_ROOT="$2"; shift; shift;;
--)
shift; break;;
esac
diff --git a/regress/cmdline/import.sh b/regress/cmdline/import.sh
index 6d8e522..8678e99 100755
--- a/regress/cmdline/import.sh
+++ b/regress/cmdline/import.sh
@@ -18,7 +18,7 @@
test_import_basic() {
local testname=import_basic
- local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
+ local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
got init $testroot/repo
@@ -170,7 +170,7 @@ test_import_requires_new_branch() {
test_import_ignores() {
local testname=import_ignores
- local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
+ local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
got init $testroot/repo
@@ -200,7 +200,7 @@ test_import_ignores() {
test_import_empty_dir() {
local testname=import_empty_dir
- local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
+ local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
got init $testroot/repo
@@ -243,7 +243,7 @@ test_import_empty_dir() {
test_import_symlink() {
local testname=import_symlink
- local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
+ local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`
got init $testroot/repo