diff options
author | Luis Rascão <luis.rascao@gmail.com> | 2015-08-18 23:46:01 +0100 |
---|---|---|
committer | Luis Rascão <luis.rascao@gmail.com> | 2015-08-18 23:46:01 +0100 |
commit | c9f7f274d678adc64bdf8214bd318c455d0fc400 (patch) | |
tree | 971582292cff35a5202d95a201affbcb234a16e0 /inttest | |
parent | 6cc18c931cdeec68f50708fdc7638e13611b825d (diff) | |
download | rebar-c9f7f274d678adc64bdf8214bd318c455d0fc400.tar.gz |
Add regression test for covered common test
Project has dependency that also contains a covered common test suite
Diffstat (limited to 'inttest')
-rw-r--r-- | inttest/ct_cover/app.config | 2 | ||||
-rw-r--r-- | inttest/ct_cover/cover.spec | 3 | ||||
-rw-r--r-- | inttest/ct_cover/ct_cover_rt.erl | 30 | ||||
-rw-r--r-- | inttest/ct_cover/mock/dummy/app.config | 2 | ||||
-rw-r--r-- | inttest/ct_cover/mock/dummy/cover.spec | 3 | ||||
-rw-r--r-- | inttest/ct_cover/mock/dummy/ebin/dummy.app | 6 | ||||
-rw-r--r-- | inttest/ct_cover/mock/dummy/itest/test_SUITE.erl | 17 | ||||
-rw-r--r-- | inttest/ct_cover/mock/dummy/rebar.config | 4 | ||||
-rw-r--r-- | inttest/ct_cover/rebar.config | 7 | ||||
-rw-r--r-- | inttest/ct_cover/test_SUITE.erl | 17 |
10 files changed, 91 insertions, 0 deletions
diff --git a/inttest/ct_cover/app.config b/inttest/ct_cover/app.config new file mode 100644 index 0000000..bb718b2 --- /dev/null +++ b/inttest/ct_cover/app.config @@ -0,0 +1,2 @@ +%% This file is an application config file, not a CT test config file +[{a1, [{foo, bar}]}]. diff --git a/inttest/ct_cover/cover.spec b/inttest/ct_cover/cover.spec new file mode 100644 index 0000000..353f322 --- /dev/null +++ b/inttest/ct_cover/cover.spec @@ -0,0 +1,3 @@ +%% Cover analysis level. +%% Level = details | overview +{level, details}. diff --git a/inttest/ct_cover/ct_cover_rt.erl b/inttest/ct_cover/ct_cover_rt.erl new file mode 100644 index 0000000..c7f8776 --- /dev/null +++ b/inttest/ct_cover/ct_cover_rt.erl @@ -0,0 +1,30 @@ +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ts=4 sw=4 et +-module(ct_cover_rt). + +-compile(export_all). + +files() -> + [{create, "ebin/a1.app", app(a1)}, + {copy, "../../rebar", "rebar"}, + {copy, "rebar.config", "rebar.config"}, + {copy, "app.config", "app.config"}, + {copy, "cover.spec", "cover.spec"}, + {copy, "test_SUITE.erl", "itest/test_SUITE.erl"}, + {copy, "mock", "deps"}]. + +run(_Dir) -> + {ok, _} = retest:sh("./rebar compile ct"), + ok. + +%% +%% Generate the contents of a simple .app file +%% +app(Name) -> + App = {application, Name, + [{description, atom_to_list(Name)}, + {vsn, "1"}, + {modules, []}, + {registered, []}, + {applications, [kernel, stdlib]}]}, + io_lib:format("~p.\n", [App]). diff --git a/inttest/ct_cover/mock/dummy/app.config b/inttest/ct_cover/mock/dummy/app.config new file mode 100644 index 0000000..c471954 --- /dev/null +++ b/inttest/ct_cover/mock/dummy/app.config @@ -0,0 +1,2 @@ +%% This file is an application config file, not a CT test config file +[{dummy, [{foo, bar}]}]. diff --git a/inttest/ct_cover/mock/dummy/cover.spec b/inttest/ct_cover/mock/dummy/cover.spec new file mode 100644 index 0000000..353f322 --- /dev/null +++ b/inttest/ct_cover/mock/dummy/cover.spec @@ -0,0 +1,3 @@ +%% Cover analysis level. +%% Level = details | overview +{level, details}. diff --git a/inttest/ct_cover/mock/dummy/ebin/dummy.app b/inttest/ct_cover/mock/dummy/ebin/dummy.app new file mode 100644 index 0000000..3c89b1b --- /dev/null +++ b/inttest/ct_cover/mock/dummy/ebin/dummy.app @@ -0,0 +1,6 @@ +{application,dummy, + [{description,"dummy"}, + {vsn,"1"}, + {modules,[]}, + {registered,[]}, + {applications,[kernel,stdlib]}]}. diff --git a/inttest/ct_cover/mock/dummy/itest/test_SUITE.erl b/inttest/ct_cover/mock/dummy/itest/test_SUITE.erl new file mode 100644 index 0000000..0d9a065 --- /dev/null +++ b/inttest/ct_cover/mock/dummy/itest/test_SUITE.erl @@ -0,0 +1,17 @@ +-module(test_SUITE). + +-compile(export_all). + +-include_lib("ct.hrl"). + +all() -> + [simple_test, + app_config_file_test]. + +simple_test(Config) -> + io:format("Test: ~p\n", [Config]). + +app_config_file_test(_Config) -> + application:start(dummy), + {ok, bar} = application:get_env(dummy, foo), + application:stop(dummy). diff --git a/inttest/ct_cover/mock/dummy/rebar.config b/inttest/ct_cover/mock/dummy/rebar.config new file mode 100644 index 0000000..34b1c47 --- /dev/null +++ b/inttest/ct_cover/mock/dummy/rebar.config @@ -0,0 +1,4 @@ +{cover_enabled, true}. + +{ct_dir, "itest"}. +{ct_extra_params, "-repeat 2 -erl_args -config app -cover cover.spec"}. diff --git a/inttest/ct_cover/rebar.config b/inttest/ct_cover/rebar.config new file mode 100644 index 0000000..2b14ab8 --- /dev/null +++ b/inttest/ct_cover/rebar.config @@ -0,0 +1,7 @@ +{cover_enabled, true}. + +{deps_dir, "deps"}. +{deps,[{dummy, ".*"}]}. + +{ct_dir, "itest"}. +{ct_extra_params, "-repeat 2 -erl_args -config app"}. diff --git a/inttest/ct_cover/test_SUITE.erl b/inttest/ct_cover/test_SUITE.erl new file mode 100644 index 0000000..e8a2bb8 --- /dev/null +++ b/inttest/ct_cover/test_SUITE.erl @@ -0,0 +1,17 @@ +-module(test_SUITE). + +-compile(export_all). + +-include_lib("ct.hrl"). + +all() -> + [simple_test, + app_config_file_test]. + +simple_test(Config) -> + io:format("Test: ~p\n", [Config]). + +app_config_file_test(_Config) -> + application:start(a1), + {ok, bar} = application:get_env(a1, foo), + application:stop(a1). |