summaryrefslogtreecommitdiff
path: root/py/waf/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'py/waf/test.py')
-rw-r--r--py/waf/test.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/py/waf/test.py b/py/waf/test.py
new file mode 100644
index 0000000000..4070e3c10e
--- /dev/null
+++ b/py/waf/test.py
@@ -0,0 +1,38 @@
+from waflib.Logs import pprint
+
+def test_write_log(ctx):
+ file_out = "%s/test.log" % ctx.bldnode.abspath()
+
+ log = lst = getattr(ctx, 'utest_results', [])
+
+ if not log:
+ return
+
+ with open(file_out, "w") as fp:
+ for binary, retval, lines, error in ctx.utest_results:
+ fp.write("BINARY : %s\n" % binary)
+ fp.write("RETURN VALUE: %s\n" % retval)
+ fp.write("\n*** stdout ***\n")
+ fp.write(lines)
+ fp.write("\n*** stderr ***\n")
+ fp.write(error)
+ fp.write("\n\n\n")
+
+ pprint("BLUE", "Wrote test log to: ", file_out)
+
+
+def test_print_log(ctx):
+ for binary, retval, lines, error in ctx.utest_results:
+ pprint("YELLOW", "BINARY :", binary)
+ pprint("YELLOW", "RETURN VALUE:", retval)
+ print("")
+
+ if retval or error:
+ pprint("RED", "****** ERROR ******\n")
+
+ print(error or lines)
+
+ if (not retval) and (not error):
+ pprint("GREEN", "****** LOG ******\n", lines)
+
+ print