diff options
author | Simeon Andreev <simeon.danailov.andreev@gmail.com> | 2022-06-17 12:19:50 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2022-06-17 14:39:48 +0200 |
commit | 0c32889ebcc61845765514fee56d6641bd91b542 (patch) | |
tree | b93b38e173544dbadc411386c5a1128ce9f01988 | |
parent | 2adbd743879762389b41713d527066fab0151163 (diff) | |
download | jgit-0c32889ebcc61845765514fee56d6641bd91b542.tar.gz jgit-0c32889ebcc61845765514fee56d6641bd91b542.zip |
Run tests that checks araxis output only on Linux
Bug: 580189
Change-Id: Ieb14f5cf061fcb468b602c7f27e27b672e3b09e2
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
4 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java index 2b50d45253..f0908cebc4 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java @@ -81,6 +81,8 @@ public class DiffToolTest extends ToolTestCase { @Test(expected = Die.class) public void testEmptyToolName() throws Exception { + assumeLinuxPlatform(); + String emptyToolName = ""; StoredConfig config = db.getConfig(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java index 1236dd30d3..54c4f26099 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java @@ -79,6 +79,8 @@ public class MergeToolTest extends ToolTestCase { @Test public void testEmptyToolName() throws Exception { + assumeLinuxPlatform(); + String emptyToolName = ""; StoredConfig config = db.getConfig(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java index a3c41f0fed..5f6b38c25d 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ToolTestCase.java @@ -32,6 +32,8 @@ import org.eclipse.jgit.pgm.opt.SubcommandHandler; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.treewalk.FileTreeIterator; import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.util.SystemReader; +import org.junit.Assume; import org.junit.Before; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; @@ -240,4 +242,9 @@ public abstract class ToolTestCase extends CLIRepositoryTestCase { matches); } } + + protected static void assumeLinuxPlatform() { + Assume.assumeTrue("This test can run only in Linux tests", + SystemReader.getInstance().isLinux()); + } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java index 16e2577911..5ced0713e0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -63,6 +63,8 @@ public abstract class SystemReader { private static volatile Boolean isWindows; + private static volatile Boolean isLinux; + static { SystemReader r = new Default(); r.init(); @@ -185,6 +187,7 @@ public abstract class SystemReader { public static void setInstance(SystemReader newReader) { isMacOS = null; isWindows = null; + isLinux = null; if (newReader == null) INSTANCE = DEFAULT; else { @@ -543,6 +546,20 @@ public abstract class SystemReader { return isMacOS.booleanValue(); } + /** + * Whether we are running on Linux. + * + * @return true if we are running on Linux. + * @since 6.3 + */ + public boolean isLinux() { + if (isLinux == null) { + String osname = getOsName(); + isLinux = Boolean.valueOf(osname.toLowerCase().startsWith("linux")); //$NON-NLS-1$ + } + return isLinux.booleanValue(); + } + private String getOsName() { return AccessController.doPrivileged( (PrivilegedAction<String>) () -> getProperty("os.name") //$NON-NLS-1$ |