mirror of
https://github.com/reactos/ccache.git
synced 2025-01-10 05:20:19 +00:00
Handle missing dependency file in cache correctly
This commit is contained in:
parent
0139d90fb9
commit
8d121763f2
2
ccache.c
2
ccache.c
@ -814,8 +814,6 @@ static void from_cache(enum fromcache_call_mode mode, int put_object_in_manifest
|
||||
if (produce_dep_file && stat(dep_file, &st) != 0) {
|
||||
cc_log("Dependency file missing in cache\n");
|
||||
close(fd_stderr);
|
||||
unlink(stderr_file);
|
||||
unlink(object_path);
|
||||
free(stderr_file);
|
||||
return;
|
||||
}
|
||||
|
26
test.sh
26
test.sh
@ -480,6 +480,32 @@ EOF
|
||||
checkstat 'cache miss' 1
|
||||
checkfile other.d "test.o: test.c test1.h test3.h test2.h"
|
||||
|
||||
##################################################################
|
||||
# Check that a missing .d file in the cache is handled correctly.
|
||||
testname="missing dependency file"
|
||||
$CCACHE -z >/dev/null
|
||||
$CCACHE -C >/dev/null
|
||||
|
||||
$CCACHE $COMPILER -c -MD test.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 0
|
||||
checkstat 'cache miss' 1
|
||||
checkfile other.d "test.o: test.c test1.h test3.h test2.h"
|
||||
|
||||
$CCACHE $COMPILER -c -MD test.c
|
||||
checkstat 'cache hit (direct)' 1
|
||||
checkstat 'cache hit (preprocessed)' 0
|
||||
checkstat 'cache miss' 1
|
||||
checkfile other.d "test.o: test.c test1.h test3.h test2.h"
|
||||
|
||||
find $CCACHE_DIR -name '*.d' -exec rm -f '{}' \;
|
||||
|
||||
$CCACHE $COMPILER -c -MD test.c
|
||||
checkstat 'cache hit (direct)' 1
|
||||
checkstat 'cache hit (preprocessed)' 1
|
||||
checkstat 'cache miss' 1
|
||||
checkfile other.d "test.o: test.c test1.h test3.h test2.h"
|
||||
|
||||
##################################################################
|
||||
# Reset things.
|
||||
CCACHE_NODIRECT=1
|
||||
|
Loading…
Reference in New Issue
Block a user