Skip to content

Commit eea4206

Browse files
author
Junio C Hamano
committed
t0000: catch trivial pilot errors.
People seem to be getting test failure from t6021 not becuase git is faulty but because they forgot to install "merge". Check this and other trivial pilot errors in the first test. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 73ab46d commit eea4206

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

t/t0000-basic.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,37 @@ IDs. When object ID computation changes, like in the previous case of
1717
swapping compression and hashing order, the person who is making the
1818
modification *should* take notice and update the test vectors here.
1919
'
20+
21+
################################################################
22+
# It appears that people are getting bitten by not installing
23+
# 'merge' (usually part of RCS package in binary distributions)
24+
# or have too old python without subprocess. Check them and error
25+
# out before running any tests. Also catch the bogosity of trying
26+
# to run tests without building while we are at it.
27+
28+
../git >/dev/null
29+
if test $? != 1
30+
then
31+
echo >&2 'You do not seem to have built git yet.'
32+
exit 1
33+
fi
34+
35+
merge >/dev/null 2>/dev/null
36+
if test $? == 127
37+
then
38+
echo >&2 'You do not seem to have "merge" installed.
39+
Please check INSTALL document.'
40+
exit 1
41+
fi
42+
2043
. ./test-lib.sh
2144

45+
"$PYTHON" -c 'import subprocess' || {
46+
echo >&2 'Your python seem to lack "subprocess" module.
47+
Please check INSTALL document.'
48+
exit 1
49+
}
50+
2251
################################################################
2352
# init-db has been done in an empty repository.
2453
# make sure it is empty.

t/test-lib.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,23 @@ export PATH GIT_EXEC_PATH
179179
PYTHON=`sed -e '1{
180180
s/^#!//
181181
q
182-
}' ../git-merge-recursive` &&
182+
}' ../git-merge-recursive` || {
183+
error "You haven't built things yet, have you?"
184+
}
183185
"$PYTHON" -c 'import subprocess' 2>/dev/null || {
184186
PYTHONPATH=$(pwd)/../compat
185187
export PYTHONPATH
186188
}
189+
test -d ../templates/blt || {
190+
error "You haven't built things yet, have you?"
191+
}
187192

188193
# Test repository
189194
test=trash
190195
rm -fr "$test"
191196
mkdir "$test"
192197
cd "$test"
193198
"$GIT_EXEC_PATH/git" init-db --template=../../templates/blt/ 2>/dev/null ||
194-
error "cannot run git init-db"
199+
error "cannot run git init-db -- have you built things yet?"
195200

196201
mv .git/hooks .git/hooks-disabled

0 commit comments

Comments
 (0)