aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/escript_SUITE_data
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/stdlib/test/escript_SUITE_data
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/stdlib/test/escript_SUITE_data')
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/ebin/archive_script_dict.app12
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/priv/archive_script_dict.txt1
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl125
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl29
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl39
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/ebin/archive_script_dummy.app10
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl29
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl29
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl33
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl61
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl60
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/compile_error12
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/emulator_flags11
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/factorial11
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/factorial_compile12
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/factorial_compile_main13
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/factorial_epp17
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/factorial_warning13
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/filesize11
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/lint_error14
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/strange.name7
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/tail_rec25
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/test_script_name5
-rwxr-xr-xlib/stdlib/test/escript_SUITE_data/trap_exit6
24 files changed, 585 insertions, 0 deletions
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/ebin/archive_script_dict.app b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/ebin/archive_script_dict.app
new file mode 100644
index 0000000000..d703977a1d
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/ebin/archive_script_dict.app
@@ -0,0 +1,12 @@
+{application, archive_script_dict,
+ [{description, "archive_script_dict"},
+ {vsn, "0.1"},
+ {modules, [
+ archive_script_dict,
+ archive_script_dict_sup
+ ]},
+ {registered, [
+ archive_script_dict_sup
+ ]},
+ {applications, [kernel, stdlib]},
+ {mod, {archive_script_dict_app, [[]]}}]}.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/priv/archive_script_dict.txt b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/priv/archive_script_dict.txt
new file mode 100644
index 0000000000..8fa2c8c064
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/priv/archive_script_dict.txt
@@ -0,0 +1 @@
+Some private data...
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl
new file mode 100644
index 0000000000..a614817b04
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict.erl
@@ -0,0 +1,125 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dict).
+-behaviour(sys).
+
+%% Public
+-export([new/1, store/3, erase/2, find/2, foldl/3, erase/1]).
+
+%% Internal
+-export([init/3, loop/3]).
+
+%% supervisor callback
+-export([start_link/2]).
+
+%% sys callback functions
+-export([
+ system_continue/3,
+ system_terminate/4,
+ system_code_change/4
+ ]).
+
+-define(SUPERVISOR, archive_script_dict_sup).
+
+start_link(Name, Debug) ->
+ proc_lib:start_link(?MODULE, init, [self(), Name, Debug], infinity, []).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Client
+
+new(Name) ->
+ supervisor:start_child(?SUPERVISOR, [Name]).
+
+store(Pid, Key, Val) ->
+ call(Pid, {store, Key, Val}).
+
+erase(Pid, Key) ->
+ call(Pid, {erase, Key}).
+
+find(Pid, Key) ->
+ call(Pid, {find, Key}).
+
+foldl(Pid, Fun, Acc) ->
+ call(Pid, {foldl, Fun, Acc}).
+
+erase(Pid) ->
+ call(Pid, stop).
+
+call(Name, Msg) when is_atom(Name) ->
+ call(whereis(Name), Msg);
+call(Pid, Msg) when is_pid(Pid) ->
+ Ref = erlang:monitor(process, Pid),
+ Pid ! {self(), Ref, Msg},
+ receive
+ {Ref, Reply} ->
+ erlang:demonitor(Ref, [flush]),
+ Reply;
+ {'DOWN', Ref, _, _, Reason} ->
+ {error, Reason}
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Server
+
+init(Parent, Name, Debug) ->
+ register(Name, self()),
+ Dict = dict:new(),
+ proc_lib:init_ack(Parent, {ok, self()}),
+ loop(Dict, Parent, Debug).
+
+loop(Dict, Parent, Debug) ->
+ receive
+ {system, From, Msg} ->
+ sys:handle_system_msg(Msg, From, Parent, ?MODULE, Debug, Dict);
+ {ReplyTo, Ref, {store, Key, Val}} ->
+ Dict2 = dict:store(Key, Val, Dict),
+ ReplyTo ! {Ref, ok},
+ ?MODULE:loop(Dict2, Parent, Debug);
+ {ReplyTo, Ref, {erase, Key}} ->
+ Dict2 = dict:erase(Key, Dict),
+ ReplyTo ! {Ref, ok},
+ ?MODULE:loop(Dict2, Parent, Debug);
+ {ReplyTo, Ref, {find, Key}} ->
+ Res = dict:find(Key, Dict),
+ ReplyTo ! {Ref, Res},
+ ?MODULE:loop(Dict, Parent, Debug);
+ {ReplyTo, Ref, {foldl, Fun, Acc}} ->
+ Acc2 = dict:foldl(Fun, Acc, Dict),
+ ReplyTo ! {Ref, {ok, Acc2}},
+ ?MODULE:loop(Dict, Parent, Debug);
+ {ReplyTo, Ref, stop} ->
+ ReplyTo ! {Ref, ok},
+ exit(normal);
+ Msg ->
+ error_logger:format("~p got unexpected message: ~p\n",
+ [self(), Msg]),
+ ?MODULE:loop(Dict, Parent, Debug)
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% sys callbacks
+
+system_continue(Parent, Debug, Dict) ->
+ ?MODULE:loop(Dict, Parent, Debug).
+
+system_terminate(Reason, _Parent, _Debug, _Dict) ->
+ exit(Reason).
+
+system_code_change(Dict,_Module,_OldVsn,_Extra) ->
+ {ok, Dict}.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl
new file mode 100644
index 0000000000..09b22ea532
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_app.erl
@@ -0,0 +1,29 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dict_app).
+-behaviour(application).
+
+%% Public
+-export([start/2, stop/1]).
+
+start(_Type, Args) ->
+ archive_script_dict_sup:start_link(Args).
+
+stop(_State) ->
+ ok.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl
new file mode 100644
index 0000000000..9a6c088552
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dict/src/archive_script_dict_sup.erl
@@ -0,0 +1,39 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dict_sup).
+-behaviour(supervisor).
+
+%% Public
+-export([start_link/1]).
+
+%% Internal
+-export([init/1, start_simple_child/2]).
+
+-define(CHILD_MOD, archive_script_dict).
+
+start_link(Debug) ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, [Debug]).
+
+init([Debug]) ->
+ Flags = {simple_one_for_one, 0, 3600},
+ MFA = {?MODULE, start_simple_child, [Debug]},
+ {ok, {Flags, [{?MODULE, MFA, transient, timer:seconds(3), worker, [?CHILD_MOD]}]}}.
+
+start_simple_child(Debug, Name) ->
+ ?CHILD_MOD:start_link(Name, Debug).
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/ebin/archive_script_dummy.app b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/ebin/archive_script_dummy.app
new file mode 100644
index 0000000000..bbb071c19b
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/ebin/archive_script_dummy.app
@@ -0,0 +1,10 @@
+{application, archive_script_dummy,
+ [{description, "archive_script_dummy"},
+ {vsn, "0.1"},
+ {modules, [
+ archive_script_main,
+ archive_script_main2
+ ]},
+ {registered, []},
+ {applications, [kernel, stdlib, archive_script_dict]},
+ {mod, {archive_script_dummy_app, [[]]}}]}.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl
new file mode 100644
index 0000000000..7c19ebf82f
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy.erl
@@ -0,0 +1,29 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dummy).
+-behaviour(application).
+
+%% Public
+-export([start/2, stop/1]).
+
+start(_Type, Args) ->
+ archive_script_main_sup:start_link(Args).
+
+stop(_State) ->
+ ok.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl
new file mode 100644
index 0000000000..c0910d379e
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_app.erl
@@ -0,0 +1,29 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dummy_app).
+-behaviour(application).
+
+%% Public
+-export([start/2, stop/1]).
+
+start(_Type, Args) ->
+ archive_script_dummy_sup:start_link(Args).
+
+stop(_State) ->
+ ok.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl
new file mode 100644
index 0000000000..8dff5c9335
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_dummy/src/archive_script_dummy_sup.erl
@@ -0,0 +1,33 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_dummy_sup).
+-behaviour(supervisor).
+
+%% Public
+-export([start_link/1]).
+
+%% Internal
+-export([init/1]).
+
+start_link(Debug) ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, [Debug]).
+
+init([Debug]) ->
+ Flags = {one_for_one, 0, 3600},
+ {ok, {Flags, []}}.
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl
new file mode 100644
index 0000000000..d257744cd7
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main.erl
@@ -0,0 +1,61 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_main).
+-behaviour(escript).
+
+-export([main/1]).
+
+-define(DUMMY, archive_script_dummy).
+-define(DICT, archive_script_dict).
+
+main(MainArgs) ->
+ %% Some printouts
+ io:format("main:~p\n",[MainArgs]),
+ ErlArgs = init:get_arguments(),
+ io:format("dict:~p\n",[[E || E <- ErlArgs, element(1, E) =:= ?DICT]]),
+ io:format("dummy:~p\n",[[E || E <- ErlArgs, element(1, E) =:= ?DUMMY]]),
+
+ %% Start the applications
+ {error, {not_started, ?DICT}} = application:start(?DUMMY),
+ ok = application:start(?DICT),
+ ok = application:start(?DUMMY),
+
+ %% Access dict priv dir
+ PrivDir = code:priv_dir(?DICT),
+ PrivFile = filename:join([PrivDir, "archive_script_dict.txt"]),
+ case erl_prim_loader:get_file(PrivFile) of
+ {ok, Bin, _FullPath} ->
+ io:format("priv:~p\n", [{ok, Bin}]);
+ error ->
+ io:format("priv:~p\n", [{error, PrivFile}])
+ end,
+
+ %% Use the dict app
+ Tab = archive_script_main_tab,
+ Key = foo,
+ Val = bar,
+ {ok, _Pid} = ?DICT:new(Tab),
+ error = ?DICT:find(Tab, Key),
+ ok = ?DICT:store(Tab, Key, Val),
+ {ok, Val} = ?DICT:find(Tab, Key),
+ ok = ?DICT:erase(Tab, Key),
+ error = ?DICT:find(Tab, Key),
+ ok = ?DICT:erase(Tab),
+ ok.
+
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl
new file mode 100644
index 0000000000..de56579998
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script/archive_script_main2.erl
@@ -0,0 +1,60 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(archive_script_main2).
+-behaviour(escript).
+
+-export([main/1]).
+
+-define(DUMMY, archive_script_dummy).
+-define(DICT, archive_script_dict).
+
+main(MainArgs) ->
+ %% Some printouts
+ io:format("main2:~p\n",[MainArgs]),
+ ErlArgs = init:get_arguments(),
+ io:format("dict:~p\n",[[E || E <- ErlArgs, element(1, E) =:= ?DICT]]),
+ io:format("dummy:~p\n",[[E || E <- ErlArgs, element(1, E) =:= ?DUMMY]]),
+
+ %% Start the applications
+ {error, {not_started, ?DICT}} = application:start(archive_script_dummy),
+ ok = application:start(?DICT),
+ ok = application:start(?DUMMY),
+
+ %% Access dict priv dir
+ PrivDir = code:priv_dir(?DICT),
+ PrivFile = filename:join([PrivDir, "archive_script_dict.txt"]),
+ case erl_prim_loader:get_file(PrivFile) of
+ {ok, Bin, _FullPath} ->
+ io:format("priv:~p\n", [{ok, Bin}]);
+ error ->
+ io:format("priv:~p\n", [{error, PrivFile}])
+ end,
+
+ %% Use the dict app
+ Tab = archive_script_main_tab,
+ Key = foo,
+ Val = bar,
+ {ok, _Pid} = ?DICT:new(Tab),
+ error = ?DICT:find(Tab, Key),
+ ok = ?DICT:store(Tab, Key, Val),
+ {ok, Val} = ?DICT:find(Tab, Key),
+ ok = ?DICT:erase(Tab, Key),
+ error = ?DICT:find(Tab, Key),
+ ok = ?DICT:erase(Tab),
+ ok.
diff --git a/lib/stdlib/test/escript_SUITE_data/compile_error b/lib/stdlib/test/escript_SUITE_data/compile_error
new file mode 100755
index 0000000000..ae644a9af7
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/compile_error
@@ -0,0 +1,12 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+
+foo() ->
+ gurka ** nisse.
+
+
+blurf() blarf().
+
+
+
+
diff --git a/lib/stdlib/test/escript_SUITE_data/emulator_flags b/lib/stdlib/test/escript_SUITE_data/emulator_flags
new file mode 100755
index 0000000000..9e16818da5
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/emulator_flags
@@ -0,0 +1,11 @@
+#! /usr/bin/env escript
+%% -*- erlang -*-
+%%! -nostick -mnesia dir a/directory -mnesia debug verbose
+
+main(MainArgs) ->
+ io:format("main:~p\n",[MainArgs]),
+ ErlArgs = init:get_arguments(),
+ io:format("nostick:~p\n",[[E || E <- ErlArgs, element(1, E) =:= nostick]]),
+ io:format("mnesia:~p\n", [[E || E <- ErlArgs, element(1, E) =:= mnesia]]),
+ io:format("ERL_FLAGS=~p\n", [os:getenv("ERL_FLAGS")]),
+ io:format("unknown:~p\n",[[E || E <- ErlArgs, element(1, E) =:= unknown]]).
diff --git a/lib/stdlib/test/escript_SUITE_data/factorial b/lib/stdlib/test/escript_SUITE_data/factorial
new file mode 100755
index 0000000000..200e320e9a
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/factorial
@@ -0,0 +1,11 @@
+#!/usr/bin/env escript
+
+main([In]) ->
+ X = list_to_integer(In),
+ N = fac(X),
+ io:format("factorial ~w = ~w~n",[X, N]).
+
+fac(0) -> 1;
+fac(N) ->
+ N * fac(N-1).
+
diff --git a/lib/stdlib/test/escript_SUITE_data/factorial_compile b/lib/stdlib/test/escript_SUITE_data/factorial_compile
new file mode 100755
index 0000000000..c822808b90
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/factorial_compile
@@ -0,0 +1,12 @@
+#!/usr/bin/env escript
+-mode(compile).
+
+main([In]) ->
+ X = list_to_integer(In),
+ N = fac(X),
+ io:format("factorial ~w = ~w~n",[X, N]).
+
+fac(0) -> 1;
+fac(N) ->
+ N * fac(N-1).
+
diff --git a/lib/stdlib/test/escript_SUITE_data/factorial_compile_main b/lib/stdlib/test/escript_SUITE_data/factorial_compile_main
new file mode 100755
index 0000000000..a59bb105dc
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/factorial_compile_main
@@ -0,0 +1,13 @@
+#!/usr/bin/env escript
+-mode(compile).
+-export([main/1]).
+
+main([In]) ->
+ X = list_to_integer(In),
+ N = fac(X),
+ io:format("factorial ~w = ~w~n",[X, N]).
+
+fac(0) -> 1;
+fac(N) ->
+ N * fac(N-1).
+
diff --git a/lib/stdlib/test/escript_SUITE_data/factorial_epp b/lib/stdlib/test/escript_SUITE_data/factorial_epp
new file mode 100755
index 0000000000..dbdf974985
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/factorial_epp
@@ -0,0 +1,17 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+
+-module(factorial).
+-export([main/1]).
+
+-define(PREFIX, ?MODULE_STRING).
+
+main([In]) ->
+ X = list_to_integer(In),
+ N = fac(X),
+ io:format("~s ~w = ~w~n",[?PREFIX, X, N]).
+
+fac(0) -> 1;
+fac(N) ->
+ N * fac(N-1).
+
diff --git a/lib/stdlib/test/escript_SUITE_data/factorial_warning b/lib/stdlib/test/escript_SUITE_data/factorial_warning
new file mode 100755
index 0000000000..ef214e096a
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/factorial_warning
@@ -0,0 +1,13 @@
+#!/usr/bin/env escript
+
+main([In]) ->
+ X = list_to_integer(In),
+ N = fac(X),
+ io:format("factorial ~w = ~w~n",[X, N]).
+
+fac(0) -> 1;
+fac(N) ->
+ N * fac(N-1).
+
+bar() ->
+ ok.
diff --git a/lib/stdlib/test/escript_SUITE_data/filesize b/lib/stdlib/test/escript_SUITE_data/filesize
new file mode 100755
index 0000000000..fd211c55cd
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/filesize
@@ -0,0 +1,11 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+-include_lib("kernel/include/file.hrl").
+
+main([Filename]) ->
+ {ok,#file_info{size=Size}} = file:read_file_info(Filename),
+ io:format("~p\n", [Size]).
+
+%% Deliberate warning follows so that we can check that line numbers
+%% correct after an -include_lib directive.
+id(I) -> I.
diff --git a/lib/stdlib/test/escript_SUITE_data/lint_error b/lib/stdlib/test/escript_SUITE_data/lint_error
new file mode 100755
index 0000000000..7be6e59b1d
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/lint_error
@@ -0,0 +1,14 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+
+main([]) ->
+ ok.
+main(Args) ->
+ io:format("~p\n", [length(Args)]),
+ halt(ExitCode).
+
+
+
+
+
+
diff --git a/lib/stdlib/test/escript_SUITE_data/strange.name b/lib/stdlib/test/escript_SUITE_data/strange.name
new file mode 100755
index 0000000000..19ad8aa40a
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/strange.name
@@ -0,0 +1,7 @@
+#! /usr/bin/env escript
+%% -*- erlang -*-
+
+-mode(compile).
+
+main(MainArgs) ->
+ io:format("main:~p\n",[MainArgs]).
diff --git a/lib/stdlib/test/escript_SUITE_data/tail_rec b/lib/stdlib/test/escript_SUITE_data/tail_rec
new file mode 100755
index 0000000000..2ef64e1239
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/tail_rec
@@ -0,0 +1,25 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+-mode(interpret).
+
+tail_rec(PrevSize, N) ->
+ {_, Size} = process_info(self(), stack_size),
+ if
+ N =< 0 ->
+ ok;
+ PrevSize =:= undefined ->
+ tail_rec(Size, N - 1);
+ PrevSize =:= Size ->
+ tail_rec(Size, N - 1);
+ true ->
+ io:format("Not tail recursive (~p): Stack size ~p should be ~p\n",
+ [N, Size, PrevSize]),
+ tail_rec(Size, N - 1)
+ end.
+
+main([Repetitions]) ->
+ tail_rec(undefined, list_to_integer(Repetitions)),
+ io:format("ok\n", []);
+main(_) ->
+ io:format("Usage: ~s Repetitions\n", [escript:script_name()]),
+ init:stop(1).
diff --git a/lib/stdlib/test/escript_SUITE_data/test_script_name b/lib/stdlib/test/escript_SUITE_data/test_script_name
new file mode 100755
index 0000000000..c4a3d93646
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/test_script_name
@@ -0,0 +1,5 @@
+#!/usr/bin/env escript
+
+main(_) ->
+ io:format("~s\n", [escript:script_name()]).
+
diff --git a/lib/stdlib/test/escript_SUITE_data/trap_exit b/lib/stdlib/test/escript_SUITE_data/trap_exit
new file mode 100755
index 0000000000..81fcfa9d12
--- /dev/null
+++ b/lib/stdlib/test/escript_SUITE_data/trap_exit
@@ -0,0 +1,6 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+
+main(_) ->
+ {trap_exit,Bool} = process_info(self(), trap_exit),
+ io:format("~p\n", [Bool]).