summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-04-05 13:12:48 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2012-04-05 13:12:48 +0100
commitbce68b99fecc431685db48b6d50515fd6a8f4b13 (patch)
treec55f8373298c20b5e1435bd6965ddd4b1ea2a4a3
parentda56250e3b3374393f0713ccd50190c30f570888 (diff)
parentc4f0a589df8ac5eb47431de185330770cdc13a66 (diff)
downloadccache-baserock/http-ccache-morph.tar.gz
Merge branch 'baserock/http-ccache' into baserock/http-ccache-morphbaserock/http-ccache-morph
-rw-r--r--ccache.c16
-rwxr-xr-xtest.sh14
2 files changed, 18 insertions, 12 deletions
diff --git a/ccache.c b/ccache.c
index 92b786fc..25bf4797 100644
--- a/ccache.c
+++ b/ccache.c
@@ -313,7 +313,8 @@ get_remote_file(const char *name, const char *suffix, const char *path)
}
res = curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1l);
if (res != CURLE_OK) {
- cc_log("Curl could not set FAILONERROR: %u", res);
+ cc_log("Curl could not set FAILONERROR: %s",
+ curl_easy_strerror(res));
return res;
}
}
@@ -326,7 +327,8 @@ get_remote_file(const char *name, const char *suffix, const char *path)
}
/* tell curl to download from this url */
if ((res = curl_easy_setopt(curl, CURLOPT_URL, url)) != CURLE_OK) {
- cc_log("Curl failed to set url to %s: %u", url, res);
+ cc_log("Curl failed to set url to %s: %s",
+ url, curl_easy_strerror(res));
goto cleanup;
}
@@ -352,15 +354,15 @@ get_remote_file(const char *name, const char *suffix, const char *path)
/* tell curl to write to that file */
res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, dest);
if (res != CURLE_OK) {
- cc_log("Curl could not set output file to %s: %u",
- tempfilename, res);
+ cc_log("Curl could not set output file to %s: %s",
+ tempfilename, curl_easy_strerror(res));
goto cleanup_rm;
}
/* do the download */
if ((res = curl_easy_perform(curl)) != CURLE_OK) {
- cc_log("Curl could not download %s to %s: %u",
- url, tempfilename, res);
+ cc_log("Curl could not download %s to %s: %s",
+ url, tempfilename, curl_easy_strerror(res));
goto cleanup_rm;
}
@@ -384,7 +386,7 @@ get_remote_file(const char *name, const char *suffix, const char *path)
stats_update(STATS_DOWNLOADED);
cleanup_rm:
- x_unlink(tempfilename);
+ tmp_unlink(tempfilename);
cleanup:
if (dest) fclose(dest);
free(tempfilename);
diff --git a/test.sh b/test.sh
index 8ff61ed5..e2f00876 100755
--- a/test.sh
+++ b/test.sh
@@ -536,19 +536,23 @@ EOF
checkstat 'files in cache' 4
if [ "x$LIBCURL" != "x" ]; then
+ old_CCACHE_DIR="$CCACHE_DIR"
testname="remote-download"
if [ "x$CCACHE_NLEVELS" != "x" ]; then
remotenlevels="$CCACHE_NLEVELS"
else
remotenlevels=2
fi
- tempccachedir="`mktemp -d`"
- CCACHE_DIR="$tempccachedir" \
- CCACHE_REMOTEDIR="file://$CCACHE_DIR" \
- CCACHE_REMOTENLEVELS="$remotenlevels" \
+ tempccachedir="`mktemp -d ccache.XXXXXXXXXX`"
+ export CCACHE_REMOTEDIR="file://`readlink -f $old_CCACHE_DIR`"
+ export CCACHE_REMOTENLEVELS="$remotenlevels"
+ CCACHE_DIR="$tempccachedir"
$CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
- CCACHE_DIR="$tempccachedir" checkstat 'files downloaded' 2
+ checkstat 'files downloaded' 2
rm -rf "$tempccachedir"
+ CCACHE_DIR="$old_CCACHE_DIR"
+ unset CCACHE_REMOTEDIR
+ unset CCACHE_REMOTENLEVELS
fi
rm -f test1.c