summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2019-05-30 20:37:06 +0200
committerJoel Rosdahl <joel@rosdahl.net>2019-05-30 21:09:43 +0200
commitd65ec42e260030e1ecc7564b85ed8882d9199354 (patch)
tree72cd5735f0390c1ec8477b70e6047e114b2ddad0
parent75c52a8d2aca26bf9860f4552f28b9552e475c49 (diff)
downloadccache-dev/aggregation.tar.gz
Remove --enabled-aggregated feature toggledev/aggregation
-rw-r--r--Makefile.in2
-rw-r--r--configure.ac12
-rw-r--r--src/ccache.c315
-rw-r--r--test/suites/base.bash14
-rw-r--r--test/suites/cleanup.bash179
-rw-r--r--test/suites/depend.bash54
-rw-r--r--test/suites/direct.bash37
-rw-r--r--test/suites/serialize_diagnostics.bash16
8 files changed, 3 insertions, 626 deletions
diff --git a/Makefile.in b/Makefile.in
index 6b1d560c..ce2804d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -146,7 +146,7 @@ test: ccache$(EXEEXT) unittest/run$(EXEEXT)
$(if $(quiet),@echo " TEST unittest/run$(EXEEXT)")
$(Q)unittest/run$(EXEEXT)
$(if $(quiet),@echo " TEST $(srcdir)/test/run")
- $(Q)AGGREGATED=@aggregated@ CC='$(CC)' $(BASH) $(srcdir)/test/run
+ $(Q)CC='$(CC)' $(BASH) $(srcdir)/test/run
.PHONY: unittest
unittest: unittest/run$(EXEEXT)
diff --git a/configure.ac b/configure.ac
index 43ecd6fa..bb0f2be9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,6 @@ case $host in
;;
esac
-AC_SUBST(aggregated)
AC_SUBST(disable_man)
AC_SUBST(extra_libs)
AC_SUBST(extra_sources)
@@ -179,17 +178,6 @@ if test x${enable_tracing} = xyes; then
extra_sources="src/minitrace.c"
fi
-AC_ARG_ENABLE(aggregated,
- [AS_HELP_STRING([--enable-aggregated],
- [enable aggregated result files rather than single])])
-if test x${enable_aggregated} = xyes; then
- CPPFLAGS="$CPPFLAGS -DUSE_SINGLE=0 -DUSE_AGGREGATED=1"
- aggregated=true
-else
- CPPFLAGS="$CPPFLAGS -DUSE_SINGLE=1 -DUSE_AGGREGATED=0"
- aggregated=false
-fi
-
dnl Linking on Windows needs ws2_32
if test x${windows_os} = xyes; then
LIBS="$LIBS -lws2_32"
diff --git a/src/ccache.c b/src/ccache.c
index e7e9fd6d..dbed96ba 100644
--- a/src/ccache.c
+++ b/src/ccache.c
@@ -138,43 +138,9 @@ static char *arch_args[MAX_ARCH_ARGS] = {NULL};
// object code.
static struct file_hash *cached_obj_hash;
-#if USE_AGGREGATED
// Full path to the file containing everything
// (cachedir/a/b/cdef[...]-size.result).
static char *cached_result;
-#endif
-
-#if USE_SINGLE
-// Full path to the file containing the cached object code
-// (cachedir/a/b/cdef[...]-size.o).
-static char *cached_obj;
-
-// Full path to the file containing the standard error output
-// (cachedir/a/b/cdef[...]-size.stderr).
-static char *cached_stderr;
-
-// Full path to the file containing the dependency information
-// (cachedir/a/b/cdef[...]-size.d).
-static char *cached_dep;
-
-// Full path to the file containing the coverage information
-// (cachedir/a/b/cdef[...]-size.gcno).
-static char *cached_cov;
-
-// Full path to the file containing the stack usage
-// (cachedir/a/b/cdef[...]-size.su).
-static char *cached_su;
-
-// Full path to the file containing the diagnostic information (for clang)
-// (cachedir/a/b/cdef[...]-size.dia).
-static char *cached_dia;
-
-// Full path to the file containing the split dwarf (for GCC 4.8 and above)
-// (cachedir/a/b/cdef[...]-size.dwo).
-//
-// Contains NULL if -gsplit-dwarf is not given.
-static char *cached_dwo;
-#endif
// Full path to the file containing the manifest
// (cachedir/a/b/cdef[...]-size.manifest).
@@ -1194,152 +1160,6 @@ object_hash_from_depfile(const char *depfile, struct hash *hash)
return result;
}
-#if USE_SINGLE
-// Helper function for copy_file_to_cache and move_file_to_cache_same_fs.
-static void
-do_copy_or_move_file_to_cache(const char *source, const char *dest, bool copy)
-{
- assert(!conf->read_only);
- assert(!conf->read_only_direct);
-
- struct stat orig_dest_st;
- bool orig_dest_existed = stat(dest, &orig_dest_st) == 0;
- int compression_level = conf->compression ? conf->compression_level : 0;
- bool do_move = !copy && !conf->compression;
- bool do_link = copy && conf->hard_link && !conf->compression;
-
- if (do_move) {
- move_uncompressed_file(source, dest, compression_level);
- } else {
- if (do_link) {
- x_unlink(dest);
- int ret = link(source, dest);
- if (ret != 0) {
- cc_log("Failed to link %s to %s: %s", source, dest, strerror(errno));
- cc_log("Falling back to copying");
- do_link = false;
- }
- }
- if (!do_link) {
- int ret = copy_file(source, dest, compression_level);
- if (ret != 0) {
- cc_log("Failed to copy %s to %s: %s", source, dest, strerror(errno));
- stats_update(STATS_ERROR);
- failed();
- }
- }
- }
-
- if (!copy && conf->compression) {
- // We fell back to copying since dest should be compressed, so clean up.
- x_unlink(source);
- }
-
- cc_log("Stored in cache: %s -> %s (%s)",
- source,
- dest,
- do_move ? "moved" : (do_link ? "linked" : "copied"));
-
- struct stat st;
- if (x_stat(dest, &st) != 0) {
- stats_update(STATS_ERROR);
- failed();
- }
- stats_update_size(
- stats_file,
- file_size(&st) - (orig_dest_existed ? file_size(&orig_dest_st) : 0),
- orig_dest_existed ? 0 : 1);
-}
-
-// Copy a file into the cache.
-//
-// dest must be a path in the cache (see get_path_in_cache). source does not
-// have to be on the same file system as dest.
-//
-// An attempt will be made to hard link source to dest if conf->hard_link is
-// true and conf->compression is false, otherwise copy. dest will be compressed
-// if conf->compression is true.
-static void
-copy_file_to_cache(const char *source, const char *dest)
-{
- do_copy_or_move_file_to_cache(source, dest, true);
-}
-
-// Move a file into the cache.
-//
-// dest must be a path in the cache (see get_path_in_cache). source must be on
-// the same file system as dest. dest will be compressed if conf->compression
-// is true.
-static void
-move_file_to_cache_same_fs(const char *source, const char *dest)
-{
- do_copy_or_move_file_to_cache(source, dest, false);
-}
-
-// Helper function for get_file_from_cache and copy_file_from_cache.
-static void
-do_copy_or_link_file_from_cache(const char *source, const char *dest, bool copy)
-{
- int ret;
- bool do_link = !copy && conf->hard_link && !file_is_compressed(source);
- if (do_link) {
- x_unlink(dest);
- ret = link(source, dest);
- } else {
- ret = copy_file(source, dest, 0);
- }
-
- if (ret == -1) {
- if (errno == ENOENT || errno == ESTALE) {
- cc_log("File missing in cache: %s", source);
- stats_update(STATS_MISSING);
- } else {
- cc_log("Failed to %s %s to %s: %s",
- do_link ? "link" : "copy",
- source,
- dest,
- strerror(errno));
- stats_update(STATS_ERROR);
- }
-
- // If there was trouble getting a file from the cached result, wipe the
- // whole cached result for consistency.
- x_unlink(cached_stderr);
- x_unlink(cached_obj);
- x_unlink(cached_dep);
- x_unlink(cached_cov);
- x_unlink(cached_su);
- x_unlink(cached_dia);
- x_unlink(cached_dwo);
-
- failed();
- }
-
- cc_log("Created from cache: %s -> %s", source, dest);
-}
-
-// Copy or link a file from the cache.
-//
-// source must be a path in the cache (see get_path_in_cache). dest does not
-// have to be on the same file system as source.
-//
-// An attempt will be made to hard link source to dest if conf->hard_link is
-// true and conf->compression is false, otherwise copy. dest will be compressed
-// if conf->compression is true.
-static void
-get_file_from_cache(const char *source, const char *dest)
-{
- do_copy_or_link_file_from_cache(source, dest, false);
-}
-
-// Copy a file from the cache.
-static void
-copy_file_from_cache(const char *source, const char *dest)
-{
- do_copy_or_link_file_from_cache(source, dest, true);
-}
-#endif
-
// Send cached stderr, if any, to stderr.
static void
send_cached_stderr(const char *path_stderr)
@@ -1388,18 +1208,7 @@ update_cached_result_globals(struct file_hash *hash)
{
char *object_name = format_hash_as_string(hash->hash, hash->hsize);
cached_obj_hash = hash;
-#if USE_AGGREGATED
cached_result = get_path_in_cache(object_name, ".result");
-#endif
-#if USE_SINGLE
- cached_obj = get_path_in_cache(object_name, ".o");
- cached_stderr = get_path_in_cache(object_name, ".stderr");
- cached_dep = get_path_in_cache(object_name, ".d");
- cached_cov = get_path_in_cache(object_name, ".gcno");
- cached_su = get_path_in_cache(object_name, ".su");
- cached_dia = get_path_in_cache(object_name, ".dia");
- cached_dwo = get_path_in_cache(object_name, ".dwo");
-#endif
stats_file = format("%s/%c/stats", conf->cache_dir, object_name[0]);
free(object_name);
@@ -1442,17 +1251,10 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
int tmp_stderr_fd;
int status;
if (!conf->depend_mode) {
-#if USE_AGGREGATED
tmp_stdout = format("%s/tmp.stdout", temp_dir());
tmp_stdout_fd = create_tmp_fd(&tmp_stdout);
tmp_stderr = format("%s/tmp.stderr", temp_dir());
tmp_stderr_fd = create_tmp_fd(&tmp_stderr);
-#else
- tmp_stdout = format("%s.tmp.stdout", cached_obj);
- tmp_stdout_fd = create_tmp_fd(&tmp_stdout);
- tmp_stderr = format("%s.tmp.stderr", cached_obj);
- tmp_stderr_fd = create_tmp_fd(&tmp_stderr);
-#endif
status = execute(args->argv, tmp_stdout_fd, tmp_stderr_fd, &compiler_pid);
args_pop(args, 3);
} else {
@@ -1583,38 +1385,6 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
stats_update(STATS_ERROR);
failed();
}
-#if USE_SINGLE
- if (st.st_size > 0) {
- if (!conf->depend_mode) {
- move_file_to_cache_same_fs(tmp_stderr, cached_stderr);
- } else {
- copy_file_to_cache(tmp_stderr, cached_stderr);
- }
- } else if (conf->recache) {
- // If recaching, we need to remove any previous .stderr.
- x_unlink(cached_stderr);
- }
-
- MTR_BEGIN("file", "file_put");
-
- copy_file_to_cache(output_obj, cached_obj);
- if (produce_dep_file) {
- copy_file_to_cache(output_dep, cached_dep);
- }
- if (generating_coverage) {
- copy_file_to_cache(output_cov, cached_cov);
- }
- if (generating_stackusage) {
- copy_file_to_cache(output_su, cached_su);
- }
- if (generating_diagnostics) {
- copy_file_to_cache(output_dia, cached_dia);
- }
- if (using_split_dwarf) {
- copy_file_to_cache(output_dwo, cached_dwo);
- }
-#endif
-#if USE_AGGREGATED
struct filelist *filelist = create_empty_filelist();
if (st.st_size > 0) {
add_file_to_filelist(filelist, tmp_stderr, ".stderr");
@@ -1651,7 +1421,6 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
stats_file,
file_size(&st) - (orig_dest_existed ? file_size(&orig_dest_st) : 0),
orig_dest_existed ? 0 : 1);
-#endif
MTR_END("file", "file_put");
@@ -1680,12 +1449,7 @@ to_cache(struct args *args, struct hash *depend_mode_hash)
}
// Everything OK.
-#if USE_AGGREGATED
send_cached_stderr(tmp_stderr);
-#endif
-#if USE_SINGLE
- send_cached_stderr(cached_stderr);
-#endif
update_manifest_file();
if (st.st_size == 0 || conf->depend_mode) {
@@ -2356,19 +2120,6 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
// Occasionally, e.g. on hard reset, our cache ends up as just filesystem
// meta-data with no content. Catch an easy case of this.
-#if USE_SINGLE
- struct stat st;
- if (stat(cached_obj, &st) != 0) {
- cc_log("Object file %s not in cache", cached_obj);
- return;
- }
- if (st.st_size == 0) {
- cc_log("Invalid (empty) object file %s in cache", cached_obj);
- x_unlink(cached_obj);
- return;
- }
-#endif
-#if USE_AGGREGATED
struct stat st;
if (stat(cached_result, &st) != 0) {
cc_log("Cache file %s not in cache", cached_result);
@@ -2379,7 +2130,6 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
x_unlink(cached_result);
return;
}
-#endif
MTR_BEGIN("cache", "from_cache");
@@ -2391,29 +2141,6 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
MTR_BEGIN("file", "file_get");
// Get result from cache.
-#if USE_SINGLE
- if (!str_eq(output_obj, "/dev/null")) {
- get_file_from_cache(cached_obj, output_obj);
- if (using_split_dwarf) {
- get_file_from_cache(cached_dwo, output_dwo);
- }
- }
- if (produce_dep_file) {
- // Never hardlink the .d file since automake fails to move a foo.d.tmp file
- // to foo.d if they have the same i-node.
- copy_file_from_cache(cached_dep, output_dep);
- }
- if (generating_coverage) {
- get_file_from_cache(cached_cov, output_cov);
- }
- if (generating_stackusage) {
- get_file_from_cache(cached_su, output_su);
- }
- if (generating_diagnostics) {
- get_file_from_cache(cached_dia, output_dia);
- }
-#endif
-#if USE_AGGREGATED
char *tmp_stderr = format("%s/tmp.stderr", temp_dir());
int tmp_stderr_fd = create_tmp_fd(&tmp_stderr);
close(tmp_stderr_fd);
@@ -2442,50 +2169,21 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
free_filelist(filelist);
cc_log("Read from cache: %s", cached_result);
-#endif
MTR_END("file", "file_get");
- // Update modification timestamps to save files from LRU cleanup. Also gives
+ // Update modification timestamp to save files from LRU cleanup. Also gives
// files a sensible mtime when hard-linking.
-#if USE_SINGLE
- update_mtime(cached_obj);
- update_mtime(cached_stderr);
- if (produce_dep_file) {
- update_mtime(cached_dep);
- }
- if (generating_coverage) {
- update_mtime(cached_cov);
- }
- if (generating_stackusage) {
- update_mtime(cached_su);
- }
- if (generating_diagnostics) {
- update_mtime(cached_dia);
- }
- if (cached_dwo) {
- update_mtime(cached_dwo);
- }
-#endif
-#if USE_AGGREGATED
update_mtime(cached_result);
-#endif
-#if USE_SINGLE
- send_cached_stderr(cached_stderr);
-#endif
-#if USE_AGGREGATED
send_cached_stderr(tmp_stderr);
-#endif
if (put_object_in_manifest) {
update_manifest_file();
}
-#if USE_AGGREGATED
tmp_unlink(tmp_stderr);
free(tmp_stderr);
-#endif
// Log the cache hit.
switch (mode) {
@@ -3880,18 +3578,7 @@ cc_reset(void)
free(output_dia); output_dia = NULL;
free(output_dwo); output_dwo = NULL;
free(cached_obj_hash); cached_obj_hash = NULL;
-#if USE_AGGREGATED
free(cached_result); cached_result = NULL;
-#endif
-#if USE_SINGLE
- free(cached_stderr); cached_stderr = NULL;
- free(cached_obj); cached_obj = NULL;
- free(cached_dep); cached_dep = NULL;
- free(cached_cov); cached_cov = NULL;
- free(cached_su); cached_su = NULL;
- free(cached_dia); cached_dia = NULL;
- free(cached_dwo); cached_dwo = NULL;
-#endif
free(manifest_path); manifest_path = NULL;
time_of_compilation = 0;
for (size_t i = 0; i < ignore_headers_len; i++) {
diff --git a/test/suites/base.bash b/test/suites/base.bash
index e188b059..dc02939a 100644
--- a/test/suites/base.bash
+++ b/test/suites/base.bash
@@ -794,20 +794,6 @@ EOF
expect_stat 'compiler check failed' 1
# -------------------------------------------------------------------------
- TEST "CCACHE_RECACHE should remove previous .stderr"
-
- $CCACHE_COMPILE -c test1.c
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_file_count 0 '*.stderr' $CCACHE_DIR
-
- obj_file=`find $CCACHE_DIR -name '*.o'`
- stderr_file=`echo $obj_file | sed 's/..$/.stderr/'`
- test -n "$stderr_file" && echo "Warning: foo" >$stderr_file
- CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c
- expect_file_count 0 '*.stderr' $CCACHE_DIR
-
- # -------------------------------------------------------------------------
TEST "No object file"
cat <<'EOF' >test_no_obj.c
diff --git a/test/suites/cleanup.bash b/test/suites/cleanup.bash
index 37710c13..cc3ca42e 100644
--- a/test/suites/cleanup.bash
+++ b/test/suites/cleanup.bash
@@ -3,23 +3,12 @@ prepare_cleanup_test_dir() {
rm -rf $dir
mkdir -p $dir
- if $AGGREGATED; then
for i in $(seq 0 9); do
printf '%4017s' '' | tr ' ' 'A' >$dir/result$i-4017.result
backdate $((3 * i + 1)) $dir/result$i-4017.result
done
# NUMFILES: 10, TOTALSIZE: 13 KiB, MAXFILES: 0, MAXSIZE: 0
echo "0 0 0 0 0 0 0 0 0 0 0 10 13 0 0" >$dir/stats
- else
- for i in $(seq 0 9); do
- printf '%4017s' '' | tr ' ' 'A' >$dir/result$i-4017.o
- backdate $((3 * i + 1)) $dir/result$i-4017.o
- backdate $((3 * i + 2)) $dir/result$i-4017.d
- backdate $((3 * i + 3)) $dir/result$i-4017.stderr
- done
- # NUMFILES: 30, TOTALSIZE: 40 KiB, MAXFILES: 0, MAXSIZE: 0
- echo "0 0 0 0 0 0 0 0 0 0 0 30 40 0 0" >$dir/stats
- fi
}
SUITE_cleanup() {
@@ -29,15 +18,8 @@ SUITE_cleanup() {
prepare_cleanup_test_dir $CCACHE_DIR/a
$CCACHE -C >/dev/null
- if $AGGREGATED; then
expect_file_count 0 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 0
- else
- expect_file_count 0 '*.o' $CCACHE_DIR
- expect_file_count 0 '*.d' $CCACHE_DIR
- expect_file_count 0 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 0
- fi
expect_stat 'cleanups performed' 1
# -------------------------------------------------------------------------
@@ -47,15 +29,8 @@ SUITE_cleanup() {
$CCACHE -F 0 -M 0 >/dev/null
$CCACHE -c >/dev/null
- if $AGGREGATED; then
expect_file_count 10 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 10
- else
- expect_file_count 10 '*.o' $CCACHE_DIR
- expect_file_count 10 '*.d' $CCACHE_DIR
- expect_file_count 10 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 30
- fi
expect_stat 'cleanups performed' 0
# -------------------------------------------------------------------------
@@ -65,46 +40,21 @@ SUITE_cleanup() {
# No cleanup needed.
#
- if $AGGREGATED; then
# 10 * 16 = 160
$CCACHE -F 160 -M 0 >/dev/null
- else
- # 30 * 16 = 480
- $CCACHE -F 480 -M 0 >/dev/null
- fi
$CCACHE -c >/dev/null
- if $AGGREGATED; then
expect_file_count 10 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 10
- else
- expect_file_count 10 '*.o' $CCACHE_DIR
- expect_file_count 10 '*.d' $CCACHE_DIR
- expect_file_count 10 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 30
- fi
expect_stat 'cleanups performed' 0
# Reduce file limit
#
- if $AGGREGATED; then
# 7 * 16 = 112
$CCACHE -F 112 -M 0 >/dev/null
- else
- # 22 * 16 = 352
- $CCACHE -F 352 -M 0 >/dev/null
- fi
$CCACHE -c >/dev/null
- if $AGGREGATED; then
expect_file_count 7 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 7
- else
- expect_file_count 7 '*.o' $CCACHE_DIR
- expect_file_count 7 '*.d' $CCACHE_DIR
- expect_file_count 8 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 22
- fi
expect_stat 'cleanups performed' 1
- if $AGGREGATED; then
for i in 0 1 2; do
file=$CCACHE_DIR/a/result$i-4017.result
expect_file_missing $CCACHE_DIR/a/result$i-4017.result
@@ -113,17 +63,6 @@ SUITE_cleanup() {
file=$CCACHE_DIR/a/result$i-4017.result
expect_file_exists $file
done
- else
-
- for i in 0 1 2; do
- file=$CCACHE_DIR/a/result$i-4017.o
- expect_file_missing $CCACHE_DIR/a/result$i-4017.o
- done
- for i in 3 4 5 6 7 8 9; do
- file=$CCACHE_DIR/a/result$i-4017.o
- expect_file_exists $file
- done
- fi
# -------------------------------------------------------------------------
TEST "Forced cache cleanup, size limit"
@@ -139,17 +78,9 @@ SUITE_cleanup() {
$CCACHE -F 0 -M 256K >/dev/null
$CCACHE -c >/dev/null
- if $AGGREGATED; then
expect_file_count 3 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 3
- else
- expect_file_count 3 '*.o' $CCACHE_DIR
- expect_file_count 4 '*.d' $CCACHE_DIR
- expect_file_count 4 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 11
- fi
expect_stat 'cleanups performed' 1
- if $AGGREGATED; then
for i in 0 1 2 3 4 5 6; do
file=$CCACHE_DIR/a/result$i-4017.result
expect_file_missing $file
@@ -158,16 +89,6 @@ SUITE_cleanup() {
file=$CCACHE_DIR/a/result$i-4017.result
expect_file_exists $file
done
- else
- for i in 0 1 2 3 4 5 6; do
- file=$CCACHE_DIR/a/result$i-4017.o
- expect_file_missing $file
- done
- for i in 7 8 9; do
- file=$CCACHE_DIR/a/result$i-4017.o
- expect_file_exists $file
- done
- fi
# -------------------------------------------------------------------------
TEST "Automatic cache cleanup, limit_multiple 0.9"
@@ -176,34 +97,16 @@ SUITE_cleanup() {
prepare_cleanup_test_dir $CCACHE_DIR/$x
done
- if $AGGREGATED; then
$CCACHE -F 160 -M 0 >/dev/null
- else
- $CCACHE -F 480 -M 0 >/dev/null
- fi
- if $AGGREGATED; then
expect_file_count 160 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 160
- else
- expect_file_count 160 '*.o' $CCACHE_DIR
- expect_file_count 160 '*.d' $CCACHE_DIR
- expect_file_count 160 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 480
- fi
expect_stat 'cleanups performed' 0
touch empty.c
CCACHE_LIMIT_MULTIPLE=0.9 $CCACHE_COMPILE -c empty.c -o empty.o
- if $AGGREGATED; then
expect_file_count 159 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 159
- else
- expect_file_count 159 '*.o' $CCACHE_DIR
- expect_file_count 159 '*.d' $CCACHE_DIR
- expect_file_count 159 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 477
- fi
expect_stat 'cleanups performed' 1
# -------------------------------------------------------------------------
@@ -213,123 +116,45 @@ SUITE_cleanup() {
prepare_cleanup_test_dir $CCACHE_DIR/$x
done
- if $AGGREGATED; then
$CCACHE -F 160 -M 0 >/dev/null
- else
- $CCACHE -F 480 -M 0 >/dev/null
- fi
- if $AGGREGATED; then
expect_file_count 160 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 160
- else
- expect_file_count 160 '*.o' $CCACHE_DIR
- expect_file_count 160 '*.d' $CCACHE_DIR
- expect_file_count 160 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 480
- fi
expect_stat 'cleanups performed' 0
touch empty.c
CCACHE_LIMIT_MULTIPLE=0.7 $CCACHE_COMPILE -c empty.c -o empty.o
- if $AGGREGATED; then
expect_file_count 157 '*.result' $CCACHE_DIR
expect_stat 'files in cache' 157
- else
- expect_file_count 157 '*.o' $CCACHE_DIR
- expect_file_count 157 '*.d' $CCACHE_DIR
- expect_file_count 157 '*.stderr' $CCACHE_DIR
- expect_stat 'files in cache' 471
- fi
expect_stat 'cleanups performed' 1
# -------------------------------------------------------------------------
- if ! $AGGREGATED; then
- TEST ".o file is removed before .stderr"
-
- prepare_cleanup_test_dir $CCACHE_DIR/a
- $CCACHE -F 464 -M 0 >/dev/null
- backdate 0 $CCACHE_DIR/a/result9-4017.stderr
- $CCACHE -c >/dev/null
- expect_file_missing $CCACHE_DIR/a/result9-4017.stderr
- expect_file_missing $CCACHE_DIR/a/result9-4017.o
-
- # Counters expectedly doesn't match reality if x.stderr is found before
- # x.o and the cleanup stops before x.o is found.
- expect_stat 'files in cache' 29
- expect_file_count 28 '*.*' $CCACHE_DIR/a
- fi
-
- # -------------------------------------------------------------------------
- if ! $AGGREGATED; then
- TEST ".stderr file is not removed before .o"
-
- prepare_cleanup_test_dir $CCACHE_DIR/a
- $CCACHE -F 464 -M 0 >/dev/null
- backdate 0 $CCACHE_DIR/a/result9-4017.o
- $CCACHE -c >/dev/null
- expect_file_exists $CCACHE_DIR/a/result9-4017.stderr
- expect_file_missing $CCACHE_DIR/a/result9-4017.o
-
- expect_stat 'files in cache' 29
- expect_file_count 29 '*.*' $CCACHE_DIR/a
- fi
-
- # -------------------------------------------------------------------------
TEST "No cleanup of new unknown file"
prepare_cleanup_test_dir $CCACHE_DIR/a
touch $CCACHE_DIR/a/abcd.unknown
$CCACHE -F 0 -M 0 -c >/dev/null # update counters
- if $AGGREGATED; then
expect_stat 'files in cache' 11
- else
- expect_stat 'files in cache' 31
- fi
- if $AGGREGATED; then
$CCACHE -F 160 -M 0 >/dev/null
- else
- $CCACHE -F 480 -M 0 >/dev/null
- fi
$CCACHE -c >/dev/null
expect_file_exists $CCACHE_DIR/a/abcd.unknown
- if $AGGREGATED; then
expect_stat 'files in cache' 10
- else
- expect_stat 'files in cache' 30
- fi
# -------------------------------------------------------------------------
TEST "Cleanup of old unknown file"
prepare_cleanup_test_dir $CCACHE_DIR/a
- if $AGGREGATED; then
$CCACHE -F 160 -M 0 >/dev/null
- else
- $CCACHE -F 480 -M 0 >/dev/null
- fi
touch $CCACHE_DIR/a/abcd.unknown
backdate $CCACHE_DIR/a/abcd.unknown
$CCACHE -F 0 -M 0 -c >/dev/null # update counters
- if $AGGREGATED; then
expect_stat 'files in cache' 11
- else
- expect_stat 'files in cache' 31
- fi
- if $AGGREGATED; then
$CCACHE -F 160 -M 0 -c >/dev/null
- else
- $CCACHE -F 480 -M 0 -c >/dev/null
- fi
expect_file_missing $CCACHE_DIR/a/abcd.unknown
- if $AGGREGATED; then
expect_stat 'files in cache' 10
- else
- expect_stat 'files in cache' 30
- fi
# -------------------------------------------------------------------------
TEST "Cleanup of tmp file"
@@ -352,9 +177,5 @@ SUITE_cleanup() {
$CCACHE -F 0 -M 0 >/dev/null
$CCACHE -c >/dev/null
expect_file_count 1 '.nfs*' $CCACHE_DIR
- if $AGGREGATED; then
expect_stat 'files in cache' 10
- else
- expect_stat 'files in cache' 30
- fi
}
diff --git a/test/suites/depend.bash b/test/suites/depend.bash
index 733f480b..60443ee7 100644
--- a/test/suites/depend.bash
+++ b/test/suites/depend.bash
@@ -99,22 +99,14 @@ SUITE_depend() {
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2 # .result + .manifest
- else
- expect_stat 'files in cache' 3 # .o + .manifest + .d
- fi
CCACHE_DEPEND=1 $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c test.c
expect_equal_object_files reference_test.o test.o
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2
- else
- expect_stat 'files in cache' 3
- fi
# -------------------------------------------------------------------------
TEST "No dependency file"
@@ -141,26 +133,18 @@ SUITE_depend() {
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2 # .result + .manifest
- else
- expect_stat 'files in cache' 3 # .o + .manifest + .d
- fi
CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -c test.c
expect_equal_object_files reference_test.o test.o
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2
- else
- expect_stat 'files in cache' 3
- fi
# -------------------------------------------------------------------------
TEST "Dependency file paths converted to relative if CCACHE_BASEDIR specified"
-
+
CCACHE_DEPEND=1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c "`pwd`/test.c"
if grep -q "[^.]/test.c" "test.d"; then
test_failed "Dependency file does not contain relative path to test.c"
@@ -216,11 +200,7 @@ EOF
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2 # .result + .manifest
- else
- expect_stat 'files in cache' 3 # .o + .manifest + .d
- fi
# Recompile dir1 first time.
generate_reference_compiler_output
@@ -230,11 +210,7 @@ EOF
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2
- else
- expect_stat 'files in cache' 3
- fi
# Compile dir2. dir2 header changes the object file compared to dir1.
cd $BASEDIR2
@@ -245,11 +221,7 @@ EOF
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- if $AGGREGATED; then
expect_stat 'files in cache' 3 # 2x .result, 1x manifest
- else
- expect_stat 'files in cache' 5 # 2x .o, 2x .d, 1x manifest
- fi
# Compile dir3. dir3 header change does not change object file compared to
# dir1, but ccache still adds an additional .o/.d file in the cache due to
@@ -262,11 +234,7 @@ EOF
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 3
- if $AGGREGATED; then
expect_stat 'files in cache' 4 # 3x .result, 1x manifest
- else
- expect_stat 'files in cache' 7 # 3x .o, 3x .d, 1x manifest
- fi
# Compile dir4. dir4 header adds a new dependency.
cd $BASEDIR4
@@ -278,11 +246,7 @@ EOF
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 4
- if $AGGREGATED; then
expect_stat 'files in cache' 5 # 4x .result, 1x manifest
- else
- expect_stat 'files in cache' 9 # 4x .o, 4x .d, 1x manifest
- fi
# Recompile dir1 second time.
cd $BASEDIR1
@@ -293,11 +257,7 @@ EOF
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 4
- if $AGGREGATED; then
expect_stat 'files in cache' 5
- else
- expect_stat 'files in cache' 9
- fi
# Recompile dir2.
cd $BASEDIR2
@@ -308,11 +268,7 @@ EOF
expect_stat 'cache hit (direct)' 3
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 4
- if $AGGREGATED; then
expect_stat 'files in cache' 5
- else
- expect_stat 'files in cache' 9
- fi
# Recompile dir3.
cd $BASEDIR3
@@ -323,11 +279,7 @@ EOF
expect_stat 'cache hit (direct)' 4
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 4
- if $AGGREGATED; then
expect_stat 'files in cache' 5
- else
- expect_stat 'files in cache' 9
- fi
# Recompile dir4.
cd $BASEDIR4
@@ -339,11 +291,7 @@ EOF
expect_stat 'cache hit (direct)' 5
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 4
- if $AGGREGATED; then
expect_stat 'files in cache' 5
- else
- expect_stat 'files in cache' 9
- fi
# -------------------------------------------------------------------------
diff --git a/test/suites/direct.bash b/test/suites/direct.bash
index f8d306d0..e3765f67 100644
--- a/test/suites/direct.bash
+++ b/test/suites/direct.bash
@@ -151,11 +151,7 @@ EOF
test_failed "$dep_file does not contain $dep_target"
fi
done
- if $AGGREGATED; then
expect_stat 'files in cache' 12
- else
- expect_stat 'files in cache' 18
- fi
# -------------------------------------------------------------------------
TEST "-MMD for different source files"
@@ -461,11 +457,7 @@ EOF
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- if $AGGREGATED; then
expect_stat 'files in cache' 4
- else
- expect_stat 'files in cache' 5
- fi
expect_equal_files test.d expected.d
rm -f test.d
@@ -474,38 +466,9 @@ EOF
expect_stat 'cache hit (direct)' 2
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 2
- if $AGGREGATED; then
expect_stat 'files in cache' 4
- else
- expect_stat 'files in cache' 5
- fi
- expect_equal_files test.d expected.d
-
- # -------------------------------------------------------------------------
- if ! $AGGREGATED; then
- TEST "Missing .d file"
-
- $CCACHE_COMPILE -c -MD test.c
- expect_stat 'cache hit (direct)' 0
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
-
- $CCACHE_COMPILE -c -MD test.c
- expect_stat 'cache hit (direct)' 1
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
expect_equal_files test.d expected.d
- find $CCACHE_DIR -name '*.d' -exec rm '{}' +
-
- # Missing file -> consider the cached result broken.
- $CCACHE_COMPILE -c -MD test.c
- expect_stat 'cache hit (direct)' 1
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_stat 'cache file missing' 1
- fi
-
# -------------------------------------------------------------------------
TEST "stderr from both preprocessor and compiler"
diff --git a/test/suites/serialize_diagnostics.bash b/test/suites/serialize_diagnostics.bash
index 697552d6..29ce9734 100644
--- a/test/suites/serialize_diagnostics.bash
+++ b/test/suites/serialize_diagnostics.bash
@@ -19,11 +19,7 @@ SUITE_serialize_diagnostics() {
$CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 1
- else
- expect_stat 'files in cache' 2
- fi
expect_equal_files expected.dia test.dia
rm test.dia
@@ -31,11 +27,7 @@ SUITE_serialize_diagnostics() {
$CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c
expect_stat 'cache hit (preprocessed)' 1
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 1
- else
- expect_stat 'files in cache' 2
- fi
expect_equal_files expected.dia test.dia
# -------------------------------------------------------------------------
@@ -82,20 +74,12 @@ EOF
expect_stat 'cache hit (direct)' 0
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2
- else
- expect_stat 'files in cache' 4
- fi
cd ../dir2
CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -w -MD -MF `pwd`/test.d -I`pwd`/include --serialize-diagnostics `pwd`/test.dia -c src/test.c -o `pwd`/test.o
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
- if $AGGREGATED; then
expect_stat 'files in cache' 2
- else
- expect_stat 'files in cache' 4
- fi
}