summaryrefslogtreecommitdiff
path: root/inttest
diff options
context:
space:
mode:
Diffstat (limited to 'inttest')
-rw-r--r--inttest/code_path_no_recurse/code_path_no_recurse_rt.erl19
-rw-r--r--inttest/code_path_no_recurse/deps/bazdep/src/bazdep.app.src12
-rw-r--r--inttest/code_path_no_recurse/deps/bazdep/src/bazdep.erl6
-rw-r--r--inttest/code_path_no_recurse/deps/bazdep/test/bazdep_tests.erl5
-rw-r--r--inttest/code_path_no_recurse/deps/foodep/rebar.config1
-rw-r--r--inttest/code_path_no_recurse/deps/foodep/src/foodep.app.src12
-rw-r--r--inttest/code_path_no_recurse/deps/foodep/src/foodep.erl6
-rw-r--r--inttest/code_path_no_recurse/deps/foodep/test/foodep_tests.erl5
-rw-r--r--inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.app.src12
-rw-r--r--inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.erl6
-rw-r--r--inttest/code_path_no_recurse/rebar.config1
-rw-r--r--inttest/code_path_no_recurse/src/codepath.app.src12
-rw-r--r--inttest/code_path_no_recurse/src/codepath.erl6
-rw-r--r--inttest/code_path_no_recurse/test/codepath_tests.erl12
-rw-r--r--inttest/depplugins/base_dir_cwd_plugin.erl7
-rw-r--r--inttest/depplugins/dep_cwd_plugin.erl7
-rw-r--r--inttest/depplugins/depplugins_rt.erl43
-rw-r--r--inttest/depplugins/rebar.config1
-rw-r--r--inttest/depplugins/rebar_testplugin.config1
-rw-r--r--inttest/depplugins/testplugin_mod.erl9
-rw-r--r--inttest/erlc/asn1/SIMPLE-ASN.asn17
-rw-r--r--inttest/erlc/erlc_rt.erl98
-rw-r--r--inttest/erlc/extra-include/foo_extra.hrl1
-rw-r--r--inttest/erlc/extra-src/foo_sup.erl13
-rw-r--r--inttest/erlc/include/foo_core.hrl1
-rw-r--r--inttest/erlc/mibs/SIMPLE-MIB.mib26
-rw-r--r--inttest/erlc/rebar-no_debug_info.config11
-rw-r--r--inttest/erlc/rebar.config10
-rw-r--r--inttest/erlc/src/behaviour/foo_worker.erl14
-rw-r--r--inttest/erlc/src/first_xrl.xrl13
-rw-r--r--inttest/erlc/src/first_yrl.yrl9
-rw-r--r--inttest/erlc/src/foo.erl35
-rw-r--r--inttest/erlc/src/foo_app.erl10
-rw-r--r--inttest/erlc/src/foo_test_worker.erl34
-rw-r--r--inttest/eunit/eunit_rt.erl48
-rw-r--r--inttest/eunit/eunit_src/bar.erl6
-rw-r--r--inttest/eunit/rebar-eunit_compile_opts.config1
-rw-r--r--inttest/eunit/src/foo.erl10
-rw-r--r--inttest/logging/logging_rt.erl99
-rw-r--r--inttest/rgen1/retest.config2
-rw-r--r--inttest/t_custom_config/t_custom_config_rt.erl2
-rw-r--r--inttest/tdeps1/tdeps1_rt.erl3
-rw-r--r--inttest/tdeps2/tdeps2_rt.erl3
-rw-r--r--inttest/tdeps_update/tdeps_update_rt.erl3
44 files changed, 621 insertions, 21 deletions
diff --git a/inttest/code_path_no_recurse/code_path_no_recurse_rt.erl b/inttest/code_path_no_recurse/code_path_no_recurse_rt.erl
new file mode 100644
index 0000000..d884bcc
--- /dev/null
+++ b/inttest/code_path_no_recurse/code_path_no_recurse_rt.erl
@@ -0,0 +1,19 @@
+-module(code_path_no_recurse_rt).
+-export([files/0,
+ run/1]).
+
+files() ->
+ [
+ {copy, "../../rebar", "rebar"},
+ {copy, "rebar.config", "rebar.config"},
+ {copy, "src", "src"},
+ {copy, "test", "test"},
+ {copy, "deps", "deps"}
+ ].
+
+run(_Dir) ->
+ retest:log(info, "Compile project~n"),
+ {ok, _} = retest:sh("./rebar -v compile"),
+ retest:log(info, "Run eunit with referenced deps on the code path~n"),
+ {ok, _} = retest:sh("./rebar -v eunit"),
+ ok.
diff --git a/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.app.src b/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.app.src
new file mode 100644
index 0000000..7f7b3f9
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.app.src
@@ -0,0 +1,12 @@
+{application, bazdep,
+ [
+ {description, ""},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {bazdep, []}},
+ {env, []}
+ ]}.
diff --git a/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.erl b/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.erl
new file mode 100644
index 0000000..aef4cf3
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/bazdep/src/bazdep.erl
@@ -0,0 +1,6 @@
+-module(bazdep).
+
+-export([bazdep/0]).
+
+bazdep() ->
+ bazdep.
diff --git a/inttest/code_path_no_recurse/deps/bazdep/test/bazdep_tests.erl b/inttest/code_path_no_recurse/deps/bazdep/test/bazdep_tests.erl
new file mode 100644
index 0000000..b5190f6
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/bazdep/test/bazdep_tests.erl
@@ -0,0 +1,5 @@
+-module(bazdep_tests).
+-include_lib("eunit/include/eunit.hrl").
+
+bazdep_test() ->
+ ?assert(bazdep:bazdep() =:= bazdep).
diff --git a/inttest/code_path_no_recurse/deps/foodep/rebar.config b/inttest/code_path_no_recurse/deps/foodep/rebar.config
new file mode 100644
index 0000000..cdaf168
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/foodep/rebar.config
@@ -0,0 +1 @@
+{deps, [{bazdep, "1"}]}.
diff --git a/inttest/code_path_no_recurse/deps/foodep/src/foodep.app.src b/inttest/code_path_no_recurse/deps/foodep/src/foodep.app.src
new file mode 100644
index 0000000..c0642fb
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/foodep/src/foodep.app.src
@@ -0,0 +1,12 @@
+{application, foodep,
+ [
+ {description, ""},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {foodep, []}},
+ {env, []}
+ ]}.
diff --git a/inttest/code_path_no_recurse/deps/foodep/src/foodep.erl b/inttest/code_path_no_recurse/deps/foodep/src/foodep.erl
new file mode 100644
index 0000000..3d43d0e
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/foodep/src/foodep.erl
@@ -0,0 +1,6 @@
+-module(foodep).
+
+-export([foodep/0]).
+
+foodep() ->
+ bazdep:bazdep() =:= bazdep.
diff --git a/inttest/code_path_no_recurse/deps/foodep/test/foodep_tests.erl b/inttest/code_path_no_recurse/deps/foodep/test/foodep_tests.erl
new file mode 100644
index 0000000..66d7b8b
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/foodep/test/foodep_tests.erl
@@ -0,0 +1,5 @@
+-module(foodep_tests).
+-include_lib("eunit/include/eunit.hrl").
+
+foodep_test() ->
+ ?assert(foodep:foodep()).
diff --git a/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.app.src b/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.app.src
new file mode 100644
index 0000000..d0bc233
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.app.src
@@ -0,0 +1,12 @@
+{application, unuseddep,
+ [
+ {description, ""},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {unuseddep, []}},
+ {env, []}
+ ]}.
diff --git a/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.erl b/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.erl
new file mode 100644
index 0000000..a990345
--- /dev/null
+++ b/inttest/code_path_no_recurse/deps/unuseddep/src/unuseddep.erl
@@ -0,0 +1,6 @@
+-module(unuseddep).
+
+-export([unuseddep/0]).
+
+unuseddep() ->
+ unuseddep.
diff --git a/inttest/code_path_no_recurse/rebar.config b/inttest/code_path_no_recurse/rebar.config
new file mode 100644
index 0000000..4b358de
--- /dev/null
+++ b/inttest/code_path_no_recurse/rebar.config
@@ -0,0 +1 @@
+{deps, [{foodep, "1"}]}.
diff --git a/inttest/code_path_no_recurse/src/codepath.app.src b/inttest/code_path_no_recurse/src/codepath.app.src
new file mode 100644
index 0000000..3aa200f
--- /dev/null
+++ b/inttest/code_path_no_recurse/src/codepath.app.src
@@ -0,0 +1,12 @@
+{application, codepath,
+ [
+ {description, ""},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {codepath, []}},
+ {env, []}
+ ]}.
diff --git a/inttest/code_path_no_recurse/src/codepath.erl b/inttest/code_path_no_recurse/src/codepath.erl
new file mode 100644
index 0000000..df4e6b0
--- /dev/null
+++ b/inttest/code_path_no_recurse/src/codepath.erl
@@ -0,0 +1,6 @@
+-module(codepath).
+
+-export([codepath/0]).
+
+codepath() ->
+ foodep:foodep().
diff --git a/inttest/code_path_no_recurse/test/codepath_tests.erl b/inttest/code_path_no_recurse/test/codepath_tests.erl
new file mode 100644
index 0000000..01a1d2a
--- /dev/null
+++ b/inttest/code_path_no_recurse/test/codepath_tests.erl
@@ -0,0 +1,12 @@
+-module(codepath_tests).
+-include_lib("eunit/include/eunit.hrl").
+
+codepath_test() ->
+ ?assertEqual({module, codepath}, code:ensure_loaded(codepath)),
+ ?assertEqual({module, foodep}, code:ensure_loaded(foodep)),
+ ?assertEqual({module, bazdep}, code:ensure_loaded(bazdep)),
+ ?assert(codepath:codepath()).
+
+unuseddep_test() ->
+ ?assertEqual(non_existing, code:which(unuseddep)),
+ ?assertEqual({error, nofile}, code:ensure_loaded(unuseddep)).
diff --git a/inttest/depplugins/base_dir_cwd_plugin.erl b/inttest/depplugins/base_dir_cwd_plugin.erl
new file mode 100644
index 0000000..4953b8b
--- /dev/null
+++ b/inttest/depplugins/base_dir_cwd_plugin.erl
@@ -0,0 +1,7 @@
+-module(base_dir_cwd_plugin).
+-export([pre_compile/2]).
+
+pre_compile(_, _) ->
+ File = "base_dir_cwd_pre.compile",
+ ok = file:write_file(File, <<"base_dir cwd pre_compile plugin">>),
+ rebar_log:log(info, "Wrote ~p/~s~n", [rebar_utils:get_cwd(), File]).
diff --git a/inttest/depplugins/dep_cwd_plugin.erl b/inttest/depplugins/dep_cwd_plugin.erl
new file mode 100644
index 0000000..fe1ceba
--- /dev/null
+++ b/inttest/depplugins/dep_cwd_plugin.erl
@@ -0,0 +1,7 @@
+-module(dep_cwd_plugin).
+-export([pre_compile/2]).
+
+pre_compile(_, _) ->
+ File = "dep_cwd_pre.compile",
+ ok = file:write_file(File, <<"dep cwd pre_compile plugin">>),
+ rebar_log:log(info, "Wrote ~p/~s~n", [rebar_utils:get_cwd(), File]).
diff --git a/inttest/depplugins/depplugins_rt.erl b/inttest/depplugins/depplugins_rt.erl
index 7b106eb..a45fa93 100644
--- a/inttest/depplugins/depplugins_rt.erl
+++ b/inttest/depplugins/depplugins_rt.erl
@@ -4,11 +4,14 @@
%%%
%%% It has three applications:
%%% <ol>
-%%% <li>fish. top-level module, has one dependency: `dependsonplugin'.</li>
-%%% <li>dependsonplugin. This depends on some pre-compile actions by the
-%%% plugin. In the test the plugin creates a file `pre.compile' in the
-%%% top-level folder of this application.</li>
-%%% <li>testplugin. This is a plugin application which creates the file.</li>
+%%% <li>fish. top-level app, has one dependency: `dependsonplugin'.
+%%% It also loads a plugin from CWD which creates
+%%% base_dir_cwd_pre.compile on pre_compile.</li>
+%%% <li>dependsonplugin, has one dependency: `testplugin' and loads
+%%% the testplugin_mod plugin.</li>
+%%% <li>testplugin. This is a plugin application which creates
+%%% plugin_pre.compile on pre_compile. It also loads a plugin from CWD
+%%% which creates dep_cwd_pre.compile on pre_compile.</li>
%%% </ol>
-module(depplugins_rt).
@@ -20,21 +23,37 @@ files() ->
[
{copy, "../../rebar", "rebar"},
{copy, "rebar.config", "rebar.config"},
+ {copy, "base_dir_cwd_plugin.erl", "base_dir_cwd_plugin.erl"},
{create, "ebin/fish.app", app(fish, [])},
- {create, "deps/dependsonplugin/ebin/dependsonplugin.app",
- app(dependsonplugin, [])},
{copy, "rebar_dependsonplugin.config",
- "deps/dependsonplugin/rebar.config"},
+ "deps/dependsonplugin/rebar.config"},
+ {create, "deps/dependsonplugin/ebin/dependsonplugin.app",
+ app(dependsonplugin, [])},
+
+ {copy, "rebar_testplugin.config", "deps/testplugin/rebar.config"},
{copy, "testplugin_mod.erl",
- "deps/testplugin/plugins/testplugin_mod.erl"},
- {create, "deps/testplugin/ebin/testplugin.app",
- app(testplugin, [])}
+ "deps/testplugin/plugins/testplugin_mod.erl"},
+ {copy, "dep_cwd_plugin.erl", "deps/testplugin/dep_cwd_plugin.erl"},
+ {create, "deps/testplugin/ebin/testplugin.app", app(testplugin, [])}
].
run(_Dir) ->
?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
- ?assertEqual(true, filelib:is_regular("deps/dependsonplugin/pre.compile")),
+
+ ?assertEqual(true, filelib:is_regular("base_dir_cwd_pre.compile")),
+
+ ?assertEqual(true, filelib:is_regular(
+ "deps/dependsonplugin/base_dir_cwd_pre.compile")),
+ ?assertEqual(true, filelib:is_regular(
+ "deps/dependsonplugin/plugin_pre.compile")),
+
+ ?assertEqual(true, filelib:is_regular(
+ "deps/testplugin/base_dir_cwd_pre.compile")),
+ ?assertEqual(true, filelib:is_regular(
+ "deps/testplugin/dep_cwd_pre.compile")),
+ ?assertEqual(true, filelib:is_regular(
+ "deps/testplugin/plugin_pre.compile")),
ok.
%%
diff --git a/inttest/depplugins/rebar.config b/inttest/depplugins/rebar.config
index 3a2e34e..86fb037 100644
--- a/inttest/depplugins/rebar.config
+++ b/inttest/depplugins/rebar.config
@@ -1 +1,2 @@
{deps, [dependsonplugin]}.
+{plugins, [base_dir_cwd_plugin]}.
diff --git a/inttest/depplugins/rebar_testplugin.config b/inttest/depplugins/rebar_testplugin.config
new file mode 100644
index 0000000..58a1f99
--- /dev/null
+++ b/inttest/depplugins/rebar_testplugin.config
@@ -0,0 +1 @@
+{plugins, [dep_cwd_plugin]}.
diff --git a/inttest/depplugins/testplugin_mod.erl b/inttest/depplugins/testplugin_mod.erl
index 055bbc7..d829ff0 100644
--- a/inttest/depplugins/testplugin_mod.erl
+++ b/inttest/depplugins/testplugin_mod.erl
@@ -1,6 +1,7 @@
-module(testplugin_mod).
--compile(export_all).
+-export([pre_compile/2]).
-pre_compile(Config, _) ->
- ok = file:write_file("pre.compile", <<"Yadda!">>),
- rebar_log:log(info, "Wrote ~p/pre.compile~n", [rebar_utils:get_cwd()]).
+pre_compile(_, _) ->
+ File = "plugin_pre.compile",
+ ok = file:write_file(File, <<"Yadda!">>),
+ rebar_log:log(info, "Wrote ~p/~s~n", [rebar_utils:get_cwd(), File]).
diff --git a/inttest/erlc/asn1/SIMPLE-ASN.asn1 b/inttest/erlc/asn1/SIMPLE-ASN.asn1
new file mode 100644
index 0000000..62f0860
--- /dev/null
+++ b/inttest/erlc/asn1/SIMPLE-ASN.asn1
@@ -0,0 +1,7 @@
+SIMPLE-ASN DEFINITIONS ::= BEGIN
+
+ SimpleMessage ::= SEQUENCE {
+ id INTEGER
+ }
+
+END
diff --git a/inttest/erlc/erlc_rt.erl b/inttest/erlc/erlc_rt.erl
new file mode 100644
index 0000000..354ad29
--- /dev/null
+++ b/inttest/erlc/erlc_rt.erl
@@ -0,0 +1,98 @@
+-module(erlc_rt).
+-export([files/0,
+ run/1]).
+
+-include_lib("eunit/include/eunit.hrl").
+
+-define(MODULES,
+ [first_xrl,
+ first_yrl,
+ foo,
+ foo_app,
+ foo_sup,
+ foo_test_worker,
+ foo_worker,
+ 'SIMPLE-ASN']).
+
+-define(BEAM_FILES,
+ ["first_xrl.beam",
+ "first_yrl.beam",
+ "foo.beam",
+ "foo_app.beam",
+ "foo_sup.beam",
+ "foo_test_worker.beam",
+ "foo_worker.beam",
+ "SIMPLE-ASN.beam"]).
+
+files() ->
+ [
+ {copy, "../../rebar", "rebar"},
+ {copy, "rebar.config", "rebar.config"},
+ {copy, "rebar-no_debug_info.config", "rebar-no_debug_info.config"},
+ {copy, "include", "include"},
+ {copy, "extra-include", "extra-include"},
+ {copy, "src", "src"},
+ {copy, "extra-src", "extra-src"},
+ {copy, "mibs", "mibs"},
+ {copy, "asn1", "asn1"},
+ {create, "ebin/foo.app", app(foo, ?MODULES)}
+ ].
+
+run(_Dir) ->
+ ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
+ ok = check_beams(true),
+ ok = check_debug_info(true),
+ MibResult = filename:join(["priv", "mibs", "SIMPLE-MIB.bin"]),
+ ?assertMatch(true, filelib:is_regular(MibResult)),
+ ?assertMatch({ok, _}, retest_sh:run("./rebar clean", [])),
+ ok = check_beams(false),
+ ?assertMatch(false, filelib:is_regular(MibResult)),
+ ?assertMatch(
+ {ok, _},
+ retest_sh:run("./rebar -C rebar-no_debug_info.config compile", [])),
+ ok = check_beams(true),
+ ok = check_debug_info(false),
+ ?assertMatch(true, filelib:is_regular(MibResult)),
+ ok.
+
+check_beams(Exist) ->
+ check_files(Exist, fun filelib:is_regular/1).
+
+check_debug_info(HasDebugInfo) ->
+ check_files(HasDebugInfo, fun has_debug_info/1).
+
+check_files(Expected, Check) ->
+ lists:foreach(
+ fun(F) ->
+ File = filename:join("ebin", F),
+ ?assertEqual(Expected, Check(File))
+ end,
+ ?BEAM_FILES).
+
+%% NOTE: Copied from dialyzer_utils:get_abstract_code_from_beam/1 and
+%% modified for local use. We could have called the function directly,
+%% but dialyzer_utils is not an official API to rely on.
+has_debug_info(File) ->
+ case beam_lib:chunks(File, [abstract_code]) of
+ {ok, {_Mod, List}} ->
+ case lists:keyfind(abstract_code, 1, List) of
+ {abstract_code, {raw_abstract_v1, _Abstr}} ->
+ true;
+ _ ->
+ false
+ end;
+ _ ->
+ false
+ end.
+
+%%
+%% Generate the contents of a simple .app file
+%%
+app(Name, Modules) ->
+ App = {application, Name,
+ [{description, atom_to_list(Name)},
+ {vsn, "1"},
+ {modules, Modules},
+ {registered, []},
+ {applications, [kernel, stdlib]}]},
+ io_lib:format("~p.\n", [App]).
diff --git a/inttest/erlc/extra-include/foo_extra.hrl b/inttest/erlc/extra-include/foo_extra.hrl
new file mode 100644
index 0000000..228affa
--- /dev/null
+++ b/inttest/erlc/extra-include/foo_extra.hrl
@@ -0,0 +1 @@
+-define(FOO_EXTRA, foo_extra).
diff --git a/inttest/erlc/extra-src/foo_sup.erl b/inttest/erlc/extra-src/foo_sup.erl
new file mode 100644
index 0000000..a0f06b6
--- /dev/null
+++ b/inttest/erlc/extra-src/foo_sup.erl
@@ -0,0 +1,13 @@
+-module(foo_sup).
+
+-behavior(supervisor).
+
+-export([start_link/0,
+ init/1]).
+
+start_link() ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+init(_Args) ->
+ FooChild = {foo,{foo, start_link, []}, permanent, 5000, worker, [foo]},
+ {ok,{{one_for_all,1,1}, [FooChild]}}.
diff --git a/inttest/erlc/include/foo_core.hrl b/inttest/erlc/include/foo_core.hrl
new file mode 100644
index 0000000..2363140
--- /dev/null
+++ b/inttest/erlc/include/foo_core.hrl
@@ -0,0 +1 @@
+-define(FOO_CORE, foo_core).
diff --git a/inttest/erlc/mibs/SIMPLE-MIB.mib b/inttest/erlc/mibs/SIMPLE-MIB.mib
new file mode 100644
index 0000000..ca8735a
--- /dev/null
+++ b/inttest/erlc/mibs/SIMPLE-MIB.mib
@@ -0,0 +1,26 @@
+-- SIMPLE-MIB.
+-- This is just a simple MIB used for testing!
+--
+
+
+SIMPLE-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, enterprises
+ FROM SNMPv2-SMI;
+
+ericsson MODULE-IDENTITY
+ LAST-UPDATED
+ "201403060000Z"
+ ORGANIZATION
+ "rebar"
+ CONTACT-INFO
+ "rebar <rebar@example.com>
+ or
+ whoever is currently responsible for the SIMPLE
+ enterprise MIB tree branch (enterprises.999)."
+ DESCRIPTION
+ "This very small module is made available
+ for mib-compilation testing."
+ ::= { enterprises 999 }
+END
diff --git a/inttest/erlc/rebar-no_debug_info.config b/inttest/erlc/rebar-no_debug_info.config
new file mode 100644
index 0000000..1a7113a
--- /dev/null
+++ b/inttest/erlc/rebar-no_debug_info.config
@@ -0,0 +1,11 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 ft=erlang et
+{erl_first_files, ["first_xrl.erl", "first_yrl.erl"]}.
+
+{erl_opts,
+ [
+ no_debug_info,
+ {i, "extra-include"},
+ {src_dirs, ["src", "extra-src"]},
+ {platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'}
+ ]}.
diff --git a/inttest/erlc/rebar.config b/inttest/erlc/rebar.config
new file mode 100644
index 0000000..6a1082a
--- /dev/null
+++ b/inttest/erlc/rebar.config
@@ -0,0 +1,10 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 ft=erlang et
+{erl_first_files, ["first_xrl.erl", "first_yrl.erl"]}.
+
+{erl_opts,
+ [
+ {i, "extra-include"},
+ {src_dirs, ["src", "extra-src"]},
+ {platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'}
+ ]}.
diff --git a/inttest/erlc/src/behaviour/foo_worker.erl b/inttest/erlc/src/behaviour/foo_worker.erl
new file mode 100644
index 0000000..307c69a
--- /dev/null
+++ b/inttest/erlc/src/behaviour/foo_worker.erl
@@ -0,0 +1,14 @@
+-module(foo_worker).
+
+-ifdef(NO_CALLBACK_ATTRIBUTE).
+
+-export([behaviour_info/1]).
+
+behaviour_info(callbacks) -> [{status, 0}];
+behaviour_info(_) -> undefined.
+
+-else.
+
+-callback status() -> 'idle' | 'busy'.
+
+-endif.
diff --git a/inttest/erlc/src/first_xrl.xrl b/inttest/erlc/src/first_xrl.xrl
new file mode 100644
index 0000000..0de4c70
--- /dev/null
+++ b/inttest/erlc/src/first_xrl.xrl
@@ -0,0 +1,13 @@
+Definitions.
+
+D = [0-9]
+
+Rules.
+
+{D}+ :
+ {token,{integer,TokenLine,list_to_integer(TokenChars)}}.
+
+{D}+\.{D}+((E|e)(\+|\-)?{D}+)? :
+ {token,{float,TokenLine,list_to_float(TokenChars)}}.
+
+Erlang code.
diff --git a/inttest/erlc/src/first_yrl.yrl b/inttest/erlc/src/first_yrl.yrl
new file mode 100644
index 0000000..8ccdb0e
--- /dev/null
+++ b/inttest/erlc/src/first_yrl.yrl
@@ -0,0 +1,9 @@
+Nonterminals list elements element.
+Terminals atom '(' ')'.
+Rootsymbol list.
+list -> '(' ')'.
+list -> '(' elements ')'.
+elements -> element.
+elements -> element elements.
+element -> atom.
+element -> list.
diff --git a/inttest/erlc/src/foo.erl b/inttest/erlc/src/foo.erl
new file mode 100644
index 0000000..33e6cfc
--- /dev/null
+++ b/inttest/erlc/src/foo.erl
@@ -0,0 +1,35 @@
+-module(foo).
+
+-export([start_link/0,
+ start_link/1,
+ init/1,
+ terminate/2,
+ handle_info/2,
+ handle_call/3,
+ handle_cast/2,
+ code_change/3]).
+
+-behavior(gen_server).
+
+-include("foo_core.hrl").
+-include("foo_extra.hrl").
+-include_lib("kernel/include/file.hrl").
+
+-record(state, {node :: node()}).
+
+start_link() -> start_link(undefined).
+
+start_link(Args) ->
+ gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []).
+
+init(_Args) -> {ok, #state{node=node()}}.
+
+terminate(_Reason, _Data) -> ok.
+
+handle_info(_Info, State) -> {noreply, State}.
+
+handle_cast(_Msg, State) -> {noreply, State}.
+
+handle_call(_Msg, _From, State) -> {reply, ok, State}.
+
+code_change(_OldVsn, State, _Extra) -> {ok, State}.
diff --git a/inttest/erlc/src/foo_app.erl b/inttest/erlc/src/foo_app.erl
new file mode 100644
index 0000000..a3c7a96
--- /dev/null
+++ b/inttest/erlc/src/foo_app.erl
@@ -0,0 +1,10 @@
+-module(foo_app).
+
+-behaviour(application).
+
+-export([start/2,
+ stop/1]).
+
+start(_Type, _Args) -> foo_sup:start_link().
+
+stop(_State) -> ok.
diff --git a/inttest/erlc/src/foo_test_worker.erl b/inttest/erlc/src/foo_test_worker.erl
new file mode 100644
index 0000000..96ae932
--- /dev/null
+++ b/inttest/erlc/src/foo_test_worker.erl
@@ -0,0 +1,34 @@
+-module(foo_test_worker).
+
+-behaviour(gen_server).
+-behaviour(foo_worker).
+
+-export([start_link/0,
+ start_link/1,
+ init/1,
+ handle_call/3,
+ handle_cast/2,
+ handle_info/2,
+ terminate/2,
+ code_change/3,
+ status/0]).
+
+-include_lib("kernel/include/inet.hrl").
+
+start_link() -> start_link(undefined).
+
+start_link(Args) -> gen_server:start_link(?MODULE, Args, []).
+
+init([]) -> {ok, undefined}.
+
+handle_call(_Event, _From, State) -> {reply, ok, State}.
+
+handle_cast(_Event, State) -> {noreply, State}.
+
+handle_info(_Info, State) -> {noreply, State}.
+
+terminate(_Reason, _State) -> ok.
+
+code_change(_OldVsn, State, _Extra) -> {ok, State}.
+
+status() -> busy.
diff --git a/inttest/eunit/eunit_rt.erl b/inttest/eunit/eunit_rt.erl
new file mode 100644
index 0000000..47f3331
--- /dev/null
+++ b/inttest/eunit/eunit_rt.erl
@@ -0,0 +1,48 @@
+-module(eunit_rt).
+-export([files/0, run/1]).
+
+-include_lib("eunit/include/eunit.hrl").
+
+files() ->
+ [{create, "ebin/foo.app", app(foo)},
+ {copy, "../../rebar", "rebar"},
+ {copy, "src", "src"},
+ {copy, "eunit_src", "eunit_src"},
+ {copy,
+ "rebar-eunit_compile_opts.config",
+ "rebar-eunit_compile_opts.config"}].
+
+run(_Dir) ->
+ ifdef_test(),
+ eunit_compile_opts_test(),
+ ok.
+
+ifdef_test() ->
+ {ok, Output} = retest:sh("./rebar -v eunit"),
+ ?assert(check_output(Output, "foo_test")),
+ ?assertMatch({ok, _}, retest:sh("./rebar clean")).
+
+eunit_compile_opts_test() ->
+ {ok, Output} =
+ retest:sh("./rebar -v -C rebar-eunit_compile_opts.config eunit"),
+ ?assert(check_output(Output, "bar_test")),
+ ?assertMatch(
+ {ok, _},
+ retest:sh("./rebar -C rebar-eunit_compile_opts.config clean")).
+
+check_output(Output, Target) ->
+ lists:any(fun(Line) ->
+ string:str(Line, Target) > 0
+ end, Output).
+
+%%
+%% 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/eunit/eunit_src/bar.erl b/inttest/eunit/eunit_src/bar.erl
new file mode 100644
index 0000000..6a80dac
--- /dev/null
+++ b/inttest/eunit/eunit_src/bar.erl
@@ -0,0 +1,6 @@
+-module(bar).
+
+-include_lib("eunit/include/eunit.hrl").
+
+bar_test() ->
+ ?assert(true).
diff --git a/inttest/eunit/rebar-eunit_compile_opts.config b/inttest/eunit/rebar-eunit_compile_opts.config
new file mode 100644
index 0000000..13b2d94
--- /dev/null
+++ b/inttest/eunit/rebar-eunit_compile_opts.config
@@ -0,0 +1 @@
+{eunit_compile_opts, [{src_dirs, ["eunit_src"]}]}.
diff --git a/inttest/eunit/src/foo.erl b/inttest/eunit/src/foo.erl
new file mode 100644
index 0000000..a4c91ba
--- /dev/null
+++ b/inttest/eunit/src/foo.erl
@@ -0,0 +1,10 @@
+-module(foo).
+
+-ifdef(TEST).
+
+-include_lib("eunit/include/eunit.hrl").
+
+foo_test() ->
+ ?assert(true).
+
+-endif.
diff --git a/inttest/logging/logging_rt.erl b/inttest/logging/logging_rt.erl
new file mode 100644
index 0000000..2b8e54b
--- /dev/null
+++ b/inttest/logging/logging_rt.erl
@@ -0,0 +1,99 @@
+-module(logging_rt).
+-export([files/0,
+ run/1]).
+
+-define(APP_FILE, "ebin/logging.app").
+
+files() ->
+ [
+ {copy, "../../rebar", "rebar"},
+ {create, ?APP_FILE, app(invalid_name, [])}
+ ].
+
+run(_Dir) ->
+ SharedExpected = "==> logging_rt \\(compile\\)",
+ %% provoke ERROR due to an invalid app file
+ retest:log(info, "Check 'compile' failure output~n"),
+ ok = check_output("./rebar compile -q", should_fail,
+ [SharedExpected, "ERROR: "],
+ ["WARN: ", "INFO: ", "DEBUG: "]),
+ %% fix bad app file
+ ok = file:write_file(?APP_FILE, app(logging, [])),
+ retest:log(info, "Check 'compile' success output~n"),
+ ok = check_output("./rebar compile", should_succeed,
+ [SharedExpected],
+ ["ERROR: ", "WARN: ", "INFO: ", "DEBUG: "]),
+ retest:log(info, "Check 'compile -v' success output~n"),
+ ok = check_output("./rebar compile -v", should_succeed,
+ [SharedExpected],
+ ["ERROR: ", "INFO: ", "DEBUG: "]),
+ retest:log(info, "Check 'compile -vv' success output~n"),
+ ok = check_output("./rebar compile -vv", should_succeed,
+ [SharedExpected, "DEBUG: "],
+ ["ERROR: ", "INFO: "]),
+ ok.
+
+check_output(Cmd, FailureMode, Expected, Unexpected) ->
+ case {retest:sh(Cmd), FailureMode} of
+ {{error, _}=Error, should_succeed} ->
+ retest:log(error, "cmd '~s' failed:~n~p~n", [Cmd, Error]),
+ Error;
+ {{ok, Captured}, should_succeed} ->
+ Joined = string:join(Captured, "\n"),
+ check_output1(Cmd, Joined, Expected, Unexpected);
+ {{error, {stopped, {_Rc, Captured}}}, should_fail} ->
+ Joined = string:join(Captured, "\n"),
+ check_output1(Cmd, Joined, Expected, Unexpected)
+ end.
+
+check_output1(Cmd, Captured, Expected, Unexpected) ->
+ ReOpts = [{capture, all, list}],
+ ExMatches =
+ lists:zf(
+ fun(Pattern) ->
+ case re:run(Captured, Pattern, ReOpts) of
+ nomatch ->
+ retest:log(error,
+ "Expected pattern '~s' missing "
+ "in the following output:~n"
+ "=== BEGIN ===~n~s~n=== END ===~n",
+ [Pattern, Captured]),
+ {true, Pattern};
+ {match, _} ->
+ false
+ end
+ end, Expected),
+
+ UnExMatches =
+ lists:zf(
+ fun(Pattern) ->
+ case re:run(Captured, Pattern, ReOpts) of
+ nomatch ->
+ false;
+ {match, [Match]} ->
+ retest:log(
+ console,
+ "Unexpected output when running cmd '~s':~n~s~n",
+ [Cmd, Match]),
+ {true, Match}
+ end
+ end, Unexpected),
+
+ case {ExMatches, UnExMatches} of
+ {[], []} ->
+ ok;
+ _ ->
+ error
+ end.
+
+%%
+%% Generate the contents of a simple .app file
+%%
+app(Name, Modules) ->
+ App = {application, Name,
+ [{description, atom_to_list(Name)},
+ {vsn, "1"},
+ {modules, Modules},
+ {registered, []},
+ {applications, [kernel, stdlib]}]},
+ io_lib:format("~p.\n", [App]).
diff --git a/inttest/rgen1/retest.config b/inttest/rgen1/retest.config
index a04233c..b569f14 100644
--- a/inttest/rgen1/retest.config
+++ b/inttest/rgen1/retest.config
@@ -1 +1 @@
-{timeout, 60000}.
+{timeout, 120000}.
diff --git a/inttest/t_custom_config/t_custom_config_rt.erl b/inttest/t_custom_config/t_custom_config_rt.erl
index 864ce5e..b56eb1a 100644
--- a/inttest/t_custom_config/t_custom_config_rt.erl
+++ b/inttest/t_custom_config/t_custom_config_rt.erl
@@ -11,7 +11,7 @@ files() ->
run(Dir) ->
retest_log:log(debug, "Running in Dir: ~s~n", [Dir]),
- Ref = retest:sh("./rebar -C custom.config check-deps -vvv",
+ Ref = retest:sh("./rebar -C custom.config check-deps -vv",
[{async, true}]),
{ok, Captured} =
retest:sh_expect(Ref,
diff --git a/inttest/tdeps1/tdeps1_rt.erl b/inttest/tdeps1/tdeps1_rt.erl
index 3de1a2b..a72cc83 100644
--- a/inttest/tdeps1/tdeps1_rt.erl
+++ b/inttest/tdeps1/tdeps1_rt.erl
@@ -41,7 +41,8 @@ run(_Dir) ->
apply_cmds(GitCmds, [{dir, "repo/b"}]),
apply_cmds(GitCmds, [{dir, "repo/c"}]),
- {ok, _} = retest_sh:run("./rebar get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar get-deps", []),
+ {ok, _} = retest_sh:run("./rebar compile", []),
true = filelib:is_regular("ebin/a.beam"),
ok.
diff --git a/inttest/tdeps2/tdeps2_rt.erl b/inttest/tdeps2/tdeps2_rt.erl
index 987567e..22f0abe 100644
--- a/inttest/tdeps2/tdeps2_rt.erl
+++ b/inttest/tdeps2/tdeps2_rt.erl
@@ -49,7 +49,8 @@ run(_Dir) ->
ok = apply_cmds(GitCmds, [{dir, "repo/b"}]),
ok = apply_cmds(GitCmds, [{dir, "repo/c"}]),
- {ok, _} = retest_sh:run("./rebar -v get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar -v get-deps", []),
+ {ok, _} = retest_sh:run("./rebar -v compile", []),
ok.
%%
diff --git a/inttest/tdeps_update/tdeps_update_rt.erl b/inttest/tdeps_update/tdeps_update_rt.erl
index 81bb7ef..e182ae2 100644
--- a/inttest/tdeps_update/tdeps_update_rt.erl
+++ b/inttest/tdeps_update/tdeps_update_rt.erl
@@ -122,7 +122,8 @@ run(_Dir) ->
ok = apply_cmds(GitCmds++ECmds, [{dir, "repo/e"}]),
ok = apply_cmds(GitCmds++FCmds, [{dir, "repo/f"}]),
- {ok, _} = retest_sh:run("./rebar -v get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar -v get-deps", []),
+ {ok, _} = retest_sh:run("./rebar -v compile", []),
os:cmd("cp a2.rebar.config apps/a1/rebar.config"),
{ok, _} = retest_sh:run("./rebar -v update-deps", []),
{ok, _} = retest_sh:run("./rebar -v compile", []),