From 4d1dc3cabe19056b8db473aa8941a7f20ff874ce Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 16 Jul 2018 15:23:02 +0200 Subject: 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 --- conf.d/controller/lua.d/aft.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'conf.d/controller/lua.d/aft.lua') 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 -- cgit 1.2.3-korg