aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/c_SUITE.erl
diff options
context:
space:
mode:
authorAlex Suraci <[email protected]>2009-11-29 12:08:57 -0500
committerBjörn Gustavsson <[email protected]>2009-12-14 13:46:29 +0100
commitde623fd54ac9aec3d3260fb66698afd3709a2ba6 (patch)
tree0f158e48d2ce71ed1faab6f2044c00b36242c87c /lib/stdlib/test/c_SUITE.erl
parent0ad86bc3d062508f78142f2cc1a4756fece24c10 (diff)
downloadotp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.tar.gz
otp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.tar.bz2
otp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.zip
Fix c:nc to use outdir or cwd to find compiled object file
Before this patch, c:nc would naively assume the object file was created in the same location as the .erl file. This is often false, for example when an outdir is specified (often the case in make:all([netload])) or calling with c:nc("foo/bar") (because compile:file places bar.beam in the cwd, not foo/). [ Squashed in minor style changes. /bg ]
Diffstat (limited to 'lib/stdlib/test/c_SUITE.erl')
-rw-r--r--lib/stdlib/test/c_SUITE.erl57
1 files changed, 54 insertions, 3 deletions
diff --git a/lib/stdlib/test/c_SUITE.erl b/lib/stdlib/test/c_SUITE.erl
index 5608d73d19..a2c8102393 100644
--- a/lib/stdlib/test/c_SUITE.erl
+++ b/lib/stdlib/test/c_SUITE.erl
@@ -18,15 +18,16 @@
%%
-module(c_SUITE).
-export([all/1]).
--export([c_1/1, c_2/1, c_3/1, c_4/1, memory/1]).
+-export([c_1/1, c_2/1, c_3/1, c_4/1, nc_1/1, nc_2/1, nc_3/1, nc_4/1,
+ memory/1]).
-include("test_server.hrl").
--import(c, [c/2]).
+-import(c, [c/2, nc/2]).
all(doc) -> ["Test cases for the 'c' module."];
all(suite) ->
- [c_1, c_2, c_3, c_4, memory].
+ [c_1, c_2, c_3, c_4, nc_1, nc_2, nc_3, nc_4, memory].
%%% Write output to a directory other than current directory:
@@ -78,6 +79,56 @@ c_4(Config) when list(Config) ->
?line Result = c(R,[{outdir,W}]),
?line {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) ->
+ [];
+nc_1(Config) when 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) ->
+ [];
+nc_2(Config) when 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.
+
+
+%%% 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) ->
+ [];
+nc_3(Config) when 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) ->
+ [];
+nc_4(Config) when 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.
+
memory(doc) ->
["Checks that c:memory/[0,1] returns consistent results."];
memory(suite) ->