sapling/tests/helper-testrepo.sh
Jun Wu fef5e81c64 test-check: do not trust system hg
Summary:
This diff removes "unset HGRCPATH" to try to run tests in a more
controlled environment. And skip the test if system HG looks broken.

Test Plan: arc unit

Reviewers: simpkins, #mercurial, stash

Reviewed By: stash

Subscribers: net-systems-diffs@fb.com, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5263484

Signature: t1:5263484:1497604378:28ec94c33ba77680c8d2325a8fa36457e0eb8c91
2017-06-16 10:57:52 -07:00

25 lines
557 B
Bash

source "$RUNTESTDIR/helpers-testrepo.sh"
# go to repo root
cd "$TESTDIR"/..
# enable lz4revlog if it's required
if grep -q 'lz4revlog' .hg/requires; then
cat >> "$HGRCPATH" <<EOF
[extensions]
lz4revlog=
EOF
fi
# sanity check whether hg actually works or not
if ! hg log -r tip -T '{author}' >/dev/null 2>"$TESTTMP/hg-err-check"; then
echo 'skipped: missing working hg'
exit 80
fi
# hg might work but print "failed to ..." - treat that as an error
if [ -s "$TESTTMP/hg-err-check" ]; then
echo 'skipped: missing working hg'
exit 80
fi