aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-10-25 09:14:34 +0200
committerFredrik Gustafsson <[email protected]>2013-10-30 11:19:44 +0100
commitdc672094a5c926b1b4a656c13b688bb8c06f7a3b (patch)
treeb59397895d0cd2dc87ef7011fe7bdd4fbc7d2f1a /lib/tools
parent8062b794c04ad5ed9933caaaac509872823ab8d0 (diff)
downloadotp-dc672094a5c926b1b4a656c13b688bb8c06f7a3b.tar.gz
otp-dc672094a5c926b1b4a656c13b688bb8c06f7a3b.tar.bz2
otp-dc672094a5c926b1b4a656c13b688bb8c06f7a3b.zip
tools: Fix compile_beam_opts testcase
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/test/cover_SUITE.erl34
-rw-r--r--lib/tools/test/cover_SUITE_data/otp_11439/t.erl11
2 files changed, 22 insertions, 23 deletions
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index 7925a47d4f..29b26c7a76 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -1405,26 +1405,14 @@ compile_beam_opts(doc) ->
["Take compiler options from beam in cover:compile_beam"];
compile_beam_opts(suite) -> [];
compile_beam_opts(Config) when is_list(Config) ->
- ?line ok = file:set_cwd(?config(priv_dir, Config)),
- ?line IncDir = filename:join(?config(data_dir, Config),
+ {ok, Cwd} = file:get_cwd(),
+ ok = file:set_cwd(?config(priv_dir, Config)),
+ IncDir = filename:join(?config(data_dir, Config),
"included_functions"),
- File = "t.erl",
- Test = <<"-module(t).
- -export([exported/0]).
- -include(\"cover_inc.hrl\").
- -ifdef(BOOL).
- macro() ->
- ?MACRO.
- -endif.
- exported() ->
- ok.
- nonexported() ->
- ok.
- ">>,
- ?line ok = file:write_file(File, Test),
+ File = filename:join([?config(data_dir, Config), "otp_11439", "t.erl"]),
%% use all compiler options allowed by cover:filter_options
%% i and d don't make sense when compiling from beam though
- ?line {ok, t} =
+ {ok, t} =
compile:file(File, [{i, IncDir},
{d, 'BOOL'},
{d, 'MACRO', macro_defined},
@@ -1438,12 +1426,12 @@ compile_beam_opts(Config) when is_list(Config) ->
{nonexported,0},
{module_info,0},
{module_info,1}],
- ?line Exports = t:module_info(exports),
- ?line {ok, t} = cover:compile_beam("t"),
- ?line Exports = t:module_info(exports),
- ?line cover:stop(),
- ?line ok = file:delete(File),
-
+ Exports = t:module_info(exports),
+ {ok, t} = cover:compile_beam("t"),
+ Exports = t:module_info(exports),
+ cover:stop(),
+ ok = file:delete("t.beam"),
+ ok = file:set_cwd(Cwd),
ok.
%%--Auxiliary------------------------------------------------------------
diff --git a/lib/tools/test/cover_SUITE_data/otp_11439/t.erl b/lib/tools/test/cover_SUITE_data/otp_11439/t.erl
new file mode 100644
index 0000000000..d1eb9f16ee
--- /dev/null
+++ b/lib/tools/test/cover_SUITE_data/otp_11439/t.erl
@@ -0,0 +1,11 @@
+-module(t).
+-export([exported/0]).
+-include("cover_inc.hrl").
+-ifdef(BOOL).
+macro() ->
+ ?MACRO.
+-endif.
+exported() ->
+ ok.
+nonexported() ->
+ ok.