From 00db7dddae0c6f1acddf52d97c9e6c65393d2459 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 16 Feb 2011 09:48:56 +0100 Subject: Update ts to take the config path as an invironmental and as a variables passed with all_tests and also with the normal run --- lib/test_server/src/ts.erl | 17 +++++++++++++---- lib/test_server/src/ts_run.erl | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) (limited to 'lib/test_server') diff --git a/lib/test_server/src/ts.erl b/lib/test_server/src/ts.erl index befa6bf7f1..3d55f41b8c 100644 --- a/lib/test_server/src/ts.erl +++ b/lib/test_server/src/ts.erl @@ -150,6 +150,14 @@ help(installed) -> " TraceSpec is the name of a file containing\n", " trace specifications or a list of trace\n", " specification elements.\n", + " {config, Path} - Specify which directory ts should get it's \n" + " config files from. The files should follow\n" + " the convention lib/test_server/src/ts*.config.\n" + " These config files can also be specified by\n" + " setting the TEST_CONFIG_PATH environment\n" + " variable to the directory where the config\n" + " files are. The default location is\n" + " tests/test_server/.\n" "\n", "Supported trace information elements\n", " {tp | tpl, Mod, [] | match_spec()}\n", @@ -330,10 +338,11 @@ check_test_get_opts(Testspec, Config) -> validate_test(Testspec), Mode = configmember(batch, {batch, interactive}, Config), Vars = configvars(Config), - Trace = configtrace(Config), + Trace = get_config(trace,Config), + ConfigPath = get_config(config,Config), KeepTopcase = configmember(keep_topcase, {keep_topcase,[]}, Config), Cover = configcover(Testspec,Config), - lists:flatten([Vars,Mode,Trace,KeepTopcase,Cover]). + lists:flatten([Vars,Mode,Trace,KeepTopcase,Cover,ConfigPath]). to_erlang_term(Atom) -> String = atom_to_list(Atom), @@ -401,8 +410,8 @@ special_vars(Config) -> SpecVars1 end. -configtrace(Config) -> - case lists:keysearch(trace,1,Config) of +get_config(Key,Config) -> + case lists:keysearch(Key,1,Config) of {value,Value} -> Value; false -> [] end. diff --git a/lib/test_server/src/ts_run.erl b/lib/test_server/src/ts_run.erl index d1e0e2e99c..60e01600e1 100644 --- a/lib/test_server/src/ts_run.erl +++ b/lib/test_server/src/ts_run.erl @@ -632,15 +632,20 @@ make_common_test_args(Args0, Options, _Vars) -> [{logdir,"../test_server"}] end, - ConfigFile = case lists:keysearch(config, 1, Options) of - {value, {config, _}} -> - []; - false -> - [{config, [filename:join("../test_server",File) - || File <- get_config_files()]}] + ConfigPath = case {os:getenv("TEST_CONFIG_PATH"), + lists:keysearch(config, 1, Options)} of + {false,{value, {config, Path}}} -> + Path; + {false,false} -> + "../test_server"; + {Path,_} -> + Path end, + ConfigFiles = [{config,[filename:join(ConfigPath,File) + || File <- get_config_files()]}], - io_lib:format("~100000p",[Args0++Trace++Cover++Logdir++ConfigFile++Options]). + io_lib:format("~100000p",[Args0++Trace++Cover++Logdir++ + ConfigFiles++Options]). make_test_server_args(Args0,Options,Vars) -> Parameters = -- cgit v1.2.3