-// Copyright (C) 2020 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2021 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
}
if (args_info.seen_split_dwarf) {
- size_t pos = args_info.output_obj.rfind('.');
- if (pos == std::string::npos || pos == args_info.output_obj.size() - 1) {
- LOG_RAW("Badly formed object filename");
- return Statistic::bad_compiler_arguments;
- }
-
args_info.output_dwo = Util::change_extension(args_info.output_obj, ".dwo");
}
elif [ ! -f reference.dwo ] && [ -f test.dwo ]; then
test_failed ".dwo not missing"
fi
+
+ # -------------------------------------------------------------------------
+ TEST "Object file without dot"
+
+ $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ expect_exists test.dwo
+
+ rm test.dwo
+
+ $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ expect_exists test.dwo
+
+ # -------------------------------------------------------------------------
+ TEST "Object file with two dots"
+
+ $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test.x.y
+ expect_stat 'cache hit (direct)' 0
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ expect_exists test.x.dwo
+
+ rm test.x.dwo
+
+ $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test.x.y
+ expect_stat 'cache hit (direct)' 1
+ expect_stat 'cache hit (preprocessed)' 0
+ expect_stat 'cache miss' 1
+ expect_exists test.x.dwo
}