summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Toland <phil.toland@gmail.com>2015-12-01 12:39:12 -0600
committerPhil Toland <phil.toland@gmail.com>2015-12-01 12:39:12 -0600
commitafbf7295325ab4a99d4fea62d6f860002f1fee25 (patch)
tree045e108d172420e11ff7acf5079392f539241906
parentbe09be6d6bb005646e22d68ca8cc3a51fe4a1ab1 (diff)
Added tests and fixed a bug
-rw-r--r--src/rebar_erlc_compiler.erl2
-rw-r--r--test/rebar_compile_SUITE.erl14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 2cd66a5..c6eb2c1 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -526,7 +526,7 @@ compile_mib(Source, Target, Opts) ->
HrlFilename = Mib ++ ".hrl",
ok = filelib:ensure_dir(Target),
- ok = filelib:ensure_dir(filename:join([IncludeDir, HrlFilename])),
+ ok = filelib:ensure_dir(filename:join([IncludeDir, "dummy.hrl"])),
AllOpts = [{outdir, Dir}
,{i, [Dir]}] ++
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl
index 1c2c527..3e7e015 100644
--- a/test/rebar_compile_SUITE.erl
+++ b/test/rebar_compile_SUITE.erl
@@ -1018,11 +1018,14 @@ mib_test(Config) ->
rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], {ok, [{app, Name}]}),
- %% check a beam corresponding to the src in the extra src_dir exists in ebin
+ %% check a bin corresponding to the mib in the mibs dir exists in priv/mibs
PrivMibsDir = filename:join([AppDir, "_build", "default", "lib", Name, "priv", "mibs"]),
true = filelib:is_file(filename:join([PrivMibsDir, "SIMPLE-MIB.bin"])),
- %% check the extra src_dir was linked into the _build dir
+ %% check a hrl corresponding to the mib in the mibs dir exists in priv/mibs/include
+ true = filelib:is_file(filename:join([PrivMibsDir, "include", "SIMPLE-MIB.hrl"])),
+
+ %% check the mibs dir was linked into the _build dir
true = filelib:is_dir(filename:join([AppDir, "_build", "default", "lib", Name, "mibs"])).
umbrella_mib_first_test(Config) ->
@@ -1065,11 +1068,14 @@ umbrella_mib_first_test(Config) ->
rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], {ok, [{app, Name}]}),
- %% check a beam corresponding to the src in the extra src_dir exists in ebin
+ %% check a bin corresponding to the mib in the mibs dir exists in priv/mibs
PrivMibsDir = filename:join([AppsDir, "_build", "default", "lib", Name, "priv", "mibs"]),
true = filelib:is_file(filename:join([PrivMibsDir, "SIMPLE-MIB.bin"])),
- %% check the extra src_dir was linked into the _build dir
+ %% check a hrl corresponding to the mib in the mibs dir exists in priv/mibs/include
+ true = filelib:is_file(filename:join([PrivMibsDir, "include", "SIMPLE-MIB.hrl"])),
+
+ %% check the mibs dir was linked into the _build dir
true = filelib:is_dir(filename:join([AppsDir, "_build", "default", "lib", Name, "mibs"])).
only_default_transitive_deps(Config) ->