aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Philipp Wollermann <philwo@google.com>2015-10-09 13:43:41 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-10-09 14:42:52 +0000
commit57df8fde8ac3d331cd325b3e490f88db282cd0c4 (patch)
treedb1767a7e6ae0d27809909718e5f939b92b3892e /src/test/java/com/google/devtools/build/lib
parent6133c3f93d2664f8923ec027443041e595eadead (diff)
Add support for filesets in LinuxSandboxedStrategy.
-- MOS_MIGRATED_REVID=105052078
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategyTest.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategyTest.java b/src/test/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategyTest.java
index 74016762f4..94494e32c6 100644
--- a/src/test/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedStrategyTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
+import com.google.devtools.build.lib.actions.UserExecException;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -227,7 +228,7 @@ public class LinuxSandboxedStrategyTest extends LinuxSandboxedStrategyTestCase {
}
@Test
- public void testParseManifestFile() throws IOException {
+ public void testParseManifestFile() throws IOException, UserExecException {
Path targetDir = workspaceDir.getRelative("runfiles");
targetDir.createDirectory();
@@ -240,7 +241,8 @@ public class LinuxSandboxedStrategyTest extends LinuxSandboxedStrategyTestCase {
Charset.defaultCharset(),
String.format("x/testfile %s\nx/emptyfile \n", testFile.getPathString()));
- Map mounts = LinuxSandboxedStrategy.parseManifestFile(targetDir, manifestFile.getPathFile());
+ Map mounts =
+ LinuxSandboxedStrategy.parseManifestFile(targetDir, manifestFile.getPathFile(), false, "");
assertThat(userFriendlyMap(mounts))
.isEqualTo(
@@ -251,4 +253,27 @@ public class LinuxSandboxedStrategyTest extends LinuxSandboxedStrategyTestCase {
fileSystem.getPath("/runfiles/x/emptyfile"),
fileSystem.getPath("/dev/null"))));
}
+
+ @Test
+ public void testParseFilesetManifestFile() throws IOException, UserExecException {
+ Path targetDir = workspaceDir.getRelative("fileset");
+ targetDir.createDirectory();
+
+ Path testFile = workspaceDir.getRelative("testfile");
+ FileSystemUtils.createEmptyFile(testFile);
+
+ Path manifestFile = workspaceDir.getRelative("MANIFEST");
+ FileSystemUtils.writeContent(
+ manifestFile,
+ Charset.defaultCharset(),
+ String.format("workspace/x/testfile %s\n0\n", testFile.getPathString()));
+
+ Map mounts =
+ LinuxSandboxedStrategy.parseManifestFile(
+ targetDir, manifestFile.getPathFile(), true, "workspace");
+
+ assertThat(userFriendlyMap(mounts))
+ .isEqualTo(
+ userFriendlyMap(ImmutableMap.of(fileSystem.getPath("/fileset/x/testfile"), testFile)));
+ }
}