From 5167b60cfe076cf27368ad4a250e55e4507d42fa Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 7 Jun 2017 12:39:46 +0200 Subject: stdlib: Lookup src path in beam find and use source directive when searching for source file --- lib/stdlib/test/shell_SUITE.erl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/stdlib/test') diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index 99411bc8fd..5a929157d3 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -376,6 +376,9 @@ records(Config) when is_list(Config) -> [[state]] = scan(RR4), Test = filename:join(proplists:get_value(priv_dir, Config), "test.erl"), + BeamDir = filename:join(proplists:get_value(priv_dir, Config), "beam"), + BeamFile = filename:join(BeamDir, "test"), + ok = file:make_dir(BeamDir), Contents = <<"-module(test). -record(state, {bin :: binary(), reply = no, @@ -387,8 +390,10 @@ records(Config) when is_list(Config) -> -ifdef(test2). -record(test2, {g}). - -endif.">>, + -endif. + ">>, ok = file:write_file(Test, Contents), + {ok, test} = compile:file(Test, [{outdir, BeamDir}]), RR5 = "rr(\"" ++ Test ++ "\", '_', {d,test1}), rl([test1,test2]).", A1 = erl_anno:new(1), @@ -404,7 +409,11 @@ records(Config) when is_list(Config) -> Dir = filename:join(proplists:get_value(priv_dir, Config), "*.erl"), RR8 = "rp(rr(\"" ++ Dir ++ "\")).", [_,ok] = scan(RR8), + + {module, test} = code:load_abs(BeamFile), + [[state]] = scan(<<"rr(test).">>), file:delete(Test), + file:delete(BeamFile++".beam"), RR1000 = "begin rr(" ++ MS ++ ") end.", [_] = scan(RR1000), -- cgit v1.2.3