From aebd8ac9a743d1cfae7972527e86adba183b846c Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 24 Jun 2008 23:01:25 +0200 Subject: [PATCH] Bail out when the testrepo couldn't be set up This prevents any changes from being made to the current repository instead of the test repo. --- src/t/t8100-stats.sh | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/t/t8100-stats.sh b/src/t/t8100-stats.sh index b982851..5f21c4e 100755 --- a/src/t/t8100-stats.sh +++ b/src/t/t8100-stats.sh @@ -17,22 +17,40 @@ ORIG_PATH=$PWD ########### -test_expect_success pre-clean ' - rm -fr "/tmp/testrepo" || { - trap - exit - echo >&5 "FATAL: Cannot clean the fresh repo" - exit 1 - } +test_expect_success 'pre-clean' ' + rm -fr "/tmp/testrepo" || { + trap - exit + echo >&5 "FATAL: Cannot clean the fresh repo" + exit 1 + } ' -test_expect_success setup ' - ../scripts/setupRepo.py test - cd /tmp/testrepo - test_must_fail stats.py +test_expect_success 'setup' ' + ../scripts/setupRepo.py test && \ + cd "/tmp/testrepo" || { + trap - exit + echo >&5 "FATAL: Cannot cd into fresh repo" + exit 1 + } ' +test_expect_success 'Test that stats.py is reachable' ' + stats.py -v || { + trap - exit + echo >&5 "FATAL: stats.py not reachable" + exit 1 + } +' + +echo "f1fdf284733011b1172b4517b4526879059bb414" > expected + test_expect_success 'Test that the expected tree was created by setupRepo' ' - test `git rev-parse HEAD` = "38aa44905fb99a661bfb0b675557f5aaf4934454" + git rev-parse HEAD > actual + test_cmp expected actual || { + trap - exit + echo >&5 "FATAL: Head revision does not match" + exit 1 + } ' -- 2.11.4.GIT