206 lines
6.3 KiB
Diff
206 lines
6.3 KiB
Diff
diff --git a/src/ccache.h b/src/ccache.h
|
|
index 973d42dd..227264da 100644
|
|
diff --git a/src/lockfile.c b/src/lockfile.c
|
|
index 9d1a49db..733e9169 100644
|
|
--- a/src/lockfile.c
|
|
+++ b/src/lockfile.c
|
|
@@ -40,7 +40,7 @@ lockfile_acquire(const char *path, unsigned staleness_limit)
|
|
free(my_content);
|
|
my_content = format("%s:%d:%d", hostname, (int)getpid(), (int)time(NULL));
|
|
|
|
-#ifdef _WIN32
|
|
+#if defined(_WIN32) || defined(__CYGWIN__)
|
|
int fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL|O_BINARY, 0666);
|
|
if (fd == -1) {
|
|
int saved_errno = errno;
|
|
diff --git a/test/run b/test/run
|
|
index 82a80541..6b907f3f 100755
|
|
--- a/test/run
|
|
+++ b/test/run
|
|
@@ -295,6 +295,7 @@ COMPILER_USES_MINGW=false
|
|
HOST_OS_LINUX=false
|
|
HOST_OS_FREEBSD=false
|
|
HOST_OS_WINDOWS=false
|
|
+HOST_OS_CYGWIN=false
|
|
|
|
compiler_version="`$COMPILER --version 2>&1 | head -1`"
|
|
case $compiler_version in
|
|
@@ -323,6 +324,9 @@ case $(uname -s) in
|
|
*MINGW*|*mingw*)
|
|
HOST_OS_WINDOWS=true
|
|
;;
|
|
+ *CYGWIN*|*MSYS*)
|
|
+ HOST_OS_CYGWIN=true
|
|
+ ;;
|
|
*Darwin*)
|
|
HOST_OS_APPLE=true
|
|
;;
|
|
diff --git a/test/suites/base.bash b/test/suites/base.bash
|
|
index 307100e8..07c005b4 100644
|
|
--- a/test/suites/base.bash
|
|
+++ b/test/suites/base.bash
|
|
@@ -822,6 +822,7 @@ EOF
|
|
expect_stat 'cache miss' 1
|
|
|
|
# -------------------------------------------------------------------------
|
|
+if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
|
|
TEST "Symlink to source directory"
|
|
|
|
mkdir dir
|
|
@@ -842,7 +843,9 @@ EOF
|
|
test_failed "Incorrect header file used"
|
|
fi
|
|
|
|
+fi
|
|
# -------------------------------------------------------------------------
|
|
+if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
|
|
TEST "Symlink to source file"
|
|
|
|
mkdir dir
|
|
@@ -863,6 +866,7 @@ EOF
|
|
test_failed "Incorrect header file used"
|
|
fi
|
|
|
|
+fi
|
|
# -------------------------------------------------------------------------
|
|
TEST ".incbin"
|
|
|
|
diff --git a/test/suites/basedir.bash b/test/suites/basedir.bash
|
|
index 4660dc29..fe1be8f7 100644
|
|
--- a/test/suites/basedir.bash
|
|
+++ b/test/suites/basedir.bash
|
|
@@ -4,7 +4,7 @@ SUITE_basedir_SETUP() {
|
|
mkdir -p dir1/src dir1/include
|
|
cat <<EOF >dir1/src/test.c
|
|
#include <stdarg.h>
|
|
-#include <test.h>
|
|
+#include "test.h"
|
|
EOF
|
|
cat <<EOF >dir1/include/test.h
|
|
int test;
|
|
@@ -45,6 +45,7 @@ SUITE_basedir() {
|
|
expect_stat 'cache miss' 2
|
|
|
|
# -------------------------------------------------------------------------
|
|
+ if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
|
|
TEST "Path normalization"
|
|
|
|
cd dir1
|
|
@@ -64,6 +65,7 @@ SUITE_basedir() {
|
|
expect_stat 'cache hit (preprocessed)' 0
|
|
expect_stat 'cache miss' 1
|
|
|
|
+ fi
|
|
# -------------------------------------------------------------------------
|
|
TEST "Rewriting in stderr"
|
|
|
|
diff --git a/test/suites/debug_prefix_map.bash b/test/suites/debug_prefix_map.bash
|
|
index 25cc36ff..98067cb3 100644
|
|
--- a/test/suites/debug_prefix_map.bash
|
|
+++ b/test/suites/debug_prefix_map.bash
|
|
@@ -25,6 +24,8 @@ EOF
|
|
xcrun dwarfdump -r0 $1
|
|
elif $HOST_OS_FREEBSD; then
|
|
objdump -W $1
|
|
+ elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
|
|
+ strings $1 # for some reason objdump only shows the basename of the file, so fall back to brute force and ignorance
|
|
else
|
|
objdump -g $1
|
|
fi
|
|
@@ -33,6 +35,8 @@ objdump_cmd() {
|
|
grep_cmd() {
|
|
if $HOST_OS_APPLE; then
|
|
grep "( \"$1\" )"
|
|
+ elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
|
|
+ test -n "$2" && grep -E "$1|$2" || grep "$1" # accept a relative path for source code, in addition to relocation dir
|
|
else
|
|
grep ": $1[[:space:]]*$"
|
|
fi
|
|
@@ -51,6 +55,9 @@ SUITE_debug_prefix_map() {
|
|
if objdump_cmd test.o | grep_cmd "`pwd`" >/dev/null 2>&1; then
|
|
test_failed "Source dir (`pwd`) found in test.o"
|
|
fi
|
|
+ if ! objdump_cmd test.o | grep_cmd "dir" src/test.c >/dev/null 2>&1; then
|
|
+ test_failed "Relocation (dir) not found in test.o"
|
|
+ fi
|
|
|
|
cd ../dir2
|
|
CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -I`pwd`/include -g -fdebug-prefix-map=`pwd`=dir -c `pwd`/src/test.c -o `pwd`/test.o
|
|
@@ -74,7 +81,7 @@ SUITE_debug_prefix_map() {
|
|
if objdump_cmd test.o | grep_cmd "`pwd`" >/dev/null 2>&1; then
|
|
test_failed "Source dir (`pwd`) found in test.o"
|
|
fi
|
|
- if ! objdump_cmd test.o | grep_cmd "name" >/dev/null 2>&1; then
|
|
+ if ! objdump_cmd test.o | grep_cmd "name" src/test.c >/dev/null 2>&1; then
|
|
test_failed "Relocation (name) not found in test.o"
|
|
fi
|
|
|
|
diff --git a/test/suites/masquerading.bash b/test/suites/masquerading.bash
|
|
index 0b42eef3..3e254dc2 100644
|
|
--- a/test/suites/masquerading.bash
|
|
+++ b/test/suites/masquerading.bash
|
|
@@ -4,6 +4,10 @@ SUITE_masquerading_PROBE() {
|
|
if [ "$(dirname $compiler_binary)" != . ]; then
|
|
echo "compiler ($compiler_binary) not taken from PATH"
|
|
fi
|
|
+ if $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
|
|
+ echo "symlinks not supported on $(uname -s)"
|
|
+ return
|
|
+ fi
|
|
}
|
|
|
|
SUITE_masquerading_SETUP() {
|
|
diff --git a/test/suites/upgrade.bash b/test/suites/upgrade.bash
|
|
index 202dcd2d..81fd1336 100644
|
|
--- a/test/suites/upgrade.bash
|
|
+++ b/test/suites/upgrade.bash
|
|
@@ -1,7 +1,7 @@
|
|
SUITE_upgrade() {
|
|
TEST "Keep maxfiles and maxsize settings"
|
|
|
|
- rm $CCACHE_CONFIGPATH
|
|
+ rm -f $CCACHE_CONFIGPATH
|
|
mkdir -p $CCACHE_DIR/0
|
|
echo "0 0 0 0 0 0 0 0 0 0 0 0 0 2000 131072" >$CCACHE_DIR/0/stats
|
|
expect_stat 'max files' 32000
|
|
diff --git a/unittest/test_lockfile.c b/unittest/test_lockfile.c
|
|
index 98811c68..5c566091 100644
|
|
--- a/unittest/test_lockfile.c
|
|
+++ b/unittest/test_lockfile.c
|
|
@@ -26,7 +26,7 @@ TEST(acquire_should_create_symlink)
|
|
{
|
|
lockfile_acquire("test", 1000);
|
|
|
|
-#ifdef _WIN32
|
|
+#if defined(_WIN32) || defined(__CYGWIN__)
|
|
CHECK(path_exists("test.lock"));
|
|
#else
|
|
CHECK(is_symlink("test.lock"));
|
|
@@ -45,7 +45,7 @@ TEST(lock_breaking)
|
|
{
|
|
char *p;
|
|
|
|
-#ifdef _WIN32
|
|
+#if defined(_WIN32) || defined(__CYGWIN__)
|
|
create_file("test.lock", "foo");
|
|
create_file("test.lock.lock", "foo");
|
|
#else
|
|
@@ -54,7 +54,7 @@ TEST(lock_breaking)
|
|
#endif
|
|
CHECK(lockfile_acquire("test", 1000));
|
|
|
|
-#ifdef _WIN32
|
|
+#if defined(_WIN32) || defined(__CYGWIN__)
|
|
p = read_text_file("test.lock", 0);
|
|
#else
|
|
p = x_readlink("test.lock");
|
|
@@ -66,7 +66,7 @@ TEST(lock_breaking)
|
|
free(p);
|
|
}
|
|
|
|
-#ifndef _WIN32
|
|
+#if !defined(_WIN32) && !defined(__CYGWIN__)
|
|
TEST(failed_lock_breaking)
|
|
{
|
|
create_file("test.lock", "");
|