summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-07-20 03:25:26 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2018-07-20 03:25:26 -0400
commit325c54a9a830f1f9a557e7bf4751f17d6b247c13 (patch)
tree244502935fb9cfb963109453bbb96d7ac494c992 /org.eclipse.jgit.test
parenta9b54b026d22be9a42aec4cdc0ea168da7a300dd (diff)
parent6db9371250866b76b7eb54f8bc1c69ff79c19098 (diff)
downloadjgit-325c54a9a830f1f9a557e7bf4751f17d6b247c13.tar.gz
jgit-325c54a9a830f1f9a557e7bf4751f17d6b247c13.zip
Merge "Ensure RacyGitTests don't raise false negatives"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
index 8d9ccab1bd..3542dfad2d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.lib;
import static java.lang.Long.valueOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.FileOutputStream;
@@ -157,10 +158,13 @@ public class RacyGitTests extends RepositoryTestCase {
// Remember the last modTime of index file. All modifications times of
// further modification are translated to this value so it looks that
// files have been modified in the same time slot as the index file
- modTimes.add(Long.valueOf(db.getIndexFile().lastModified()));
+ long indexMod = db.getIndexFile().lastModified();
+ modTimes.add(Long.valueOf(indexMod));
// modify one file
- addToWorkDir("a", "a2");
+ long aMod = addToWorkDir("a", "a2").lastModified();
+ assumeTrue(aMod == indexMod);
+
// now update the index the index. 'a' has to be racily clean -- because
// it's modification time is exactly the same as the previous index file
// mod time.