aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-20 15:16:05 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-10 17:12:14 +0200
commit319237061b5dff7da3ab3e52d2520a02a720a06a (patch)
tree70bdcb7e1f572e368544911f974b51c5ffe7354a
parentd3815fac159a71e9a77ca81bc84dfda526d6d4a1 (diff)
Handle string or array arguments for "files" key
Change-Id: I16b6dedfa4c2fee866463c6df235505bc68a358c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--README.md2
-rw-r--r--conf.d/project/etc/test-config.json2
-rw-r--r--conf.d/project/lua.d/aft.lua8
3 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index ecdc05a..64fcf48 100644
--- a/README.md
+++ b/README.md
@@ -251,8 +251,6 @@ Specify which api to trace using a pattern.
Edit the JSON array to point to your tests files.
-> **CAUTION** : It must stay a JSON array, don't change the type
-
Here is an example:
```json
diff --git a/conf.d/project/etc/test-config.json b/conf.d/project/etc/test-config.json
index aee7857..fa26c5f 100644
--- a/conf.d/project/etc/test-config.json
+++ b/conf.d/project/etc/test-config.json
@@ -16,7 +16,7 @@
"action": "lua://AFT#_launch_test",
"args": {
"trace": "hello",
- "files": ["helloworld.lua"]
+ "files": "helloworld.lua"
}
}
}
diff --git a/conf.d/project/lua.d/aft.lua b/conf.d/project/lua.d/aft.lua
index 28d8185..43ea15c 100644
--- a/conf.d/project/lua.d/aft.lua
+++ b/conf.d/project/lua.d/aft.lua
@@ -347,8 +347,12 @@ function _launch_test(context, args)
_AFT.context = context
AFB:servsync(_AFT.context, "monitor", "set", { verbosity = "debug" })
AFB:servsync(_AFT.context, "monitor", "trace", { add = { api = args.trace, request = "vverbose", daemon = "vverbose", event = "push_after" }})
- for _,f in pairs(args.files) do
- dofile('var/'..f)
+ if args.files and type(args.files) == 'table' then
+ for _,f in pairs(args.files) do
+ dofile('var/'..f)
+ end
+ elseif type(args.files) == 'string' then
+ dofile('var/'..args.files)
end
lu.LuaUnit:runSuiteByInstances(_AFT.tests_list)