]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Code coverage
authorFred Morcos <fred.morcos@open-xchange.com>
Fri, 4 Aug 2023 11:42:04 +0000 (13:42 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:32 +0000 (13:28 +0100)
meson.build
meson/code-coverage/meson.build [new file with mode: 0644]
meson_options.txt

index a2a307b582c6116bd502e102d8c864b899c5208f..5351dd54fe62661420eeebfac3f07b3f6fb1548f 100644 (file)
@@ -66,6 +66,7 @@ subdir('meson/gss-tsig')                 # GSS-TSIG
 subdir('meson/auth-tools')               # Tools
 subdir('meson/ixfrdist')                 # Ixfrdist
 subdir('meson/systemd')                  # Systemd and unit file handling
+subdir('meson/code-coverage')            # Code coverage
 
 # Find or generate pdns/dnslabeltext.cc
 if not ragel.found() and not fs.exists('pdns/dnslabeltext.cc')
diff --git a/meson/code-coverage/meson.build b/meson/code-coverage/meson.build
new file mode 100644 (file)
index 0000000..7baf3a8
--- /dev/null
@@ -0,0 +1,20 @@
+# Code coverage
+# Inputs: deps
+
+code_coverage_deps = []
+code_coverage = get_option('code-coverage')
+
+if code_coverage
+  args = ['-U_FORTIFY_SOURCE', '-g', '-O0', '-fprofile-arcs', '-ftest-coverage']
+
+  foreach arg: args
+    if not cxx.has_argument(arg)
+      error('Compiler does not support ' + arg + ', which is needed for code coverage')
+      break
+    endif
+
+    code_coverage_deps += declare_dependency(compile_args: [arg])
+  endforeach
+endif
+
+summary('Code Coverage', code_coverage, bool_yn: true, section: 'Configuration')
index 2a6f6728c052c6bf982b729e5c8bdee674ad66c7..a824379211e4aab7f26372d163ebd1fe7f2d96b9 100644 (file)
@@ -46,3 +46,4 @@ option('ixfrdist', type: 'boolean', value: false, description: 'Build ixfrdist')
 option('lua-records', type: 'boolean', value: true, description: 'Build support for Lua records')
 option('systemd-service-user', type: 'string', value: 'pdns', description: 'User to run the systemd pdns service as. Only the setuid setting and User field in the systemd unit file are affected, the user is not created')
 option('systemd-service-group', type: 'string', value: 'pdns', description: 'Group to run the systemd pdns service under. Only the setgid setting and Group field in the systemd unit file are affected, the group is not created')
+option('code-coverage', type: 'boolean', value: false, description: 'Enable code coverage')