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;
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
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
*MINGW*|*mingw*)
HOST_OS_WINDOWS=true
;;
+ *CYGWIN*|*MSYS*)
+ HOST_OS_CYGWIN=true
+ ;;
*Darwin*)
HOST_OS_APPLE=true
;;
expect_stat 'cache miss' 1
# -------------------------------------------------------------------------
+if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
TEST "Symlink to source directory"
mkdir dir
test_failed "Incorrect header file used"
fi
+fi
# -------------------------------------------------------------------------
+if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
TEST "Symlink to source file"
mkdir dir
test_failed "Incorrect header file used"
fi
+fi
# -------------------------------------------------------------------------
TEST ".incbin"
expect_stat 'cache miss' 2
# -------------------------------------------------------------------------
+ if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then
TEST "Path normalization"
cd dir1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
+ fi
# -------------------------------------------------------------------------
TEST "Rewriting in stderr"
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
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
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
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() {
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
{
lockfile_acquire("test", 1000);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
CHECK(path_exists("test.lock"));
#else
CHECK(is_symlink("test.lock"));
{
char *p;
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
create_file("test.lock", "foo");
create_file("test.lock.lock", "foo");
#else
#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");
free(p);
}
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__CYGWIN__)
TEST(failed_lock_breaking)
{
create_file("test.lock", "");