File 3088-otp-Make-tests-pass-when-run-in-source-tree.patch of Package erlang
From 4ee58064ace3194376426073c8a9e5edcfbb5a90 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Tue, 21 Dec 2021 10:55:51 +0100
Subject: [PATCH 08/11] otp: Make tests pass when run in source tree
---
erts/emulator/test/port_SUITE.erl | 4 +---
lib/common_test/Makefile | 1 +
lib/dialyzer/test/dialyzer.spec | 6 +-----
lib/diameter/Makefile | 1 +
lib/ftp/test/ftp_SUITE.erl | 2 +-
lib/inets/test/httpc_SUITE.erl | 2 +-
lib/kernel/Makefile | 1 +
lib/kernel/test/Makefile | 1 +
lib/kernel/test/kernel.spec | 3 ---
lib/kernel/test/kernel_SUITE.erl | 14 +++++++++++++-
lib/kernel/test/kernel_smoke.spec | 3 ---
lib/kernel/test/pg_SUITE.erl | 13 ++++++++++++-
lib/kernel/test/socket_SUITE.erl | 3 ++-
lib/megaco/Makefile | 1 +
lib/reltool/Makefile | 1 +
lib/runtime_tools/test/Makefile | 1 +
.../test/system_information_SUITE.erl | 13 +++++++++++++
lib/sasl/Makefile | 1 +
lib/sasl/test/Makefile | 1 +
lib/sasl/test/sasl_SUITE.erl | 13 +++++++++++++
lib/stdlib/Makefile | 1 +
lib/stdlib/test/Makefile | 1 +
lib/stdlib/test/stdlib_SUITE.erl | 14 +++++++++++++-
lib/tools/Makefile | 1 +
lib/wx/Makefile | 2 ++
25 files changed, 84 insertions(+), 20 deletions(-)
diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl
index 8aae70494b..4a3ecef397 100644
--- a/erts/emulator/test/port_SUITE.erl
+++ b/erts/emulator/test/port_SUITE.erl
@@ -1299,9 +1299,7 @@ otp_3906(Config) when is_list(Config) ->
otp_3906(Config, OSName) ->
DataDir = filename:dirname(proplists:get_value(data_dir,Config)),
- {ok, Variables} = file:consult(
- filename:join([DataDir,"..","..",
- "test_server","variables"])),
+ {ok, Variables, _} = file:path_consult(code:get_path(),"variables"),
case lists:keysearch('CC', 1, Variables) of
{value,{'CC', CC}} ->
SuiteDir = filename:dirname(code:which(?MODULE)),
diff --git a/lib/common_test/Makefile b/lib/common_test/Makefile
index ea8506b34a..ca7baaa959 100644
--- a/lib/common_test/Makefile
+++ b/lib/common_test/Makefile
@@ -47,5 +47,6 @@ include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=compiler tools crypto runtime_tools syntax_tools ftp inets \
debugger sasl snmp ssh reltool observer xmerl
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/dialyzer/test/dialyzer.spec b/lib/dialyzer/test/dialyzer.spec
index 0ba5df5d1e..6551910461 100644
--- a/lib/dialyzer/test/dialyzer.spec
+++ b/lib/dialyzer/test/dialyzer.spec
@@ -1,5 +1 @@
-{alias, tests, "../dialyzer_test"}.
-
-{suites, tests, all}.
-
-{skip_cases, tests, small_SUITE, "Needs compiler in plt"}.
+{suites, "../dialyzer_test", all}.
diff --git a/lib/diameter/Makefile b/lib/diameter/Makefile
index 320e72ada1..fccbba7501 100644
--- a/lib/diameter/Makefile
+++ b/lib/diameter/Makefile
@@ -28,5 +28,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=ssl runtime_tools syntax_tools
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/ftp/test/ftp_SUITE.erl b/lib/ftp/test/ftp_SUITE.erl
index 71ddd667f4..3c9442a99f 100644
--- a/lib/ftp/test/ftp_SUITE.erl
+++ b/lib/ftp/test/ftp_SUITE.erl
@@ -862,7 +862,7 @@ recv_chunk_delay(Config0) when is_list(Config0) ->
delay_recv_chunk(Pid) ->
delay_recv_chunk(Pid, <<>>).
delay_recv_chunk(Pid, Acc) ->
- ct:pal("Received size ~p", [byte_size(Acc)]),
+ ct:log("Received size ~p", [byte_size(Acc)]),
case ftp:recv_chunk(Pid) of
ok ->
{ok, Acc};
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 77a56cf1b8..a02d1d9e96 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -2093,7 +2093,7 @@ receive_replys([ID|IDs]) ->
{http, {ID, {{_, 200, _}, [_|_], _}}} ->
receive_replys(IDs);
{http, {Other, {{_, 200, _}, [_|_], _}}} ->
- ct:pal({recived_canceld_id, Other})
+ ct:pal("~p",[{recived_canceld_id, Other}])
end.
diff --git a/lib/kernel/Makefile b/lib/kernel/Makefile
index a6c0253397..534b564c2c 100644
--- a/lib/kernel/Makefile
+++ b/lib/kernel/Makefile
@@ -36,5 +36,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=crypto
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile
index 31bdc5c8ee..020f34c68b 100644
--- a/lib/kernel/test/Makefile
+++ b/lib/kernel/test/Makefile
@@ -213,5 +213,6 @@ release_tests_spec: make_emakefile
$(EMAKEFILE) $(COVERFILE) "$(RELSYSDIR)"
chmod -R u+w "$(RELSYSDIR)"
@tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -)
+ $(INSTALL_DATA) $(ERL_TOP)/make/otp_version_tickets "$(RELSYSDIR)/kernel_SUITE_data"
release_docs_spec:
diff --git a/lib/kernel/test/kernel.spec b/lib/kernel/test/kernel.spec
index eaa17f3a59..fdf90c8ce2 100644
--- a/lib/kernel/test/kernel.spec
+++ b/lib/kernel/test/kernel.spec
@@ -1,5 +1,2 @@
-{config, "../test_server/ts.config"}.
-{config, "../test_server/ts.unix.config"}.
-
{suites,"../kernel_test", all}.
{skip_suites,"../kernel_test",[logger_stress_SUITE],"Benchmarks only"}.
diff --git a/lib/kernel/test/kernel_SUITE.erl b/lib/kernel/test/kernel_SUITE.erl
index 71fbc943e5..78e16e9dd3 100644
--- a/lib/kernel/test/kernel_SUITE.erl
+++ b/lib/kernel/test/kernel_SUITE.erl
@@ -55,7 +55,19 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-
+init_per_testcase(appup_test, Config) ->
+ %% We check if the test results were released using a version
+ %% of Erlang/OTP that was a tagged version or not. On a non-tagged
+ %% version this testcase most likely will fail.
+ case file:read_file(
+ filename:join(
+ proplists:get_value(data_dir,Config), "otp_version_tickets")) of
+ {ok,<<"DEVELOPMENT",_/binary>>} ->
+ {skip, "This is a development version, test might fail "
+ "because of incorrect version numbers"};
+ {ok,S} ->
+ Config
+ end;
init_per_testcase(_Case, Config) ->
Config.
end_per_testcase(_Case, _Config) ->
diff --git a/lib/kernel/test/kernel_smoke.spec b/lib/kernel/test/kernel_smoke.spec
index e5d8273c56..84be0a97bc 100644
--- a/lib/kernel/test/kernel_smoke.spec
+++ b/lib/kernel/test/kernel_smoke.spec
@@ -1,6 +1,3 @@
-{config, "../test_server/ts.config"}.
-{config, "../test_server/ts.unix.config"}.
-
{cases,"../kernel_test", inet_SUITE,[t_gethostbyaddr,t_gethostbyname,
t_gethostbyaddr_v6,t_gethostbyname_v6,t_gethostnative,getifaddrs]}.
{cases,"../kernel_test", inet_res_SUITE,[gethostbyaddr,gethostbyname,
diff --git a/lib/kernel/test/pg_SUITE.erl b/lib/kernel/test/pg_SUITE.erl
index 3a69e33bcf..e456918656 100644
--- a/lib/kernel/test/pg_SUITE.erl
+++ b/lib/kernel/test/pg_SUITE.erl
@@ -753,7 +753,18 @@ stop_node(Node, Socket) when Node =/= node() ->
true.
forever() ->
- fun() -> receive after infinity -> ok end end.
+ Parent = self(),
+ fun() ->
+ %% forever() is used both locally and on a remote node,
+ %% if used locally, we want to terminate when the
+ %% parent terminates in order to not leak process to
+ %% later test cases
+ Ref = monitor(process,Parent),
+ receive
+ {'DOWN',Ref,_,_,_} when node() =:= node(Parent) ->
+ ok
+ end
+ end.
-spec control(Scope :: atom()) -> {Port :: integer(), pid()}.
diff --git a/lib/kernel/test/socket_SUITE.erl b/lib/kernel/test/socket_SUITE.erl
index 83959c0153..b6fea47255 100644
--- a/lib/kernel/test/socket_SUITE.erl
+++ b/lib/kernel/test/socket_SUITE.erl
@@ -11302,7 +11302,8 @@ api_opt_simple_otp_options() ->
%% *** We are done ***
#{desc => "finish",
- cmd => fun(_) ->
+ cmd => fun(#{ dummy := Dummy }) ->
+ Dummy ! die,
{ok, normal}
end}
],
diff --git a/lib/megaco/Makefile b/lib/megaco/Makefile
index ebddcec5e7..5dc2955dd8 100644
--- a/lib/megaco/Makefile
+++ b/lib/megaco/Makefile
@@ -203,5 +203,6 @@ $(APP_TAR_FILE): $(APP_DIR)
(cd "$(APP_RELEASE_DIR)"; gtar zcf "$(subst $(space),\ ,$@)" $(DIR_NAME))
DIA_PLT_APPS=asn1 runtime_tools et debugger
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/reltool/Makefile b/lib/reltool/Makefile
index 94534ee2b7..50ac3b443e 100644
--- a/lib/reltool/Makefile
+++ b/lib/reltool/Makefile
@@ -37,5 +37,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=wx sasl
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/runtime_tools/test/Makefile b/lib/runtime_tools/test/Makefile
index e5a087f3ad..6b0763f263 100644
--- a/lib/runtime_tools/test/Makefile
+++ b/lib/runtime_tools/test/Makefile
@@ -65,5 +65,6 @@ release_tests_spec: make_emakefile
$(INSTALL_DATA) $(EMAKEFILE) runtime_tools.cover "$(RELSYSDIR)"
chmod -R u+w "$(RELSYSDIR)"
@tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -)
+ $(INSTALL_DATA) $(ERL_TOP)/make/otp_version_tickets "$(RELSYSDIR)/system_information_SUITE_data"
release_docs_spec:
diff --git a/lib/runtime_tools/test/system_information_SUITE.erl b/lib/runtime_tools/test/system_information_SUITE.erl
index a5a025a1cf..824b9bc5f0 100644
--- a/lib/runtime_tools/test/system_information_SUITE.erl
+++ b/lib/runtime_tools/test/system_information_SUITE.erl
@@ -182,6 +182,19 @@ end_per_group(_GroupName, _Config) ->
%% Note: This function is free to add any key/value pairs to the Config
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
+init_per_testcase(sanity_check, Config) ->
+ %% We check if the test results were released using a version
+ %% of Erlang/OTP that was a tagged version or not. On a non-tagged
+ %% version this testcase most likely will fail.
+ case file:read_file(
+ filename:join(
+ proplists:get_value(data_dir,Config), "otp_version_tickets")) of
+ {ok,<<"DEVELOPMENT",_/binary>>} ->
+ {skip, "This is a development version, test might fail "
+ "because of incorrect version numbers"};
+ {ok,S} ->
+ Config
+ end;
init_per_testcase(_TestCase, Config) ->
Config.
diff --git a/lib/sasl/Makefile b/lib/sasl/Makefile
index 4f32f0ec0c..4b04c1aee4 100644
--- a/lib/sasl/Makefile
+++ b/lib/sasl/Makefile
@@ -37,5 +37,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=tools
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/sasl/test/Makefile b/lib/sasl/test/Makefile
index 33b4bf1385..1ea70319bd 100644
--- a/lib/sasl/test/Makefile
+++ b/lib/sasl/test/Makefile
@@ -94,5 +94,6 @@ release_tests_spec: make_emakefile
$(INSTALL_DATA) sasl.spec sasl.cover $(EMAKEFILE) "$(RELSYSDIR)"
chmod -R u+w "$(RELSYSDIR)"
@tar cfh - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -)
+ $(INSTALL_DATA) $(ERL_TOP)/make/otp_version_tickets "$(RELSYSDIR)/sasl_SUITE_data"
release_docs_spec:
diff --git a/lib/sasl/test/sasl_SUITE.erl b/lib/sasl/test/sasl_SUITE.erl
index 429112d51b..bbebce83ae 100644
--- a/lib/sasl/test/sasl_SUITE.erl
+++ b/lib/sasl/test/sasl_SUITE.erl
@@ -60,6 +60,19 @@ end_per_group(_GroupName, Config) ->
Config.
+init_per_testcase(appup_test, Config) ->
+ %% We check if the test results were released using a version
+ %% of Erlang/OTP that was a tagged version or not. On a non-tagged
+ %% version this testcase most likely will fail.
+ case file:read_file(
+ filename:join(
+ proplists:get_value(data_dir,Config), "otp_version_tickets")) of
+ {ok,<<"DEVELOPMENT",_/binary>>} ->
+ {skip, "This is a development version, test might fail "
+ "because of incorrect version numbers"};
+ {ok,S} ->
+ Config
+ end;
init_per_testcase(_Case, Config) ->
Config.
end_per_testcase(_Case, _Config) ->
diff --git a/lib/stdlib/Makefile b/lib/stdlib/Makefile
index 45ca3f3b6a..7cdc0dd6ff 100644
--- a/lib/stdlib/Makefile
+++ b/lib/stdlib/Makefile
@@ -37,5 +37,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=compiler crypto
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile
index 3ac7b4d286..c3ec41d769 100644
--- a/lib/stdlib/test/Makefile
+++ b/lib/stdlib/test/Makefile
@@ -159,5 +159,6 @@ release_tests_spec: make_emakefile
$(ERL_FILES) $(COVERFILE) "$(RELSYSDIR)"
chmod -R u+w "$(RELSYSDIR)"
@tar cf - *_SUITE_data property_test | (cd "$(RELSYSDIR)"; tar xf -)
+ $(INSTALL_DATA) $(ERL_TOP)/make/otp_version_tickets "$(RELSYSDIR)/stdlib_SUITE_data"
release_docs_spec:
diff --git a/lib/stdlib/test/stdlib_SUITE.erl b/lib/stdlib/test/stdlib_SUITE.erl
index 7a7ca76ddb..938b6ba3e3 100644
--- a/lib/stdlib/test/stdlib_SUITE.erl
+++ b/lib/stdlib/test/stdlib_SUITE.erl
@@ -46,7 +46,19 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-
+init_per_testcase(appup_test, Config) ->
+ %% We check if the test results were released using a version
+ %% of Erlang/OTP that was a tagged version or not. On a non-tagged
+ %% version this testcase most likely will fail.
+ case file:read_file(
+ filename:join(
+ proplists:get_value(data_dir,Config), "otp_version_tickets")) of
+ {ok,<<"DEVELOPMENT",_/binary>>} ->
+ {skip, "This is a development version, test might fail "
+ "because of incorrect version numbers"};
+ {ok,S} ->
+ Config
+ end;
init_per_testcase(_Case, Config) ->
Config.
end_per_testcase(_Case, _Config) ->
diff --git a/lib/tools/Makefile b/lib/tools/Makefile
index b8625d8074..356256c54b 100644
--- a/lib/tools/Makefile
+++ b/lib/tools/Makefile
@@ -37,5 +37,6 @@ SPECIAL_TARGETS =
include $(ERL_TOP)/make/otp_subdir.mk
DIA_PLT_APPS=compiler runtime_tools
+TEST_NEEDS_RELEASE=true
include $(ERL_TOP)/make/app_targets.mk
diff --git a/lib/wx/Makefile b/lib/wx/Makefile
index a11feb22f8..561ae45789 100644
--- a/lib/wx/Makefile
+++ b/lib/wx/Makefile
@@ -40,4 +40,6 @@ SUB_DIRECTORIES=$(SUBDIRS)
include $(ERL_TOP)/make/otp_subdir.mk
+TEST_NEEDS_RELEASE=true
+
include $(ERL_TOP)/make/app_targets.mk
--
2.31.1