diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-04-06 18:30:53 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-04-06 18:30:53 +0200 |
commit | 146dfa9ddc3b31649ef581d65f3cb00ef95af10f (patch) | |
tree | 8d104e6c9f51f26db19f10ed483dbca5566a289a /lib/tools/test/make_SUITE.erl | |
parent | 2ea950f70bb3c2bee32be7f98442df8d8d2f008a (diff) | |
download | otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.tar.gz otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.tar.bz2 otp-146dfa9ddc3b31649ef581d65f3cb00ef95af10f.zip |
Remove ?line macros
Diffstat (limited to 'lib/tools/test/make_SUITE.erl')
-rw-r--r-- | lib/tools/test/make_SUITE.erl | 195 |
1 files changed, 97 insertions, 98 deletions
diff --git a/lib/tools/test/make_SUITE.erl b/lib/tools/test/make_SUITE.erl index fdcc310df1..7580f77568 100644 --- a/lib/tools/test/make_SUITE.erl +++ b/lib/tools/test/make_SUITE.erl @@ -20,10 +20,10 @@ -module(make_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, make_all/1, make_files/1]). + init_per_group/2,end_per_group/2, make_all/1, make_files/1]). -export([otp_6057_init/1, - otp_6057_a/1, otp_6057_b/1, otp_6057_c/1, - otp_6057_end/1]). + otp_6057_a/1, otp_6057_b/1, otp_6057_c/1, + otp_6057_end/1]). -include_lib("common_test/include/ct.hrl"). @@ -44,7 +44,7 @@ all() -> groups() -> [{otp_6057,[],[otp_6057_a, otp_6057_b, - otp_6057_c]}]. + otp_6057_c]}]. init_per_suite(Config) -> Config. @@ -63,50 +63,50 @@ test_files() -> ["test1", "test2", "test3", "test4"]. make_all(suite) -> []; make_all(Config) when is_list(Config) -> - ?line Current = prepare_data_dir(Config), - ?line up_to_date = make:all(), - ?line ok = ensure_exists(test_files()), - ?line ok = ensure_exists(["test5"],".S"), % Emakefile: [{test5,['S']} - ?line file:set_cwd(Current), - ?line ensure_no_messages(), + Current = prepare_data_dir(Config), + up_to_date = make:all(), + ok = ensure_exists(test_files()), + ok = ensure_exists(["test5"],".S"), % Emakefile: [{test5,['S']} + file:set_cwd(Current), + ensure_no_messages(), ok. make_files(suite) -> []; make_files(Config) when is_list(Config) -> - ?line Current = prepare_data_dir(Config), + Current = prepare_data_dir(Config), %% Make files that exist. - ?line Files = [test1, test2], - ?line up_to_date = make:files(Files), % ok files - ?line ok = ensure_exists(Files), + Files = [test1, test2], + up_to_date = make:files(Files), % ok files + ok = ensure_exists(Files), - ?line error = make:files([test1,test7]), % non existing file - ?line up_to_date = make:files([test1,test2],[debug_info]), % with option + error = make:files([test1,test7]), % non existing file + up_to_date = make:files([test1,test2],[debug_info]), % with option - ?line file:set_cwd(Current), - ?line ensure_no_messages(), + file:set_cwd(Current), + ensure_no_messages(), ok. %% Moves to the data directory of this suite, clean it from any object %% files (*.jam for a JAM emulator). Returns the previous directory. prepare_data_dir(Config) -> - ?line {ok, Current} = file:get_cwd(), - ?line {value, {data_dir, Dir}} = lists:keysearch(data_dir, 1, Config), - ?line file:set_cwd(Dir), - ?line {ok, Files} = file:list_dir("."), - ?line delete_obj(Files, code:objfile_extension()), - ?line ensure_no_messages(), + {ok, Current} = file:get_cwd(), + {value, {data_dir, Dir}} = lists:keysearch(data_dir, 1, Config), + file:set_cwd(Dir), + {ok, Files} = file:list_dir("."), + delete_obj(Files, code:objfile_extension()), + ensure_no_messages(), Current. delete_obj([File|Rest], ObjExt) -> - ?line case filename:extension(File) of - ObjExt -> file:delete(File); - ".S" -> file:delete(File); - _ -> ok - end, - ?line delete_obj(Rest, ObjExt); + case filename:extension(File) of + ObjExt -> file:delete(File); + ".S" -> file:delete(File); + _ -> ok + end, + delete_obj(Rest, ObjExt); delete_obj([], _) -> ok. @@ -120,26 +120,26 @@ ensure_exists([Name|Rest], ObjExt) when is_atom(Name) -> ensure_exists([atom_to_list(Name)|Rest], ObjExt); ensure_exists([Name|Rest], ObjExt) -> case filelib:is_regular(Name++ObjExt) of - true -> - ensure_exists(Rest, ObjExt); - false -> - Name++ObjExt + true -> + ensure_exists(Rest, ObjExt); + false -> + Name++ObjExt end; ensure_exists([], _) -> ok. otp_6057_init(Config) when is_list(Config) -> - ?line DataDir = ?config(data_dir, Config), - ?line PrivDir = ?config(priv_dir, Config), + DataDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), %% Create the directories PrivDir/otp_6057/src1, /src2 and /ebin Src1 = filename:join([PrivDir, otp_6057, src1]), Src2 = filename:join([PrivDir, otp_6057, src2]), Ebin = filename:join([PrivDir, otp_6057, ebin]), - ?line ok = file:make_dir(filename:join(PrivDir, otp_6057)), - ?line ok = file:make_dir(Src1), - ?line ok = file:make_dir(Src2), - ?line ok = file:make_dir(Ebin), + ok = file:make_dir(filename:join(PrivDir, otp_6057)), + ok = file:make_dir(Src1), + ok = file:make_dir(Src2), + ok = file:make_dir(Ebin), %% Copy test1.erl and test2.erl to src1, and test3.erl to src2 Test1orig = filename:join(DataDir, "test1.erl"), @@ -148,19 +148,19 @@ otp_6057_init(Config) when is_list(Config) -> Test1 = filename:join(Src1, "test1.erl"), Test2 = filename:join(Src1, "test2.erl"), Test3 = filename:join(Src2, "test3.erl"), - ?line {ok, _} = file:copy(Test1orig, Test1), - ?line {ok, _} = file:copy(Test2orig, Test2), - ?line {ok, _} = file:copy(Test3orig, Test3), + {ok, _} = file:copy(Test1orig, Test1), + {ok, _} = file:copy(Test2orig, Test2), + {ok, _} = file:copy(Test3orig, Test3), %% Create an Emakefile in src1 Emakefile = filename:join(Src1, "Emakefile"), - ?line {ok, Fd} = file:open(Emakefile, write), - ?line ok = io:write(Fd, {["test1.erl","test2","../src2/test3"], - [{outdir,"../ebin"}]}), - ?line ok = io:fwrite(Fd, ".~n", []), - ?line ok = file:close(Fd), + {ok, Fd} = file:open(Emakefile, write), + ok = io:write(Fd, {["test1.erl","test2","../src2/test3"], + [{outdir,"../ebin"}]}), + ok = io:fwrite(Fd, ".~n", []), + ok = file:close(Fd), - ?line ensure_no_messages(), + ensure_no_messages(), Config. otp_6057_a(suite) -> @@ -168,15 +168,15 @@ otp_6057_a(suite) -> otp_6057_a(doc) -> ["Test that make:all/0, suite/0 looks for object file in correct place"]; otp_6057_a(Config) when is_list(Config) -> - ?line PrivDir = ?config(priv_dir, Config), + PrivDir = ?config(priv_dir, Config), %% Go to src1, saving old CWD - ?line {ok, CWD} = file:get_cwd(), + {ok, CWD} = file:get_cwd(), Src1 = filename:join([PrivDir, otp_6057, src1]), - ?line ok = file:set_cwd(Src1), + ok = file:set_cwd(Src1), %% Call make:all() - ?line up_to_date = make:all(), + up_to_date = make:all(), %% Ensure that all beam files are created in the ebin directory Ebin = filename:join([PrivDir, otp_6057, ebin]), @@ -184,34 +184,34 @@ otp_6057_a(Config) when is_list(Config) -> Test2 = filename:join(Ebin, test2), Test3 = filename:join(Ebin, test3), case ensure_exists([Test1, Test2, Test3]) of - ok -> ok; - Missing -> - ?line ?t:fail({"missing beam file", Missing}) + ok -> ok; + Missing -> + ?t:fail({"missing beam file", Missing}) end, %% Check creation date of test1.beam and make sure it is not %% recompiled if make:all() is called again. %% (Sleep a while, if the file is recompiled within a second then %% mtime will be the same). - ?line {ok, FileInfo1} = file:read_file_info(Test1++".beam"), + {ok, FileInfo1} = file:read_file_info(Test1++".beam"), Date1 = FileInfo1#file_info.mtime, ?t:sleep(?t:seconds(2)), - ?line up_to_date = make:all(), - ?line {ok, FileInfo2} = file:read_file_info(Test1++".beam"), + up_to_date = make:all(), + {ok, FileInfo2} = file:read_file_info(Test1++".beam"), case FileInfo2#file_info.mtime of - Date1 -> ok; - _Date2 -> - ?line ?t:fail({"recompiled beam file", Test1++".beam"}) + Date1 -> ok; + _Date2 -> + ?t:fail({"recompiled beam file", Test1++".beam"}) end, %% Remove the beam files - ?line ok = - ensure_removed([Test1++".beam",Test2++".beam",Test2++".beam"]), + ok = + ensure_removed([Test1++".beam",Test2++".beam",Test2++".beam"]), %% Return to original CWD - ?line ok = file:set_cwd(CWD), + ok = file:set_cwd(CWD), - ?line ensure_no_messages(), + ensure_no_messages(), ok. otp_6057_b(suite) -> @@ -219,35 +219,35 @@ otp_6057_b(suite) -> otp_6057_b(doc) -> ["Test that make:files/1 can handle a file in another directory"]; otp_6057_b(Config) when is_list(Config) -> - ?line PrivDir = ?config(priv_dir, Config), + PrivDir = ?config(priv_dir, Config), %% Go to src1, saving old CWD - ?line {ok, CWD} = file:get_cwd(), + {ok, CWD} = file:get_cwd(), Src1 = filename:join([PrivDir, otp_6057, src1]), - ?line ok = file:set_cwd(Src1), + ok = file:set_cwd(Src1), %% Ensure there is no beam file already Ebin = filename:join([PrivDir, otp_6057, ebin]), Test3 = filename:join(Ebin, "test3"), - ?line ok = ensure_removed([Test3++".beam"]), + ok = ensure_removed([Test3++".beam"]), %% Call make:files/1 - ?line up_to_date = make:files(["../src2/test3"]), - + up_to_date = make:files(["../src2/test3"]), + %% Ensure that the beam file is created in the ebin directory case ensure_exists([Test3]) of - ok -> ok; - Missing -> - ?line ?t:fail({"missing beam file", Missing}) + ok -> ok; + Missing -> + ?t:fail({"missing beam file", Missing}) end, %% Remove the beam file - ?line ok = ensure_removed([Test3++".beam"]), + ok = ensure_removed([Test3++".beam"]), %% Return to original CWD - ?line ok = file:set_cwd(CWD), + ok = file:set_cwd(CWD), - ?line ensure_no_messages(), + ensure_no_messages(), ok. otp_6057_c(suite) -> @@ -256,37 +256,37 @@ otp_6057_c(doc) -> ["Test that make:files/1 find options in Emakefile if a file is " "given with the .erl extension there"]; otp_6057_c(Config) when is_list(Config) -> - ?line PrivDir = ?config(priv_dir, Config), + PrivDir = ?config(priv_dir, Config), %% Go to src1, saving old CWD - ?line {ok, CWD} = file:get_cwd(), + {ok, CWD} = file:get_cwd(), Src1 = filename:join([PrivDir, otp_6057, src1]), - ?line ok = file:set_cwd(Src1), + ok = file:set_cwd(Src1), %% Ensure there are no beam files already Ebin = filename:join([PrivDir, otp_6057, ebin]), Test1 = filename:join(Ebin, "test1"), Test2 = filename:join(Ebin, "test2"), - ?line ok = ensure_removed([Test1++".beam",Test2++".beam"]), + ok = ensure_removed([Test1++".beam",Test2++".beam"]), %% Call make:files/1 - ?line up_to_date = make:files([test1, test2]), - + up_to_date = make:files([test1, test2]), + %% Ensure that the beam files are created in the ebin directory Ebin = filename:join([PrivDir, otp_6057, ebin]), case ensure_exists([Test1, Test2]) of - ok -> ok; - Missing -> - ?line ?t:fail({"missing beam file", Missing}) + ok -> ok; + Missing -> + ?t:fail({"missing beam file", Missing}) end, %% Remove the beam files - ?line ok = ensure_removed([Test1++".beam", Test2++".beam"]), + ok = ensure_removed([Test1++".beam", Test2++".beam"]), %% Return to original CWD - ?line ok = file:set_cwd(CWD), + ok = file:set_cwd(CWD), - ?line ensure_no_messages(), + ensure_no_messages(), ok. otp_6057_end(Config) when is_list(Config) -> @@ -303,13 +303,12 @@ ensure_no_messages() -> ensure_no_messages(N) -> receive - Any -> - io:format("Unexpected message: ~p", [Any]), - ensure_no_messages(N+1) + Any -> + io:format("Unexpected message: ~p", [Any]), + ensure_no_messages(N+1) after 0 -> - case N of - 0 -> ok; - N -> ?t:fail() - end + case N of + 0 -> ok; + N -> ?t:fail() + end end. - |