summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2009-03-06 12:03:26 -0500
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2009-03-06 12:03:26 -0500
commit3eead26090243c3c41a6f2bd9dcb4dbf8899c0ff (patch)
tree417feaf8195d5ea90c6a6c24c31bc06bc301aae8 /cpio
parent45ec0b6d02f8480fe9bc5797c734d312799734f1 (diff)
downloadlibarchive-3eead26090243c3c41a6f2bd9dcb4dbf8899c0ff.tar.gz
On Windows, pass test_option_L in bsdcpio_test.
SVN-Revision: 741
Diffstat (limited to 'cpio')
-rw-r--r--cpio/test/test_option_L.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/cpio/test/test_option_L.c b/cpio/test/test_option_L.c
index 0caa0f0e..1f5e4e05 100644
--- a/cpio/test/test_option_L.c
+++ b/cpio/test/test_option_L.c
@@ -25,9 +25,16 @@
#include "test.h"
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $");
+#ifdef _WIN32
+#define CAT "type"
+#else
+#define CAT "cat"
+#endif
+
DEFINE_TEST(test_option_L)
{
struct stat st;
+ const char *p;
int fd, filelist;
int r;
@@ -46,37 +53,54 @@ DEFINE_TEST(test_option_L)
close(filelist);
- r = systemf("cat filelist | %s -pd copy >copy.out 2>copy.err", testprog);
+ r = systemf(CAT " filelist | %s -pd copy >copy.out 2>copy.err", testprog);
assertEqualInt(r, 0);
assertEqualInt(0, lstat("copy/symlink", &st));
+#ifndef _WIN32
failure("Regular -p without -L should preserve symlinks.");
assert(S_ISLNK(st.st_mode));
+#endif
- r = systemf("cat filelist | %s -pd -L copy-L >copy-L.out 2>copy-L.err", testprog);
+ r = systemf(CAT " filelist | %s -pd -L copy-L >copy-L.out 2>copy-L.err", testprog);
assertEqualInt(r, 0);
assertEmptyFile("copy-L.out");
- assertFileContents("1 block\n", 8, "copy-L.err");
+ p = "1 block" NL;
+ assertFileContents(p, strlen(p), "copy-L.err");
assertEqualInt(0, lstat("copy-L/symlink", &st));
failure("-pdL should dereference symlinks and turn them into files.");
assert(!S_ISLNK(st.st_mode));
- r = systemf("cat filelist | %s -o >archive.out 2>archive.err", testprog);
+ r = systemf(CAT " filelist | %s -o >archive.out 2>archive.err", testprog);
failure("Error invoking %s -o ", testprog);
assertEqualInt(r, 0);
assertEqualInt(0, mkdir("unpack", 0755));
+#ifdef _WIN32
+ assertEqualInt(0, chdir("unpack"));
+ r = systemf("type ..\\archive.out | %s -i >unpack.out 2>unpack.err", testprog);
+ assertEqualInt(0, chdir(".."));
+#else
r = systemf("cat archive.out | (cd unpack ; %s -i >unpack.out 2>unpack.err)", testprog);
+#endif
failure("Error invoking %s -i", testprog);
assertEqualInt(r, 0);
assertEqualInt(0, lstat("unpack/symlink", &st));
+#ifndef _WIN32
assert(S_ISLNK(st.st_mode));
+#endif
- r = systemf("cat filelist | %s -oL >archive-L.out 2>archive-L.err", testprog);
+ r = systemf(CAT " filelist | %s -oL >archive-L.out 2>archive-L.err", testprog);
failure("Error invoking %s -oL", testprog);
assertEqualInt(r, 0);
assertEqualInt(0, mkdir("unpack-L", 0755));
+#ifdef _WIN32
+ assertEqualInt(0, chdir("unpack-L"));
+ r = systemf("type ..\\archive-L.out | %s -i >unpack-L.out 2>unpack-L.err", testprog);
+ assertEqualInt(0, chdir(".."));
+#else
r = systemf("cat archive-L.out | (cd unpack-L ; %s -i >unpack-L.out 2>unpack-L.err)", testprog);
+#endif
failure("Error invoking %s -i < archive-L.out", testprog);
assertEqualInt(r, 0);
assertEqualInt(0, lstat("unpack-L/symlink", &st));