blob: 837c8b7228b98e8e7b3dbfecd5046673554ef464 [file] [log] [blame]
Junio C Hamano29e4d362005-12-20 00:02:15 -08001#!/bin/sh
2
3test_description='racy GIT'
4
Ævar Arnfjörð Bjarmasonc1500642021-10-12 15:56:37 +02005TEST_PASSES_SANITIZE_LEAK=true
Junio C Hamano29e4d362005-12-20 00:02:15 -08006. ./test-lib.sh
7
8# This test can give false success if your machine is sufficiently
9# slow or your trial happened to happen on second boundary.
10
Junio C Hamano407c8eb2005-12-20 12:12:18 -080011for trial in 0 1 2 3 4
Junio C Hamano29e4d362005-12-20 00:02:15 -080012do
13 rm -f .git/index
14 echo frotz >infocom
Junio C Hamano407c8eb2005-12-20 12:12:18 -080015 git update-index --add infocom
Junio C Hamano29e4d362005-12-20 00:02:15 -080016 echo xyzzy >infocom
17
Elia Pinto8fc55932014-04-28 05:57:25 -070018 files=$(git diff-files -p)
Junio C Hamano29e4d362005-12-20 00:02:15 -080019 test_expect_success \
Junio C Hamano407c8eb2005-12-20 12:12:18 -080020 "Racy GIT trial #$trial part A" \
Junio C Hamano29e4d362005-12-20 00:02:15 -080021 'test "" != "$files"'
Junio C Hamano407c8eb2005-12-20 12:12:18 -080022
23 sleep 1
24 echo xyzzy >cornerstone
25 git update-index --add cornerstone
26
Elia Pinto8fc55932014-04-28 05:57:25 -070027 files=$(git diff-files -p)
Junio C Hamano407c8eb2005-12-20 12:12:18 -080028 test_expect_success \
29 "Racy GIT trial #$trial part B" \
30 'test "" != "$files"'
31
Junio C Hamano29e4d362005-12-20 00:02:15 -080032done
33
34test_done