From: Michihiro NAKAJIMA Date: Fri, 6 Mar 2009 17:03:26 +0000 (-0500) Subject: On Windows, pass test_option_L in bsdcpio_test. X-Git-Tag: v2.7.0~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3eead26090243c3c41a6f2bd9dcb4dbf8899c0ff;p=thirdparty%2Flibarchive.git On Windows, pass test_option_L in bsdcpio_test. SVN-Revision: 741 --- diff --git a/cpio/test/test_option_L.c b/cpio/test/test_option_L.c index 0caa0f0e6..1f5e4e052 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));