aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-02-09 19:05:29 +0100
committerLukas Larsson <[email protected]>2011-02-09 19:07:06 +0100
commitae7e427471b4798a94bf030b3261a46a7df898df (patch)
treea7b034c87db89a5cbe72fd84f9e5df4172c5ba9e /lib
parent241a3f7d0a85c4bbc69cf4ee3e40016610647bbf (diff)
downloadotp-ae7e427471b4798a94bf030b3261a46a7df898df.tar.gz
otp-ae7e427471b4798a94bf030b3261a46a7df898df.tar.bz2
otp-ae7e427471b4798a94bf030b3261a46a7df898df.zip
Rename Suite Callback to Common Test Hook
Diffstat (limited to 'lib')
-rw-r--r--lib/common_test/doc/src/ct_junit_report.xml109
-rw-r--r--lib/test_server/src/Makefile2
-rw-r--r--lib/test_server/src/ts_install_cth.erl (renamed from lib/test_server/src/ts_install_scb.erl)57
3 files changed, 18 insertions, 150 deletions
diff --git a/lib/common_test/doc/src/ct_junit_report.xml b/lib/common_test/doc/src/ct_junit_report.xml
deleted file mode 100644
index 49a40cc1de..0000000000
--- a/lib/common_test/doc/src/ct_junit_report.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE erlref SYSTEM "erlref.dtd">
-<erlref>
-<header>
-<title>ct_junit_report</title>
-<prepared></prepared>
-<responsible></responsible>
-<docno>1</docno>
-<approved></approved>
-<checked></checked>
-<date></date>
-<rev>A</rev>
-<file>ct_junit_report.xml</file></header>
-<module>ct_junit_report</module>
-<modulesummary>Common Test Framework functions handling test specifications.</modulesummary>
-<description>
-<p>Common Test Framework functions handling test specifications.</p>
-
- <p>This module creates a junit report of the test run if plugged in
- as a suite_callback.</p></description>
-<funcs>
-<func>
-<name>init(Opts) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="init-1"/>
- </desc></func>
-<func>
-<name>post_end_group(Group, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="post_end_group-3"/>
- </desc></func>
-<func>
-<name>post_end_suite(Suite, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="post_end_suite-3"/>
- </desc></func>
-<func>
-<name>post_end_tc(TC, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="post_end_tc-3"/>
- </desc></func>
-<func>
-<name>post_init_group(Group, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="post_init_group-3"/>
- </desc></func>
-<func>
-<name>post_init_suite(Suite, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="post_init_suite-3"/>
- </desc></func>
-<func>
-<name>pre_end_group(Group, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="pre_end_group-3"/>
- </desc></func>
-<func>
-<name>pre_end_suite(Suite, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="pre_end_suite-3"/>
- </desc></func>
-<func>
-<name>pre_init_group(Group, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="pre_init_group-3"/>
- </desc></func>
-<func>
-<name>pre_init_suite(Suite, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="pre_init_suite-3"/>
- </desc></func>
-<func>
-<name>pre_init_tc(TC, Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="pre_init_tc-3"/>
- </desc></func>
-<func>
-<name>terminate(Config, State) -&gt; term()
-</name>
-<fsummary> </fsummary>
-
-<desc><marker id="terminate-2"/>
- </desc></func></funcs>
-
-<authors>
-<aname> </aname>
-<email> </email></authors></erlref> \ No newline at end of file
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