summaryrefslogtreecommitdiff
path: root/inttest/erlc
diff options
context:
space:
mode:
Diffstat (limited to 'inttest/erlc')
-rw-r--r--inttest/erlc/asn1/SIMPLE-ASN.asn17
-rw-r--r--inttest/erlc/erlc_rt.erl137
-rw-r--r--inttest/erlc/extra-include/foo_extra.hrl3
-rw-r--r--inttest/erlc/extra-src/foo_sup.erl15
-rw-r--r--inttest/erlc/foobar.erl8
-rw-r--r--inttest/erlc/include/foo_core.hrl3
-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.config13
-rw-r--r--inttest/erlc/src/._do_not_compile.erl4
-rw-r--r--inttest/erlc/src/behaviour/foo_worker.erl14
-rw-r--r--inttest/erlc/src/first_erl.erl10
-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
17 files changed, 0 insertions, 352 deletions
diff --git a/inttest/erlc/asn1/SIMPLE-ASN.asn1 b/inttest/erlc/asn1/SIMPLE-ASN.asn1
deleted file mode 100644
index 62f0860..0000000
--- a/inttest/erlc/asn1/SIMPLE-ASN.asn1
+++ /dev/null
@@ -1,7 +0,0 @@
-SIMPLE-ASN DEFINITIONS ::= BEGIN
-
- SimpleMessage ::= SEQUENCE {
- id INTEGER
- }
-
-END
diff --git a/inttest/erlc/erlc_rt.erl b/inttest/erlc/erlc_rt.erl
deleted file mode 100644
index 50cdb83..0000000
--- a/inttest/erlc/erlc_rt.erl
+++ /dev/null
@@ -1,137 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--module(erlc_rt).
--export([files/0,
- run/1]).
-
--include_lib("eunit/include/eunit.hrl").
-
--define(MODULES,
- [first_xrl,
- first_yrl,
- first_erl,
- foo,
- foo_app,
- foo_sup,
- foo_test_worker,
- foo_worker,
- 'SIMPLE-ASN']).
-
--define(BEAM_FILES,
- ["first_xrl.beam",
- "first_yrl.beam",
- "first_erl.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)},
- %% deps
- {create, "deps/foobar/ebin/foobar.app", app(foobar, [foobar])},
- {copy, "foobar.erl", "deps/foobar/src/foobar.erl"}
- ].
-
-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)),
- %% Regression test for https://github.com/rebar/rebar/issues/249
- %%
- %% Root cause: We didn't have per-project .rebar/erlcinfo but just one in
- %% <base_dir>/.rebar/erlcinfo.
- %%
- %% Solution: Ensure every project has its own .rebar/erlcinfo
- %%
- %% For the bug to happen, the following conditions must be met:
- %%
- %% 1. <base_dir>/rebar.config has erl_first_files
- %% 2. one of the 'first' files depends on another file (in this
- %% case via -include_lib())
- %% 3. a sub project's rebar.config, if any, has no erl_first_files entry
- %%
- %% Now because erl_first_files is retrieved via rebar_config:get_list/3,
- %% base_dir/rebar.config's erl_first_files is inherited, and because we had
- %% a shared <base_dir>/.rebar/erlcinfo instead of one per project, the
- %% cached entry was reused. Next, while compiling the sub project
- %% rebar_erlc_compiler:needs_compile/3 gets a last modification time of
- %% zero for the 'first' file which does not exist inside the sub project.
- %% This, and the fact that it has at least one dependency, makes
- %% needs_compile/3 return 'true'. The root cause is that we didn't have per
- %% project .rebar/erlcinfo. For <base_dir>/.rebar/erlcinfo to be populated,
- %% base_dir has to be compiled at least once. Therefore, after the first
- %% compile any compile processing the sub project will fail because
- %% needs_compile/3 will always return true for the non-existent 'first'
- %% file.
- ?assertMatch({ok, _}, retest_sh:run("./rebar clean", [])),
- ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
- ok = check_beams(true),
- ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
- ok = check_beams(true),
- 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
deleted file mode 100644
index 19e9f94..0000000
--- a/inttest/erlc/extra-include/foo_extra.hrl
+++ /dev/null
@@ -1,3 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--define(FOO_EXTRA, foo_extra).
diff --git a/inttest/erlc/extra-src/foo_sup.erl b/inttest/erlc/extra-src/foo_sup.erl
deleted file mode 100644
index c68194e..0000000
--- a/inttest/erlc/extra-src/foo_sup.erl
+++ /dev/null
@@ -1,15 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--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/foobar.erl b/inttest/erlc/foobar.erl
deleted file mode 100644
index b6d55a8..0000000
--- a/inttest/erlc/foobar.erl
+++ /dev/null
@@ -1,8 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--module(foobar).
-
--export([test/0]).
-
-test() ->
- true.
diff --git a/inttest/erlc/include/foo_core.hrl b/inttest/erlc/include/foo_core.hrl
deleted file mode 100644
index 803f2f0..0000000
--- a/inttest/erlc/include/foo_core.hrl
+++ /dev/null
@@ -1,3 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--define(FOO_CORE, foo_core).
diff --git a/inttest/erlc/mibs/SIMPLE-MIB.mib b/inttest/erlc/mibs/SIMPLE-MIB.mib
deleted file mode 100644
index ca8735a..0000000
--- a/inttest/erlc/mibs/SIMPLE-MIB.mib
+++ /dev/null
@@ -1,26 +0,0 @@
--- 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
deleted file mode 100644
index 07b6fed..0000000
--- a/inttest/erlc/rebar-no_debug_info.config
+++ /dev/null
@@ -1,11 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
-{erl_first_files, ["src/first_xrl.erl", "src/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
deleted file mode 100644
index 71d6660..0000000
--- a/inttest/erlc/rebar.config
+++ /dev/null
@@ -1,13 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
-{erl_first_files,
- ["src/first_xrl.erl", "src/first_yrl.erl", "src/first_erl.erl"]}.
-
-{deps, [foobar]}.
-
-{erl_opts,
- [
- {i, "extra-include"},
- {src_dirs, ["src", "extra-src"]},
- {platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'}
- ]}.
diff --git a/inttest/erlc/src/._do_not_compile.erl b/inttest/erlc/src/._do_not_compile.erl
deleted file mode 100644
index c9d743b..0000000
--- a/inttest/erlc/src/._do_not_compile.erl
+++ /dev/null
@@ -1,4 +0,0 @@
-syntax error
-this is file is here to verify that rebar does not try to
-compile files like OS X resource forks and should not be
-processed at all
diff --git a/inttest/erlc/src/behaviour/foo_worker.erl b/inttest/erlc/src/behaviour/foo_worker.erl
deleted file mode 100644
index 307c69a..0000000
--- a/inttest/erlc/src/behaviour/foo_worker.erl
+++ /dev/null
@@ -1,14 +0,0 @@
--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_erl.erl b/inttest/erlc/src/first_erl.erl
deleted file mode 100644
index 4e9ff20..0000000
--- a/inttest/erlc/src/first_erl.erl
+++ /dev/null
@@ -1,10 +0,0 @@
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 ft=erlang et
--module(first_erl).
-
--include_lib("eunit/include/eunit.hrl").
-
--export([test/0]).
-
-test() ->
- ?debugHere.
diff --git a/inttest/erlc/src/first_xrl.xrl b/inttest/erlc/src/first_xrl.xrl
deleted file mode 100644
index 0de4c70..0000000
--- a/inttest/erlc/src/first_xrl.xrl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index 8ccdb0e..0000000
--- a/inttest/erlc/src/first_yrl.yrl
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 33e6cfc..0000000
--- a/inttest/erlc/src/foo.erl
+++ /dev/null
@@ -1,35 +0,0 @@
--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
deleted file mode 100644
index a3c7a96..0000000
--- a/inttest/erlc/src/foo_app.erl
+++ /dev/null
@@ -1,10 +0,0 @@
--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
deleted file mode 100644
index 96ae932..0000000
--- a/inttest/erlc/src/foo_test_worker.erl
+++ /dev/null
@@ -1,34 +0,0 @@
--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.