From db5e4ea154648387689a4bdb7c3f7bf67081aeb7 Mon Sep 17 00:00:00 2001
From: Patrik Nyblom <pan@erlang.org>
Date: Fri, 26 Nov 2010 14:59:43 +0100
Subject: Unload stray applications from application_SUITE before creating
 script

---
 lib/kernel/test/code_SUITE.erl | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

(limited to 'lib')

diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 0bf40a9bba..705717ff49 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -1339,18 +1339,6 @@ filter_app("safe",_) ->
 % OS_mon does not find it's port program when running cerl
 filter_app("os_mon",true) ->
     false;
-% The following apps may be loaded due to earlier test suites and shuld 
-% not be included
-filter_app("app0",_) ->
-    false;
-filter_app("app1",_) ->
-    false;
-filter_app("app2",_) ->
-    false;
-filter_app("group_leader",_) ->
-    false;
-filter_app("app_start_error",_) ->
-    false;
 % Other apps should be OK.
 filter_app(_,_) ->
     true.
@@ -1358,6 +1346,12 @@ create_big_script(Config,Local) ->
     ?line PrivDir = ?config(priv_dir, Config),
     ?line Name = filename:join(PrivDir,"full_script_test"),
     ?line InitialApplications=application:loaded_applications(),
+    %% Applications left loaded by the application suite, unload them!
+    ?line UnloadFix=[app0,app1,app2,group_leader,app_start_error],
+    ?line [application:unload(Leftover) || 
+	      Leftover <- UnloadFix,
+	      lists:keymember(Leftover,1,InitialApplications) ],
+    %% Now we should have only "real" applications...
     ?line [application:load(list_to_atom(Y)) || {match,[Y]} <- [ re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin",[{capture,[1],list}]) || X <- code:get_path()],filter_app(Y,Local)],
     ?line Apps = [ {N,V} || {N,_,V} <- application:loaded_applications()],
     ?line {ok,Fd} = file:open(Name ++ ".rel", write),
-- 
cgit v1.2.3