public void TestExtractUnixArchiveWithHardlink() { using (var extractor = new TarExtractor(typeof(TarExtractorTest).GetEmbeddedStream("testArchive.tar"), _sandbox)) extractor.Run(); FileUtils.AreHardlinked(Path.Combine(_sandbox, "subdir1", "regular"), Path.Combine(_sandbox, "hardlink")) .Should().BeTrue(because: "'regular' and 'hardlink' should be hardlinked together"); }
public void TestExtractUnixArchiveWithExecutable() { using (var extractor = new TarExtractor(typeof(TarExtractorTest).GetEmbeddedStream("testArchive.tar"), _sandbox)) extractor.Run(); if (UnixUtils.IsUnix) { FileUtils.IsExecutable(Path.Combine(_sandbox, "subdir2/executable")).Should().BeTrue(because: "File 'executable' should be marked as executable"); } else { string xbitFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.XbitFile)).Trim(); xbitFileContent.Should().Be("/subdir2/executable"); } }
public void TestExtractUnixArchiveWithExecutable() { using (var stream = typeof(ExtractorTest).GetEmbeddedStream("testArchive.tar")) using (var extractor = new TarExtractor(stream, _sandbox)) extractor.Run(); if (UnixUtils.IsUnix) { Assert.IsTrue(FileUtils.IsExecutable(Path.Combine(_sandbox, "subdir2/executable")), "File 'executable' should be marked as executable"); } else { string xbitFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.XbitFile)).Trim(); Assert.AreEqual("/subdir2/executable", xbitFileContent); } }
public void TestExtractUnixArchiveWithSymlink() { using (var extractor = new TarExtractor(typeof(TarExtractorTest).GetEmbeddedStream("testArchive.tar"), _sandbox)) extractor.Run(); string target; string source = Path.Combine(_sandbox, "symlink"); if (UnixUtils.IsUnix) { FileUtils.IsSymlink(source, out target).Should().BeTrue(); } else { CygwinUtils.IsSymlink(source, out target).Should().BeTrue(); } target.Should().Be("subdir1/regular", because: "Symlink should point to 'regular'"); }
public void TestExtractUnixArchiveWithSymlink() { using (var stream = typeof(ExtractorTest).GetEmbeddedStream("testArchive.tar")) using (var extractor = new TarExtractor(stream, _sandbox)) extractor.Run(); string target; if (UnixUtils.IsUnix) { Assert.IsTrue(FileUtils.IsSymlink(Path.Combine(_sandbox, "symlink"), out target)); } else { string symlinkFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.SymlinkFile)).Trim(); Assert.AreEqual("/symlink", symlinkFileContent); target = File.ReadAllText(Path.Combine(_sandbox, "symlink")); } Assert.AreEqual("subdir1/regular", target, "Symlink should point to 'regular'"); }
public void TestExtractUnixArchiveWithSymlink() { using (var extractor = new TarExtractor(this.GetEmbedded("testArchive.tar"), _sandbox)) extractor.Run(); string target; if (UnixUtils.IsUnix) Assert.IsTrue(FileUtils.IsSymlink(Path.Combine(_sandbox, "symlink"), out target)); else { string symlinkFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.SymlinkFile)).Trim(); Assert.AreEqual("/symlink", symlinkFileContent); target = File.ReadAllText(Path.Combine(_sandbox, "symlink")); } Assert.AreEqual("subdir1/regular", target, "Symlink should point to 'regular'"); }
public void TestExtractUnixArchiveWithHardlink() { using (var extractor = new TarExtractor(this.GetEmbedded("testArchive.tar"), _sandbox)) extractor.Run(); Assert.IsTrue( FileUtils.AreHardlinked(Path.Combine(_sandbox, "subdir1", "regular"), Path.Combine(_sandbox, "hardlink")), "'regular' and 'hardlink' should be hardlinked together"); }
public void TestExtractUnixArchiveWithExecutable() { using (var extractor = new TarExtractor(this.GetEmbedded("testArchive.tar"), _sandbox)) extractor.Run(); if (UnixUtils.IsUnix) Assert.IsTrue(FileUtils.IsExecutable(Path.Combine(_sandbox, "subdir2/executable")), "File 'executable' should be marked as executable"); else { string xbitFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.XbitFile)).Trim(); Assert.AreEqual("/subdir2/executable", xbitFileContent); } }
public void TestExtractUnixArchiveWithSymlink() { using (var extractor = new TarExtractor(typeof(TarExtractorTest).GetEmbeddedStream("testArchive.tar"), _sandbox)) extractor.Run(); string target; string source = Path.Combine(_sandbox, "symlink"); if (UnixUtils.IsUnix) FileUtils.IsSymlink(source, out target).Should().BeTrue(); else CygwinUtils.IsSymlink(source, out target).Should().BeTrue(); target.Should().Be("subdir1/regular", because: "Symlink should point to 'regular'"); }
public void TestExtractUnixArchiveWithExecutable() { using (var extractor = new TarExtractor(typeof(TarExtractorTest).GetEmbeddedStream("testArchive.tar"), _sandbox)) extractor.Run(); if (UnixUtils.IsUnix) FileUtils.IsExecutable(Path.Combine(_sandbox, "subdir2/executable")).Should().BeTrue(because: "File 'executable' should be marked as executable"); else { string xbitFileContent = File.ReadAllText(Path.Combine(_sandbox, FlagUtils.XbitFile)).Trim(); xbitFileContent.Should().Be("/subdir2/executable"); } }