summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-07-17 16:31:42 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-06 14:54:39 +0200
commitd45219baacab711abf3c4112146ca0522d984be2 (patch)
tree2567ded44b9be10eee5f51a30e2f6094f0d7cbc7 /org.eclipse.jgit.test
parent5911521ba6d47868871c4b5f240c71af827b7aa2 (diff)
downloadjgit-d45219baacab711abf3c4112146ca0522d984be2.tar.gz
jgit-d45219baacab711abf3c4112146ca0522d984be2.zip
Persist minimal racy threshold and allow manual configuration
To enable persisting the minimal racy threshold per FileStore add a new config option to the user global git configuration: - Config section is "filesystem" - Config subsection is concatenation of - Java vendor (system property "java.vendor") - Java version (system property "java.version") - FileStore's name, on Windows we use the attribute volume:vsn instead since the name is not necessarily unique. - separated by '|' e.g. "AdoptOpenJDK|1.8.0_212-b03|/dev/disk1s1" The same prefix is used as for filesystem timestamp resolution, so both values are stored in the same config section - The config key for minmal racy threshold is "minRacyThreshold" as a time value, supported time units are those supported by DefaultTypedConfigGetter#getTimeUnit - measure for 3 seconds to limit runtime which depends on hardware, OS and Java version being used If the minimal racy threshold is configured for a given FileStore the configured value is used instead of measuring it. When the minimal racy threshold was measured it is persisted in the user global git configuration. Rename FileStoreAttributeCache to FileStoreAttributes since this class is now declared public in order to enable exposing all attributes in one object. Example: [filesystem "AdoptOpenJDK|11.0.3|/dev/disk1s1"] timestampResolution = 7000 nanoseconds minRacyThreshold = 3440 microseconds Change-Id: I22195e488453aae8d011b0a8e3276fe3d99deaea Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Also-By: Marc Strapetz <marc.strapetz@syntevo.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSTest.java2
3 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
index 012407f715..40af9e2a00 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
@@ -62,7 +62,7 @@ import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.util.FS;
-import org.eclipse.jgit.util.FS.FileStoreAttributeCache;
+import org.eclipse.jgit.util.FS.FileStoreAttributes;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.Stats;
import org.eclipse.jgit.util.SystemReader;
@@ -79,7 +79,7 @@ public class FileSnapshotTest {
private Path trash;
- private FileStoreAttributeCache fsAttrCache;
+ private FileStoreAttributes fsAttrCache;
@Before
public void setUp() throws Exception {
@@ -87,7 +87,7 @@ public class FileSnapshotTest {
// measure timer resolution before the test to avoid time critical tests
// are affected by time needed for measurement
fsAttrCache = FS
- .getFileStoreAttributeCache(trash.getParent());
+ .getFileStoreAttributes(trash.getParent());
}
@Before
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
index 77f5febc17..1adddb5ea5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
@@ -83,7 +83,7 @@ public class FileBasedConfigTest {
@Before
public void setUp() throws Exception {
trash = Files.createTempDirectory("tmp_");
- FS.getFileStoreAttributeCache(trash.getParent());
+ FS.getFileStoreAttributes(trash.getParent());
}
@After
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSTest.java
index 63e295ec83..2054e1efa8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FSTest.java
@@ -203,7 +203,7 @@ public class FSTest {
.ofPattern("uuuu-MMM-dd HH:mm:ss.nnnnnnnnn", Locale.ENGLISH)
.withZone(ZoneId.systemDefault());
Path dir = Files.createTempDirectory("probe-filesystem");
- Duration resolution = FS.getFileStoreAttributeCache(dir)
+ Duration resolution = FS.getFileStoreAttributes(dir)
.getFsTimestampResolution();
long resolutionNs = resolution.toNanos();
assertTrue(resolutionNs > 0);