diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-08-31 22:02:21 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2017-08-31 22:02:21 -0400 |
commit | 8abb47b2967d914ebde30fbc2da6e57f88aeb726 (patch) | |
tree | b7160aea3df6c30628edd7d2f66ab18c8fc25045 | |
parent | 37ea57701b260dc2eb8b859ab3def6dd49dd4f3d (diff) | |
parent | c91c20f36f2df03b792cd610b8ec54045b014159 (diff) | |
download | jgit-8abb47b2967d914ebde30fbc2da6e57f88aeb726.tar.gz jgit-8abb47b2967d914ebde30fbc2da6e57f88aeb726.zip |
Merge "Fix some tests for running in bazel"
3 files changed, 13 insertions, 7 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/CGitAttributesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/CGitAttributesTest.java index 6188fa60c9..7a74fd3cb6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/CGitAttributesTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/CGitAttributesTest.java @@ -125,11 +125,12 @@ public class CGitAttributesTest extends RepositoryTestCase { ProcessBuilder builder = fs.runInShell("git", new String[] { "check-attr", "--stdin", "--all" }); builder.directory(db.getWorkTree()); + builder.environment().put("HOME", fs.userHome().getAbsolutePath()); ExecutionResult result = fs.execute(builder, new ByteArrayInputStream( input.toString().getBytes(Constants.CHARSET))); - assertEquals("External git reported errors", "", - toString(result.getStderr())); - assertEquals("External git failed", 0, result.getRc()); + String errorOut = toString(result.getStderr()); + assertEquals("External git failed", "exit 0\n", + "exit " + result.getRc() + '\n' + errorOut); LinkedHashMap<String, Attributes> map = new LinkedHashMap<>(); try (BufferedReader r = new BufferedReader(new InputStreamReader( new BufferedInputStream(result.getStdout().openInputStream()), diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java index c61f2ea7f6..baf9f9c95f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java @@ -105,11 +105,12 @@ public class CGitIgnoreTest extends RepositoryTestCase { ProcessBuilder builder = fs.runInShell("git", new String[] { "ls-files", "--ignored", "--exclude-standard", "-o" }); builder.directory(db.getWorkTree()); + builder.environment().put("HOME", fs.userHome().getAbsolutePath()); ExecutionResult result = fs.execute(builder, new ByteArrayInputStream(new byte[0])); - assertEquals("External git failed", 0, result.getRc()); - assertEquals("External git reported errors", "", - toString(result.getStderr())); + String errorOut = toString(result.getStderr()); + assertEquals("External git failed", "exit 0\n", + "exit " + result.getRc() + '\n' + errorOut); try (BufferedReader r = new BufferedReader(new InputStreamReader( new BufferedInputStream(result.getStdout().openInputStream()), Constants.CHARSET))) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java index 4f3b601d3c..4228c9dbec 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java @@ -142,7 +142,11 @@ public class IndexDiffWithSymlinkTest extends LocalDiskRepositoryTestCase { String[] cmd = { "/bin/sh", "./" + name + ".sh" }; int exitCode; String stdErr; - Process process = Runtime.getRuntime().exec(cmd, null, testDir); + ProcessBuilder builder = new ProcessBuilder(cmd); + builder.environment().put("HOME", + FS.DETECTED.userHome().getAbsolutePath()); + builder.directory(testDir); + Process process = builder.start(); try (InputStream stdOutStream = process.getInputStream(); InputStream stdErrStream = process.getErrorStream(); OutputStream stdInStream = process.getOutputStream()) { |