diff options
author | Lukas Larsson <[email protected]> | 2011-02-09 19:05:29 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-02-09 19:07:06 +0100 |
commit | ae7e427471b4798a94bf030b3261a46a7df898df (patch) | |
tree | a7b034c87db89a5cbe72fd84f9e5df4172c5ba9e /lib/test_server/src | |
parent | 241a3f7d0a85c4bbc69cf4ee3e40016610647bbf (diff) | |
download | otp-ae7e427471b4798a94bf030b3261a46a7df898df.tar.gz otp-ae7e427471b4798a94bf030b3261a46a7df898df.tar.bz2 otp-ae7e427471b4798a94bf030b3261a46a7df898df.zip |
Rename Suite Callback to Common Test Hook
Diffstat (limited to 'lib/test_server/src')
-rw-r--r-- | lib/test_server/src/Makefile | 2 | ||||
-rw-r--r-- | lib/test_server/src/ts_install_cth.erl (renamed from lib/test_server/src/ts_install_scb.erl) | 57 |
2 files changed, 18 insertions, 41 deletions
diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile index 6f1c6fd167..ba264a5748 100644 --- a/lib/test_server/src/Makefile +++ b/lib/test_server/src/Makefile @@ -58,7 +58,7 @@ TS_MODULES= \ ts_autoconf_win32 \ ts_autoconf_vxworks \ ts_install \ - ts_install_scb + ts_install_cth TARGET_MODULES= $(MODULES:%=$(EBIN)/%) TS_TARGET_MODULES= $(TS_MODULES:%=$(EBIN)/%) diff --git a/lib/test_server/src/ts_install_scb.erl b/lib/test_server/src/ts_install_cth.erl index 3ba8795764..3e28ebd529 100644 --- a/lib/test_server/src/ts_install_scb.erl +++ b/lib/test_server/src/ts_install_cth.erl @@ -23,10 +23,11 @@ %%% but not the Makefile.first parts! So they have to be done by ts or %%% manually!! --module(ts_install_scb). +-module(ts_install_cth). %% Suite Callbacks --export([init/1]). +-export([id/1]). +-export([init/2]). -export([pre_init_per_suite/3]). -export([post_init_per_suite/4]). @@ -57,21 +58,27 @@ -record(state, { ts_conf_dir, target_system, install_opts, nodenames, nodes }). +%% @doc The id of this SCB +-spec id(Opts :: term()) -> + Id :: term(). +id(_Opts) -> + ?MODULE. + %% @doc Always called before any other callback function. --spec init(Opts :: proplist()) -> - {Id :: term(), State :: #state{}}. -init(Opts) -> +-spec init(Id :: term(), Opts :: proplist()) -> + State :: #state{}. +init(_Id, Opts) -> % ct:log("CurrWD: ~p",[file:get_cwd()]), Nodenames = proplists:get_value(nodenames, Opts, 0), Nodes = proplists:get_value(nodes, Opts, 0), TSConfDir = proplists:get_value(ts_conf_dir, Opts), TargetSystem = proplists:get_value(target_system, Opts, install_local), InstallOpts = proplists:get_value(install_opts, Opts, []), - {?MODULE, #state{ nodenames = Nodenames, - nodes = Nodes, - ts_conf_dir = TSConfDir, - target_system = TargetSystem, - install_opts = InstallOpts }}. + #state{ nodenames = Nodenames, + nodes = Nodes, + ts_conf_dir = TSConfDir, + target_system = TargetSystem, + install_opts = InstallOpts }. %% @doc Called before init_per_suite is called. -spec pre_init_per_suite(Suite :: atom(), @@ -220,24 +227,6 @@ terminate(_State) -> %%% ============================================================================ %%% Local functions %%% ============================================================================ -%% Install the test environment -install(ConfDir, TargetSystem, InstallOpts) -> - {ok,CurrWD} = file:get_cwd(), - try - ConfVars = filename:join(ConfDir, "variables"), - ConfVarsIn = filename:join(ConfDir, "conf_vars.in"), - Configure = filename:join(ConfDir, "configure"), - case has_changed([ConfVars],[ConfVarsIn, Configure]) of - true -> - file:set_cwd(ConfDir), - ts_install:install(TargetSystem, InstallOpts); - false -> - ct:log("Already installed!",[]) - end - after - file:set_cwd(CurrWD) - end. - %% Configure and run all the Makefiles in the data dirs of the suite %% in question make_non_erlang(DataDir, Variables) -> @@ -272,18 +261,6 @@ make_non_erlang(DataDir, Variables) -> timer:sleep(100) end. -%% Check if the source files have been changed after the dest files -has_changed(Dest, Source) -> - [] == [D || D <- Dest, S <- Source, get_mtime(D) > get_mtime(S)]. - -get_mtime(File) -> - case file:read_file_info(File) of - {ok,#file_info{ mtime = MTime }} -> - MTime; - _Else -> - {{0,0,0},{0,0,0}} - end. - %% Add a nodename to config if it does not exist add_node_name(Config, State) -> case proplists:get_value(nodenames, Config) of |