Skip to content
This repository
Browse code

Add support for customising common test directory

This patch allows users to specify the directory in which common_test
source files can be found. Most common_test suites are integration,
rather than unit tests and keeping the sources apart from test sources
for other frameworks such as eunit and PropEr is a useful feature.
  • Loading branch information...
commit 286a2a88a4d769b702529d184661c4166854f27e 1 parent bd349bd
Tim Watson authored September 18, 2011 tuncer committed December 28, 2011
3  inttest/ct1/ct1_rt.erl
@@ -6,7 +6,8 @@
6 6
 files() ->
7 7
     [{create, "ebin/a1.app", app(a1)},
8 8
      {copy, "../../rebar", "rebar"},
9  
-     {copy, "test_SUITE.erl", "test/test_SUITE.erl"}].
  9
+     {copy, "rebar.config", "rebar.config"},
  10
+     {copy, "test_SUITE.erl", "itest/test_SUITE.erl"}].
10 11
 
11 12
 run(_Dir) ->
12 13
     {ok, _} = retest:sh("./rebar compile ct"),
2  inttest/ct1/rebar.config
... ...
@@ -0,0 +1,2 @@
  1
+
  2
+{ct_dir, "itest"}.
3  rebar.config.sample
@@ -86,6 +86,9 @@
86 86
 
87 87
 %% == Common Test ==
88 88
 
  89
+%% Override the default "test" directory in which SUITEs are located
  90
+{ct_dir, "itest"}.
  91
+
89 92
 %% Option to pass extra parameters when launching Common Test
90 93
 {ct_extra_params, "-boot start_sasl -s myapp"}.
91 94
 
3  src/rebar_ct.erl
@@ -46,7 +46,8 @@
46 46
 %% ===================================================================
47 47
 
48 48
 ct(Config, File) ->
49  
-    run_test_if_present("test", Config, File).
  49
+    TestDir = rebar_config:get_local(Config, ct_dir, "test"),
  50
+    run_test_if_present(TestDir, Config, File).
50 51
 
51 52
 %% ===================================================================
52 53
 %% Internal functions

0 notes on commit 286a2a8

Please sign in to comment.
Something went wrong with that request. Please try again.