summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-07-16 15:23:02 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-17 13:56:14 +0000
commit4d1dc3cabe19056b8db473aa8941a7f20ff874ce (patch)
tree6255c3fa09f6cf5b904ecf3c9debcd4fc8bbcb3a
parent85cffa37d79330a2df53ef8d79c70b8bb70a289e (diff)
Change lua print function to write in a file
This lets you retrieve print messages done by the test binding in a file log in addition of binder runtime log messages. By default, the standard output is redirected to a file in the workdir of the binder. This is convenient when you have a heavy loaded binder output. It's more difficult to extract the test results. Change-Id: Ifae540652ae431d4d9703a19673e5bc69c2b315f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--conf.d/controller/lua.d/aft.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/conf.d/controller/lua.d/aft.lua b/conf.d/controller/lua.d/aft.lua
index 73a9c78..190c870 100644
--- a/conf.d/controller/lua.d/aft.lua
+++ b/conf.d/controller/lua.d/aft.lua
@@ -22,13 +22,6 @@ local lu = require('luaunit')
lu.LuaUnit:setOutputType('JUNIT')
lu.LuaUnit.fname = "var/jUnitResults.xml"
--- Use our own print function to redirect it to a file the standard output
-_standard_print = print
-print = function(...)
- io.write(... .. '\n')
- _standard_print(...)
-end
-
_AFT = {
exit = {0, code},
context = _ctx,
@@ -58,6 +51,15 @@ function _AFT.exitAtEnd(code)
_AFT.exit = {1, code}
end
+-- Use our own print function to redirect it to a file in the workdir of the
+-- binder instead of the standard output.
+_AFT.setOutputFile("test_results.log")
+_standard_print = print
+print = function(...)
+ io.write(... .. '\n')
+ _standard_print(...)
+end
+
--[[
Events listener and assertion functions to test correctness of received
event data.
@@ -467,7 +469,6 @@ function _launch_test(context, args)
-- Prepare the tests execution configuring the monitoring and loading
-- lua test files to execute in the Framework.
- _AFT.setOutputFile("var/test_results.log")
AFB:servsync(_AFT.context, "monitor", "set", { verbosity = "debug" })
AFB:servsync(_AFT.context, "monitor", "trace", { add = { api = args.trace, request = "vverbose", event = "push_after" }})
if args.files and type(args.files) == 'table' then