[ntpsec-main commit] Simplify adding tests by adding a @conf function.

Amar Takhar amar at ntpsec.org
Fri Nov 13 17:23:35 UTC 2015


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

Author:    Amar Takhar <verm at darkbeer.org>
Date:      Fri Nov 13 12:23:16 2015 -0500

Simplify adding tests by adding a @conf function.

---

 pylib/waf.py  | 11 +++++++++++
 tests/wscript |  5 +++--
 wscript       |  2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/pylib/waf.py b/pylib/waf.py
index 49cb5a2..b2dcd24 100644
--- a/pylib/waf.py
+++ b/pylib/waf.py
@@ -67,3 +67,14 @@ def manpage(ctx, section, source):
 	)
  
 	ctx(source=source + '.man-tmp', section=section) 
+
+ at conf
+def ntp_test(ctx, **kwargs):
+	tg = ctx(**kwargs)
+
+	if hasattr(tg, "test_data"):
+		test_data = tg.test_data
+	else:
+		test_data = None
+
+	ctx.env.TEST_BIN += [("%s/tests/%s" % (ctx.bldnode.abspath(), tg.target), test_data)]
diff --git a/tests/wscript b/tests/wscript
index 29f0800..42c1902 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -22,7 +22,7 @@ def build(ctx):
 	]
 
 
-	tg = ctx(
+	ctx.ntp_test(
 		features    = "c cprogram bld_include src_include libisc_include",
         target      = "ntpdig_crypto",
 		includes	= [
@@ -31,6 +31,7 @@ def build(ctx):
 		],
 		use			= "unity ntpdig_obj ntp isc M",
         source      = test_source,
+		test_data	= "%s/tests/ntpdig/data/" % srcnode
 	)
 
-	ctx.env.TEST_BIN += [("%s/tests/%s" % (bldnode, tg.target), "%s/tests/ntpdig/data/" % srcnode)]
+#	ctx.env.TEST_BIN += [("%s/tests/%s" % (bldnode, tg.target), "%s/tests/ntpdig/data/" % srcnode)]
diff --git a/wscript b/wscript
index 82e0caa..9f304f8 100644
--- a/wscript
+++ b/wscript
@@ -133,7 +133,7 @@ def build(ctx):
 		for bin, args in ctx.env.TEST_BIN:
 
 			ctx(
-				rule	= "%s %s" % (bin, args),
+				rule	= "%s -v %s" % (bin, args or " "),
 				shell	= True
 			)
 



More information about the vc mailing list