]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Add a unittest for the hard link based compiler detection (#1517)
authorDS <ds.desour@proton.me>
Sat, 21 Sep 2024 18:21:17 +0000 (20:21 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Sep 2024 18:21:17 +0000 (20:21 +0200)
unittest/test_ccache.cpp

index c8e1346e60019be1b03dbb57e489648c2c319056..d80981e1b733e72489159861ca033f686e50c666 100644 (file)
@@ -213,6 +213,16 @@ TEST_CASE("guess_compiler")
 
     CHECK(guess_compiler(clang_cl) == CompilerType::clang_cl);
   }
+
+  SUBCASE("Probe hardlink for actual compiler")
+  {
+    const auto cwd = *fs::current_path();
+    util::write_file(cwd / "gcc", "");
+    const auto cc = cwd / "cc";
+    CHECK(fs::create_hard_link("gcc", cc));
+
+    CHECK(guess_compiler(cc) == CompilerType::gcc);
+  }
 #endif
 }