[ntpsec-main commit] Add a 'waf check' command

Amar Takhar amar at ntpsec.org
Fri Nov 13 03:35:31 UTC 2015


Module:    ntpsec-main
Branch:    master
Commit:    4f237b0fbe73018a724a3c34997423ad7833b7a6
Changeset: http://git.ntpsec.org//commit/?id=4f237b0fbe73018a724a3c34997423ad7833b7a6

Author:    Amar Takhar <verm at darkbeer.org>
Date:      Thu Nov 12 22:32:19 2015 -0500

Add a 'waf check' command

  * You need to uncomment recurse("tests") still.

---

 tests/wscript |  6 ++++--
 wscript       | 14 +++++++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/wscript b/tests/wscript
index 1331e5a..823f977 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,6 +1,6 @@
-
 def build(ctx):
 	srcnode = ctx.srcnode.abspath()
+	bldnode = ctx.bldnode.abspath()
 
 	unity_source = [
 		"unity/unity.c",
@@ -22,7 +22,7 @@ def build(ctx):
 	]
 
 
-	ctx(
+	tg = ctx(
 		features    = "c cprogram bld_include src_include libisc_include",
         target      = "ntpdig_crypto",
 		includes	= [
@@ -32,3 +32,5 @@ def build(ctx):
 		use			= "unity ntpdig_obj ntp isc M",
         source      = test_source,
 	)
+
+	ctx.env.TEST_BIN += ["%s/tests/%s" % (bldnode, tg.target)]
diff --git a/wscript b/wscript
index a37a180..c851b4b 100644
--- a/wscript
+++ b/wscript
@@ -19,7 +19,6 @@ def parse_version():
 
 config = parse_version()
 
-
 def dist(ctx):
         ctx.base_name = "ntpsec-%d.%d.%d" % \
                         (config["NTPS_VERSION_MAJOR"], \
@@ -63,6 +62,7 @@ def options(ctx):
 	grp.add_option('--ldflags', type='string', action="callback", callback=callback_flags, help="Users should use LDFLAGS in their environment.")
 	grp.add_option('--enable-fortify', action='store_true', help="Enable HP Fortify.")
 	grp.add_option('--fortify-flags', type='string', action='store', help="Fortify flags.")
+	grp.add_option('--check', action='store_true', default=False, help="Run tests")
 
 
 
@@ -83,6 +83,10 @@ def configure(ctx):
 
 	cmd_configure(ctx)
 
+from waflib.Build import BuildContext
+class check(BuildContext):
+	cmd = 'check'
+
 
 def build(ctx):
 	ctx.load('waf', tooldir='pylib/')
@@ -125,5 +129,13 @@ def build(ctx):
 	ctx.manpage(1, "ntptrace/ntptrace-man.txt")
 
 
+	if ctx.cmd == "check":
+		for bin in ctx.env.TEST_BIN:
+
+			ctx(
+				rule	= bin,
+				shell	= True
+			)
+
 # end
 



More information about the vc mailing list