File 7651-asn1-Unconditionally-run-JER-tests.patch of Package erlang
From a18f05ebffee552611a43be4ffd12e44494785fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 22 Mar 2024 13:10:48 +0100
Subject: [PATCH] asn1: Unconditionally run JER tests
7e004ed7b002eb introduced the use of the `json` module for
the JER back-end, but it did not update test suite, which still
tested for the presence of the `jsx` JSON library.
While at it, also remove the installation of `jsx` from the
Dockerfile.
---
.github/dockerfiles/Dockerfile.ubuntu-base | 8 ++--
lib/asn1/test/asn1_SUITE.erl | 43 +++++-----------------
2 files changed, 13 insertions(+), 38 deletions(-)
diff --git a/.github/dockerfiles/Dockerfile.ubuntu-base b/.github/dockerfiles/Dockerfile.ubuntu-base
index 17c4826d4d..ea0170b26a 100644
--- a/.github/dockerfiles/Dockerfile.ubuntu-base
+++ b/.github/dockerfiles/Dockerfile.ubuntu-base
@@ -104,7 +104,7 @@ RUN export PATH="$(cat /home/${USER}/LATEST):${PATH}" && \
WORKDIR /buildroot/
-## Install test tools rebar3, proper and jsx
+## Install test tools rebar3 and proper
RUN export PATH="$(cat /home/${USER}/LATEST):${PATH}" && \
latest () { \
local VSN=$(curl -sL "https://api.github.com/repos/$1/tags" | jq -r ".[] | .name" | grep -E '^v?[0-9]' | sort -V | tail -1); \
@@ -113,10 +113,8 @@ RUN export PATH="$(cat /home/${USER}/LATEST):${PATH}" && \
latest erlang/rebar3 && ls -la && \
(tar xzf rebar3.tar.gz && cd rebar3-* && ./bootstrap && sudo cp rebar3 /usr/bin) && \
latest proper-testing/proper && \
- (tar xzf proper.tar.gz && mv proper-* proper && cd proper && make) && \
- latest talentdeficit/jsx && \
- (tar xzf jsx.tar.gz && mv jsx-* jsx && cd jsx && rebar3 compile)
+ (tar xzf proper.tar.gz && mv proper-* proper && cd proper && make)
-ENV ERL_LIBS=/buildroot/proper:/buildroot/jsx
+ENV ERL_LIBS=/buildroot/proper
ENTRYPOINT ["/buildroot/init.sh"]
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl
index 3b786b56c7..dd92a0b3d5 100644
--- a/lib/asn1/test/asn1_SUITE.erl
+++ b/lib/asn1/test/asn1_SUITE.erl
@@ -216,24 +216,8 @@ unload_modules(CaseDir) ->
%% Test runners
%%------------------------------------------------------------------------------
-have_jsonlib() ->
- case code:which(jsx) of
- non_existing -> false;
- _ -> true
- end.
-
test(Config, TestF) ->
- TestJer = case have_jsonlib() of
- true -> [jer, {ber, [ber,jer]}];
- false -> []
- end,
- test(Config, TestF, [per,
- uper,
- ber] ++ TestJer),
- case TestJer of
- [] -> {comment,"skipped JER"};
- _ -> ok
- end.
+ test(Config, TestF, [per, uper, ber, jer, {ber,[ber,jer]}]).
test(Config, TestF, Rules) ->
Fun = fun(C, R, O) ->
@@ -454,20 +438,13 @@ testExtensionDefault(Config, Rule, Opts) ->
end.
testMaps(Config) ->
- Jer = case have_jsonlib() of
- true -> [{jer,[maps,no_ok_wrapper]}];
- false -> []
- end,
- RulesAndOptions =
- [{ber,[maps,no_ok_wrapper]},
- {ber,[maps,der,no_ok_wrapper]},
- {per,[maps,no_ok_wrapper]},
- {uper,[maps,no_ok_wrapper]}] ++ Jer,
- test(Config, fun testMaps/3, RulesAndOptions),
- case Jer of
- [] -> {comment,"skipped JER"};
- _ -> ok
- end.
+ RulesAndOptions =
+ [{ber,[maps,no_ok_wrapper]},
+ {ber,[maps,der,no_ok_wrapper]},
+ {per,[maps,no_ok_wrapper]},
+ {uper,[maps,no_ok_wrapper]},
+ {jer,[maps,no_ok_wrapper]}],
+ test(Config, fun testMaps/3, RulesAndOptions).
testMaps(Config, Rule, Opts) ->
asn1_test_lib:compile_all(['Maps'], Config, [Rule|Opts]),
@@ -1155,8 +1132,8 @@ testContaining(Config) ->
testContaining(Config, Rule, Opts) ->
asn1_test_lib:compile("Containing", Config, [Rule|Opts]),
testContaining:containing(Rule),
- case {Rule,have_jsonlib()} of
- {per,true} ->
+ case Rule of
+ per ->
io:format("Testing with both per and jer...\n"),
asn1_test_lib:compile("Containing", Config, [jer,Rule|Opts]),
testContaining:containing(per_jer);
--
2.35.3