]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Properly record clang coverage data when exiting
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 14 Sep 2023 13:03:08 +0000 (15:03 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 9 Oct 2023 10:43:23 +0000 (12:43 +0200)
pdns/dnsdist-lua.cc
pdns/dnsdist.cc
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/coverage.cc [new symlink]
pdns/dnsdistdist/coverage.hh [new symlink]

index 1896cce32dd6884c9f29e8aea5071fb865400e8a..902ccf64ac0c7dfcf9ac8610d9012aaa52a5404a 100644 (file)
@@ -57,6 +57,7 @@
 #include "dnsdist-web.hh"
 
 #include "base64.hh"
+#include "coverage.hh"
 #include "doh.hh"
 #include "dolog.hh"
 #include "sodcrypto.hh"
@@ -282,13 +283,6 @@ static void LuaThread(const std::string& code)
   }
 }
 
-#ifdef COVERAGE
-extern "C"
-{
-  void __gcov_dump(void);
-}
-#endif
-
 static bool checkConfigurationTime(const std::string& name)
 {
   if (!g_configurationDone) {
@@ -866,9 +860,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     g_tlslocals.clear();
     g_rings.clear();
 #endif /* 0 */
-#ifdef COVERAGE
-    __gcov_dump();
-#endif
+    pdns::coverage::dumpCoverageData();
     _exit(0);
   });
 
index cde7fd061bd26e5d2203744a41027b34c6705f3a..7d6e5bac60bef21ef7b5515e9b7e598be694b137 100644 (file)
@@ -68,6 +68,7 @@
 
 #include "base64.hh"
 #include "capabilities.hh"
+#include "coverage.hh"
 #include "delaypipe.hh"
 #include "doh.hh"
 #include "dolog.hh"
@@ -2395,11 +2396,6 @@ static void usage()
 }
 
 #ifdef COVERAGE
-extern "C"
-{
-  void __gcov_dump(void);
-}
-
 static void cleanupLuaObjects()
 {
   /* when our coverage mode is enabled, we need to make
@@ -2410,13 +2406,14 @@ static void cleanupLuaObjects()
   g_selfansweredrespruleactions.setState({});
   g_dstates.setState({});
   g_policy.setState(ServerPolicy());
+  g_pools.setState({});
   clearWebHandlers();
 }
 
 static void sigTermHandler(int)
 {
   cleanupLuaObjects();
-  __gcov_dump();
+  pdns::coverage::dumpCoverageData();
   _exit(EXIT_SUCCESS);
 }
 #else /* COVERAGE */
index e845dcd5bb0e604bb8a38c510d891ac960d362fc..db92cc87305d05d5b9e7dd4f72aa71c63c48add0 100644 (file)
@@ -139,6 +139,7 @@ dnsdist_SOURCES = \
        channel.cc channel.hh \
        circular_buffer.hh \
        connection-management.hh \
+       coverage.cc coverage.hh \
        credentials.cc credentials.hh \
        dns.cc dns.hh \
        dns_random.hh \
diff --git a/pdns/dnsdistdist/coverage.cc b/pdns/dnsdistdist/coverage.cc
new file mode 120000 (symlink)
index 0000000..5b8a2c8
--- /dev/null
@@ -0,0 +1 @@
+../coverage.cc
\ No newline at end of file
diff --git a/pdns/dnsdistdist/coverage.hh b/pdns/dnsdistdist/coverage.hh
new file mode 120000 (symlink)
index 0000000..da12b36
--- /dev/null
@@ -0,0 +1 @@
+../coverage.hh
\ No newline at end of file