Skip to contentSkip to conversation

fix flaky untracked-cache test

PATCH In review David Turner 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix flaky untracked-cache test

Dirty the test worktree's root directory, as the test expects.

When testing the untracked-cache, we previously assumed that checking out master would be sufficient to mark the mtime of the worktree's root directory as racily-dirty. But sometimes, the checkout would happen at 12345.999 seconds and the status at 12346.001 seconds, meaning that the worktree's root directory would not be racily-dirty. And since it was not truly dirty, occasionally the test would fail. By making the root truly dirty, the test will always succeed.

Tested by running a few hundred times.

---
 t/t7063-status-untracked-cache.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
t/t7063-status-untracked-cache.sh +3 -1
index 37a24c1..0e8d0d4 100755
@@ -412,7 +412,9 @@ test_expect_success 'create/modify files, some of which are gitignored' '
 	echo two bis >done/two &&
 	echo three >done/three && # three is gitignored
 	echo four >done/four && # four is gitignored at a higher level
-	echo five >done/five # five is not gitignored
+	echo five >done/five && # five is not gitignored
+	echo test >base && #we need to ensure that the root dir is touched
+	rm base
 '
 
 test_expect_success 'test sparse status with untracked cache' '
Signature · 1 line
2.4.2.644.g97b850b-twtrsrc
#1 lore raw

t/t7063-status-untracked-cache.sh test_expect_success 'create/modify files, some of which are gitignored' ' · line 418

Quoted 3 lines · David Turner
t/t7063-status-untracked-cache.sh +2 -0
+	echo test >base && #we need to ensure that the root dir is touched
+	rm base
 '

Thanks for working on this, (I can run the test as soon as I have access to a Mac with SSD) Minor remark, the echo test can be removed (and may be the comment ?)

Quoted 3 lines
t/t7063-status-untracked-cache.sh +2 -0
+	>base &&
+	rm base
 '
#2 lore raw
Quoted 6 lines · Torsten Bögershausen

t/t7063-status-untracked-cache.sh test_expect_success 'create/modify files, some of which are gitignored' ' · line 418

Quoted 3 lines · David Turner
t/t7063-status-untracked-cache.sh +2 -0
+	echo test >base && #we need to ensure that the root dir is touched
+	rm base
 '

Thanks for working on this, (I can run the test as soon as I have access to a Mac with SSD)

I don't think this depends on a Mac (I can repro on my Thinkpad running Ubuntu).

Quoted 1 line

Minor remark, the echo test can be removed (and may be the comment ?)

All the other lines in this test have echo, so I would rather be consistent.

Quoted 3 lines
Quoted 3 lines
t/t7063-status-untracked-cache.sh +2 -0
+	>base &&
+	rm base
 '
#3 lore raw
In reply to David Turner

Looks good to me, Ack.

Test run with 74301d6 + my TravisCI patch:
https://travis-ci.org/larsxschneider/git/builds/86702932
... on Linux it failed in 1/2 cases after 53min
... on OSX it failed in 2/2 cases after 6min

Test run with 74301d6 + my TravisCI patch + David's t7063 patch:
https://travis-ci.org/larsxschneider/git/builds/86707133
.. on Linux it failed in 0/2 cases after 77min
...on OSX it failed in 0/2 cases after 48min (no error, CI system timed out, click on the builds to see detailed log output)

Cheers,
Lars

Quoted 35 lines · David Turner

Dirty the test worktree's root directory, as the test expects.

When testing the untracked-cache, we previously assumed that checking out master would be sufficient to mark the mtime of the worktree's root directory as racily-dirty. But sometimes, the checkout would happen at 12345.999 seconds and the status at 12346.001 seconds, meaning that the worktree's root directory would not be racily-dirty. And since it was not truly dirty, occasionally the test would fail. By making the root truly dirty, the test will always succeed.

Tested by running a few hundred times.

---
t/t7063-status-untracked-cache.sh | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
t/t7063-status-untracked-cache.sh +3 -1
index 37a24c1..0e8d0d4 100755
@@ -412,7 +412,9 @@ test_expect_success 'create/modify files, some of which are gitignored' '
 	echo two bis >done/two &&
 	echo three >done/three && # three is gitignored
 	echo four >done/four && # four is gitignored at a higher level
-	echo five >done/five # five is not gitignored
+	echo five >done/five && # five is not gitignored
+	echo test >base && #we need to ensure that the root dir is touched
+	rm base

'

test_expect_success 'test sparse status with untracked cache' '

Signature · 1 line
2.4.2.644.g97b850b-twtrsrc
#4 lore raw
In reply to David Turner
Quoted 9 lines · David Turner

Dirty the test worktree's root directory, as the test expects.

When testing the untracked-cache, we previously assumed that checking out master would be sufficient to mark the mtime of the worktree's root directory as racily-dirty. But sometimes, the checkout would happen at 12345.999 seconds and the status at 12346.001 seconds, meaning that the worktree's root directory would not be racily-dirty. And since it was not truly dirty, occasionally the test would fail. By making the root truly dirty, the test will always succeed.

I'm sorry for my deadly silence lately. I hope it will end in a few weeks. From a quick glance, the description and the change look ok (but don't weigh too much on my opinion).

Back to my silence..

Signature · 1 line
Duy