diff options
Diffstat (limited to 'lib/stdlib/test/c_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/c_SUITE.erl | 181 |
1 files changed, 77 insertions, 104 deletions
diff --git a/lib/stdlib/test/c_SUITE.erl b/lib/stdlib/test/c_SUITE.erl index 47dd95f86b..266918581b 100644 --- a/lib/stdlib/test/c_SUITE.erl +++ b/lib/stdlib/test/c_SUITE.erl @@ -50,144 +50,117 @@ end_per_group(_GroupName, Config) -> %%% Write output to a directory other than current directory: -c_1(doc) -> - ["Checks that c:c works also with option 'outdir' [ticket OTP-1209]."]; -c_1(suite) -> - []; +%% OTP-1209: Check that c:c/2 works also with option 'outdir'. c_1(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m.erl"), - ?line W = ?config(priv_dir, Config), - ?line Result = c(R,[{outdir,W}]), - ?line {ok, m} = Result. - -c_2(doc) -> - ["Checks that c:c works also with option 'outdir' [ticket OTP-1209]."]; -c_2(suite) -> - []; + R = filename:join(proplists:get_value(data_dir, Config), "m.erl"), + W = proplists:get_value(priv_dir, Config), + Result = c(R,[{outdir,W}]), + {ok, m} = Result. + +%% OTP-1209: Check that c:c/2 works also with option 'outdir'. c_2(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m"), - ?line W = ?config(priv_dir, Config), - ?line Result = c(R,[{outdir,W}]), - ?line {ok, m} = Result. + R = filename:join(proplists:get_value(data_dir, Config), "m"), + W = proplists:get_value(priv_dir, Config), + Result = c(R,[{outdir,W}]), + {ok, m} = Result. %%% Put results in current directory (or rather, change current dir %%% to the output dir): -c_3(doc) -> - ["Checks that c:c works also with option 'outdir' (same as current" - "directory). [ticket OTP-1209]."]; -c_3(suite) -> - []; +%% OTP-1209: Check that c:c/2 works also with option 'outdir' +%% (same as current directory). c_3(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m.erl"), - ?line W = ?config(priv_dir, Config), - ?line file:set_cwd(W), - ?line Result = c(R,[{outdir,W}]), - ?line {ok, m} = Result. - -c_4(doc) -> - ["Checks that c:c works also with option 'outdir' (same as current" - "directory). [ticket OTP-1209]."]; -c_4(suite) -> - []; + R = filename:join(proplists:get_value(data_dir, Config), "m.erl"), + W = proplists:get_value(priv_dir, Config), + file:set_cwd(W), + Result = c(R,[{outdir,W}]), + {ok, m} = Result. + +%% OTP-1209: Check that c:c/2 works also with option 'outdir' +%% (same as current directory). c_4(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m"), - ?line W = ?config(priv_dir, Config), - ?line file:set_cwd(W), - ?line Result = c(R,[{outdir,W}]), - ?line {ok, m} = Result. + R = filename:join(proplists:get_value(data_dir, Config), "m"), + W = proplists:get_value(priv_dir, Config), + file:set_cwd(W), + Result = c(R,[{outdir,W}]), + {ok, m} = Result. %%% Write output to a directory other than current directory: -nc_1(doc) -> - ["Checks that c:nc works also with option 'outdir'."]; -nc_1(suite) -> - []; +%% Check that c:nc/2 works also with option 'outdir'. nc_1(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m.erl"), - ?line W = ?config(priv_dir, Config), - ?line Result = nc(R,[{outdir,W}]), - ?line {ok, m} = Result. - -nc_2(doc) -> - ["Checks that c:nc works also with option 'outdir'."]; -nc_2(suite) -> - []; + R = filename:join(proplists:get_value(data_dir, Config), "m.erl"), + W = proplists:get_value(priv_dir, Config), + Result = nc(R,[{outdir,W}]), + {ok, m} = Result. + +%% Check that c:nc/2 works also with option 'outdir'. nc_2(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m"), - ?line W = ?config(priv_dir, Config), - ?line Result = nc(R,[{outdir,W}]), - ?line {ok, m} = Result. + R = filename:join(proplists:get_value(data_dir, Config), "m"), + W = proplists:get_value(priv_dir, Config), + Result = nc(R,[{outdir,W}]), + {ok, m} = Result. %%% Put results in current directory (or rather, change current dir %%% to the output dir): -nc_3(doc) -> - ["Checks that c:nc works also with option 'outdir' (same as current" - "directory)."]; -nc_3(suite) -> - []; +%% Check that c:nc/2 works also with option 'outdir' +%% (same as current directory). nc_3(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m.erl"), - ?line W = ?config(priv_dir, Config), - ?line file:set_cwd(W), - ?line Result = nc(R,[{outdir,W}]), - ?line {ok, m} = Result. - -nc_4(doc) -> - ["Checks that c:nc works also with option 'outdir' (same as current" - "directory)."]; -nc_4(suite) -> - []; + R = filename:join(proplists:get_value(data_dir, Config), "m.erl"), + W = proplists:get_value(priv_dir, Config), + file:set_cwd(W), + Result = nc(R,[{outdir,W}]), + {ok, m} = Result. + +%% Check that c:nc/2 works also with option 'outdir' +%% (same as current directory). nc_4(Config) when is_list(Config) -> - ?line R = filename:join(?config(data_dir, Config), "m"), - ?line W = ?config(priv_dir, Config), - ?line file:set_cwd(W), - ?line Result = nc(R,[{outdir,W}]), - ?line {ok, m} = Result. + R = filename:join(proplists:get_value(data_dir, Config), "m"), + W = proplists:get_value(priv_dir, Config), + file:set_cwd(W), + Result = nc(R,[{outdir,W}]), + {ok, m} = Result. ls(Config) when is_list(Config) -> - Directory = ?config(data_dir, Config), + Directory = proplists:get_value(data_dir, Config), ok = c:ls(Directory), File = filename:join(Directory, "m.erl"), ok = c:ls(File), ok = c:ls("no_such_file"). -memory(doc) -> - ["Checks that c:memory/[0,1] returns consistent results."]; -memory(suite) -> - []; +%% Check that c:memory/[0,1] returns consistent results. memory(Config) when is_list(Config) -> try - ?line ML = c:memory(), - ?line T = mget(total, ML), - ?line P = mget(processes, ML), - ?line S = mget(system, ML), - ?line A = mget(atom, ML), - ?line AU = mget(atom_used, ML), - ?line B = mget(binary, ML), - ?line C = mget(code, ML), - ?line E = mget(ets, ML), - ?line T = P + S, - ?line if S >= A + B + C + E -> ok end, - ?line if A >= AU -> ok end, - ?line ok + ML = c:memory(), + T = mget(total, ML), + P = mget(processes, ML), + S = mget(system, ML), + A = mget(atom, ML), + AU = mget(atom_used, ML), + B = mget(binary, ML), + C = mget(code, ML), + E = mget(ets, ML), + T = P + S, + if S >= A + B + C + E -> ok end, + if A >= AU -> ok end, + ok catch error:notsup -> - ?line {skipped, - "erlang:memory/[0,1] and c:memory/[0,1] not supported"} + {skipped, + "erlang:memory/[0,1] and c:memory/[0,1] not supported"} end. -% Help function for c_SUITE:memory/1 +%% Help function for c_SUITE:memory/1 mget(K, L) -> - ?line {value,{K,V}} = lists:keysearch(K, 1, L), - ?line test_v(c:memory(K)), % Check that c:memory/1 also accept this - % argument and returns an integer (usally - % *not* the same as V). - ?line test_v(V). + {value,{K,V}} = lists:keysearch(K, 1, L), + test_v(c:memory(K)), % Check that c:memory/1 also accept this + % argument and returns an integer (usally + % *not* the same as V). + test_v(V). -% Help function for c_SUITE:memory/1 +%% Help function for c_SUITE:memory/1 test_v(V) when is_integer(V) -> - ?line V. + V. |