[Git][NTPsec/ntpsec][master] 2 commits: Made bin_test part of the build, bin test log after unit test log.

Ian Bruene gitlab at mg.gitlab.com
Wed Jan 9 19:50:32 UTC 2019


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
84948b30 by Ian Bruene at 2019-01-09T17:59:22Z
Made bin_test part of the build, bin test log after unit test log.

- - - - -
89b1e26d by Ian Bruene at 2019-01-09T19:34:23Z
Fixed confusing bin_test failure report.

- - - - -


2 changed files:

- wafhelpers/bin_test.py
- wscript


Changes:

=====================================
wafhelpers/bin_test.py
=====================================
@@ -34,6 +34,14 @@ cmd_map3 = {    # Need curses
     ("main/ntpclients/ntpmon", "--version"): "ntpmon %s\n" % verStr,
 }
 
+test_logs = []
+
+def addLog(color, text):
+    test_logs.append((color, text))
+
+def bin_test_summary(ctx):
+    for i in test_logs:
+        waflib.Logs.pprint(i[0], i[1])
 
 def run(cmd, reg, pythonic):
     """Run an individual non-python test."""
@@ -41,10 +49,10 @@ def run(cmd, reg, pythonic):
 
     breg = ntp.poly.polybytes(reg)
 
-    print("running: ", " ".join(cmd), end="")
+    prefix = "running: " + " ".join(cmd)
 
     if not os.path.exists("%s/%s" % (waflib.Context.out_dir, cmd[0])):
-        waflib.Logs.pprint("YELLOW", " SKIPPING (does not exist)")
+        addLog("YELLOW", prefix + " SKIPPING (does not exist)")
         return False
 
     if pythonic:
@@ -61,10 +69,14 @@ def run(cmd, reg, pythonic):
         check = True
 
     if check:
-        waflib.Logs.pprint("GREEN", "  OK")
+        addLog("GREEN", prefix + "  OK")
         return True
-    waflib.Logs.pprint("RED", "  FAILED")
-    waflib.Logs.pprint("PINK", ntp.poly.polystr(stderr))
+    addLog("RED", prefix + "  FAILED")
+    addLog("PINK", "Expected: " + breg)
+    if stdout:
+        addLog("PINK", "Got (stdout): " + ntp.poly.polystr(stdout))
+    if stderr:
+        addLog("PINK", "Got (stderr): " + ntp.poly.polystr(stderr))
     return False
 
 
@@ -84,9 +96,9 @@ def cmd_bin_test(ctx, config):
         if not run(cmd, cmd_map2[cmd], True):
             fails += 1
 
-    if 0 < fails:
-        waflib.Logs.pprint("GREY", "Expected:\t%s" % (verStr))
     if 1 == fails:
+        bin_test_summary(ctx)
         ctx.fatal("1 binary test failed!")
     elif 1 < fails:
+        bin_test_summary(ctx)
         ctx.fatal("%d binary tests failed!" % fails)


=====================================
wscript
=====================================
@@ -897,6 +897,10 @@ def bin_test(ctx):
     from wafhelpers.bin_test import cmd_bin_test
     cmd_bin_test(ctx, config)
 
+def bin_test_summary(ctx):
+    """Display results of binary check, use after tests."""
+    from wafhelpers.bin_test import bin_test_summary
+    bin_test_summary(ctx)
 
 # Borrowed from https://www.rtems.org/
 variant_cmd = (
@@ -1083,8 +1087,8 @@ def build(ctx):
             if verbose > 0:
                 ctx.add_post_fun(test_print_log)
 
-            # Test binaries
-            ctx.add_post_fun(bin_test)
+        # Test binaries
+        ctx.add_post_fun(bin_test)
 
         # Write test log to a file
         ctx.add_post_fun(test_write_log)
@@ -1092,6 +1096,7 @@ def build(ctx):
         # Print a summary at the end
         ctx.add_post_fun(waf_unit_test.summary)
         ctx.add_post_fun(waf_unit_test.set_exit_code)
+        ctx.add_post_fun(bin_test_summary)
     else:
         pprint("YELLOW", "Unit test runner skipped on a cross-compiled build.")
         from waflib import Options



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/06dcb9c1a23a408035ddc3f4e237857b7c188ba5...89b1e26db242b2b594d07976b3da3b7251ab066d

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/06dcb9c1a23a408035ddc3f4e237857b7c188ba5...89b1e26db242b2b594d07976b3da3b7251ab066d
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190109/7699c0d4/attachment-0001.html>


More information about the vc mailing list