wscript: mv --enable-coverage option to global
authorJoe Guo <joeg@catalyst.net.nz>
Tue, 30 Apr 2019 05:21:15 +0000 (17:21 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 08:19:16 +0000 (08:19 +0000)
We want to enable gcov for all tasks, move it to global wscript.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/wscript
selftest/wscript

index f1ebc1c..2e14a32 100644 (file)
@@ -102,6 +102,10 @@ def options(opt):
     gr.add_option('--enable-developer',
                    help=("Turn on developer warnings and debugging"),
                    action="store_true", dest='developer', default=False)
+    opt.add_option('--enable-coverage',
+                   help=("enable options necessary for code coverage "
+                         "reporting on selftest (default=no)"),
+                   action="store_true", dest='enable_coverage', default=False)
     def picky_developer_callback(option, opt_str, value, parser):
         parser.values.developer = True
         parser.values.picky_developer = True
@@ -278,6 +282,13 @@ def configure(conf):
     except:
         conf.env.ABI_CHECK = False
 
+    conf.env.enable_coverage = Options.options.enable_coverage
+    if conf.env.enable_coverage:
+        conf.ADD_LDFLAGS('-lgcov', testflags=True)
+        conf.ADD_CFLAGS('--coverage', testflags=True)
+        # disable abi check for coverage, otherwise ld will fail
+        conf.env.ABI_CHECK = False
+
     conf.env.GIT_LOCAL_CHANGES = Options.options.GIT_LOCAL_CHANGES
 
     conf.CHECK_UNAME()
index 4445548..5116d7e 100644 (file)
@@ -20,10 +20,6 @@ def options(opt):
     opt.add_option('--enable-selftest',
                    help=("enable options necessary for selftest (default=no)"),
                    action="store_true", dest='enable_selftest', default=False)
-    opt.add_option('--enable-coverage',
-                   help=("enable options necessary for code coverage "
-                         "reporting on selftest (default=no)"),
-                   action="store_true", dest='enable_coverage', default=False)
     opt.add_option('--with-selftest-prefix',
                    help=("specify location of selftest directory "
                          "(default=%s)" % DEFAULT_SELFTEST_PREFIX),
@@ -97,11 +93,6 @@ def options(opt):
 
 def configure(conf):
     conf.env.SELFTEST_PREFIX = Options.options.SELFTEST_PREFIX
-    conf.env.enable_coverage = Options.options.enable_coverage
-    if conf.env.enable_coverage:
-        conf.ADD_LDFLAGS('-lgcov', testflags=True)
-        conf.ADD_CFLAGS('--coverage')
-
     if Options.options.enable_selftest or Options.options.developer:
         conf.DEFINE('ENABLE_SELFTEST', 1)