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" .
- 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
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}"
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 */
* 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)
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");
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");
* #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. */
{
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))
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";
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");
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);
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);
return (0);
}
+ if (contents == NULL) {
+ free(indata);
+ return (1);
+ }
+
len = buf->SymbolicLinkReparseBuffer.SubstituteNameLength;
linknamew = malloc(len + sizeof(wchar_t));