diff options
-rw-r--r-- | .cirrus.yml | 8 | ||||
-rwxr-xr-x | build/ci/travis_ci.sh | 3 | ||||
-rw-r--r-- | cpio/test/test_format_newc.c | 5 | ||||
-rw-r--r-- | cpio/test/test_option_L_upper.c | 8 | ||||
-rw-r--r-- | cpio/test/test_option_a.c | 5 | ||||
-rw-r--r-- | libarchive/test/test_read_disk_directory_traversals.c | 23 | ||||
-rw-r--r-- | tar/test/test_option_C_mtree.c | 17 | ||||
-rw-r--r-- | tar/test/test_strip_components.c | 3 | ||||
-rw-r--r-- | test_utils/test_main.c | 25 |
9 files changed, 86 insertions, 11 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index d3627afc..acf4c8a2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -51,14 +51,13 @@ Windows_MinGW_task: prepare_script: - choco install -y --no-progress mingw - choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake - - choco install -y --no-progress wget - refreshenv - mkdir build_ci\mingw zlib_script: - refreshenv - mkdir build_ci\libs - cd build_ci\libs - - wget "https://www.zlib.net/zlib-1.2.11.tar.gz" + - curl -o zlib-1.2.11.tar.gz "https://www.zlib.net/zlib-1.2.11.tar.gz" - tar -x -z -f zlib-1.2.11.tar.gz - cd zlib-1.2.11 - cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . @@ -72,3 +71,8 @@ Windows_MinGW_task: - refreshenv - cd build_ci\mingw - mingw32-make + test_script: + - refreshenv + - copy build_ci\libs\zlib-1.2.11\libzlib.dll build_ci\mingw\bin\ + - cd build_ci\mingw + - mingw32-make test diff --git a/build/ci/travis_ci.sh b/build/ci/travis_ci.sh index e51a6793..abbdd8d3 100755 --- a/build/ci/travis_ci.sh +++ b/build/ci/travis_ci.sh @@ -21,8 +21,7 @@ case "$UNAME" in set -x cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER="${CC}" -D CMAKE_MAKE_PROGRAM="mingw32-make" -D CMAKE_BUILD_TYPE="Release" "${SRCDIR}" mingw32-make - # The MinGW tests time out on Travis CI, disable for now - #mingw32-make test + mingw32-make test set +x else echo "Unknown or unspecified build type: ${BS}" diff --git a/cpio/test/test_format_newc.c b/cpio/test/test_format_newc.c index 2c669426..6c981f6a 100644 --- a/cpio/test/test_format_newc.c +++ b/cpio/test/test_format_newc.c @@ -233,7 +233,12 @@ DEFINE_TEST(test_format_newc) assert(is_hex(e, 110)); assertEqualMem(e + 0, "070701", 6); /* Magic */ assert(is_hex(e + 6, 8)); /* ino */ +#if defined(_WIN32) && !defined(CYGWIN) + /* Mode: Group members bits and others bits do not work. */ + assertEqualInt(0xa180, from_hex(e + 14, 8) & 0xffc0); +#else assertEqualInt(0xa1ff, from_hex(e + 14, 8)); /* Mode */ +#endif assertEqualInt(from_hex(e + 22, 8), uid); /* uid */ assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */ assertEqualMem(e + 38, "00000001", 8); /* nlink */ diff --git a/cpio/test/test_option_L_upper.c b/cpio/test/test_option_L_upper.c index 7fd10cef..bf3a9c43 100644 --- a/cpio/test/test_option_L_upper.c +++ b/cpio/test/test_option_L_upper.c @@ -30,8 +30,10 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21 * tests won't run on Windows. */ #if defined(_WIN32) && !defined(__CYGWIN__) #define CAT "type" +#define SEP "\\" #else #define CAT "cat" +#define SEP "/" #endif DEFINE_TEST(test_option_L_upper) @@ -77,7 +79,8 @@ DEFINE_TEST(test_option_L_upper) assertMakeDir("unpack", 0755); assertChdir("unpack"); - r = systemf(CAT " ../archive.out | %s -i >unpack.out 2>unpack.err", testprog); + r = systemf(CAT " .." SEP "archive.out | %s -i >unpack.out 2>unpack.err", testprog); + failure("Error invoking %s -i", testprog); assertEqualInt(r, 0); assertTextFileContents("1 block\n", "unpack.err"); @@ -92,7 +95,8 @@ DEFINE_TEST(test_option_L_upper) assertMakeDir("unpack-L", 0755); assertChdir("unpack-L"); - r = systemf(CAT " ../archive-L.out | %s -i >unpack-L.out 2>unpack-L.err", testprog); + r = systemf(CAT " .." SEP "archive-L.out | %s -i >unpack-L.out 2>unpack-L.err", testprog); + failure("Error invoking %s -i < archive-L.out", testprog); assertEqualInt(r, 0); assertTextFileContents("1 block\n", "unpack-L.err"); diff --git a/cpio/test/test_option_a.c b/cpio/test/test_option_a.c index 29638777..e96bdf3c 100644 --- a/cpio/test/test_option_a.c +++ b/cpio/test/test_option_a.c @@ -71,8 +71,13 @@ test_create(void) * #ifdef this section out. Most of the test below is * still valid. */ memset(×, 0, sizeof(times)); +#if defined(_WIN32) && !defined(CYGWIN) + times.actime = 86400; + times.modtime = 86400; +#else times.actime = 1; times.modtime = 3; +#endif assertEqualInt(0, utime(files[i].name, ×)); /* Record whatever atime the file ended up with. */ diff --git a/libarchive/test/test_read_disk_directory_traversals.c b/libarchive/test/test_read_disk_directory_traversals.c index 1e41c3ca..7dd19157 100644 --- a/libarchive/test/test_read_disk_directory_traversals.c +++ b/libarchive/test/test_read_disk_directory_traversals.c @@ -40,7 +40,30 @@ atimeIsUpdated(void) { const char *fn = "fs_noatime"; struct stat st; +#if defined(_WIN32) && !defined(CYGWIN) + char *buff = NULL; + char *ptr; + int r; + r = systemf("fsutil behavior query disableLastAccess > query_atime"); + if (r == 0) { + buff = slurpfile(NULL, "query_atime"); + if (buff != NULL) { + ptr = buff; + while(*ptr != '\0' && !isdigit(*ptr)) { + ptr++; + } + if (*ptr == '0') { + free(buff); + return(1); + } else if (*ptr == '1' || *ptr == '2') { + free(buff); + return(0); + } + free(buff); + } + } +#endif if (!assertMakeFile(fn, 0666, "a")) return (0); if (!assertUtimes(fn, 1, 0, 1, 0)) diff --git a/tar/test/test_option_C_mtree.c b/tar/test/test_option_C_mtree.c index caf8044b..f0903066 100644 --- a/tar/test/test_option_C_mtree.c +++ b/tar/test/test_option_C_mtree.c @@ -36,6 +36,9 @@ DEFINE_TEST(test_option_C_mtree) p0 = NULL; char *content = "./foo type=file uname=root gname=root mode=0755\n"; char *filename = "output.tar"; +#if defined(_WIN32) && !defined(CYGWIN) + char *p; +#endif /* an absolute path to mtree file */ char *mtree_file = "/METALOG.mtree"; @@ -48,9 +51,21 @@ DEFINE_TEST(test_option_C_mtree) assertMakeDir("bar", 0775); assertMakeFile("bar/foo", 0777, "abc"); - r = systemf("%s -cf %s -C bar \"@%s\" >step1.out 2>step1.err", testprog, filename, absolute_path); +#if defined(_WIN32) && !defined(CYGWIN) + p = absolute_path; + while(*p != '\0') { + if (*p == '/') + *p = '\\'; + p++; + } + r = systemf("%s -cf %s -C bar @%s >step1.out 2>step1.err", testprog, filename, absolute_path); failure("Error invoking %s -cf %s -C bar @%s", testprog, filename, absolute_path); +#else + r = systemf("%s -cf %s -C bar \"@%s\" >step1.out 2>step1.err", testprog, filename, absolute_path); + failure("Error invoking %s -cf %s -C bar \"@%s\"", testprog, filename, absolute_path); +#endif + assertEqualInt(r, 0); assertEmptyFile("step1.out"); assertEmptyFile("step1.err"); diff --git a/tar/test/test_strip_components.c b/tar/test/test_strip_components.c index e1d71ddc..caf45a3e 100644 --- a/tar/test/test_strip_components.c +++ b/tar/test/test_strip_components.c @@ -64,9 +64,10 @@ DEFINE_TEST(test_strip_components) failure("d0/d1/s2 is a symlink to something that won't be extracted"); /* If platform supports symlinks, target/s2 is a broken symlink. */ /* If platform does not support symlink, target/s2 doesn't exist. */ - assertFileNotExists("target/s2"); if (canSymlink()) assertIsSymlink("target/s2", "d2/f1"); + else + assertFileNotExists("target/s2"); failure("d0/d1/d2 should be extracted"); assertIsDir("target/d2", -1); diff --git a/test_utils/test_main.c b/test_utils/test_main.c index 91effdf5..cd4c772b 100644 --- a/test_utils/test_main.c +++ b/test_utils/test_main.c @@ -1717,16 +1717,30 @@ is_symlink(const char *file, int line, REPARSE_DATA_BUFFER *buf; size_t len, len2; wchar_t *linknamew, *contentsw; + const char *p; + char *s, *pn; int ret = 0; BYTE *indata; DWORD flag = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT; - if (contents == NULL) - return (0); + /* Replace slashes with backslashes in pathname */ + pn = malloc((strlen(pathname) + 1) * sizeof(char)); + p = pathname; + s = pn; + while(*p != '\0') { + if(*p == '/') + *s = '\\'; + else + *s = *p; + p++; + s++; + } + *s = '\0'; - h = CreateFileA(pathname, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, + h = CreateFileA(pn, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, flag, NULL); + free(pn); if (h == INVALID_HANDLE_VALUE) return (0); @@ -1747,6 +1761,11 @@ is_symlink(const char *file, int line, return (0); } + if (contents == NULL) { + free(indata); + return (1); + } + len = buf->SymbolicLinkReparseBuffer.SubstituteNameLength; linknamew = malloc(len + sizeof(wchar_t)); |