Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1337-asn1-Unload-generated-code-after-each-test...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1337-asn1-Unload-generated-code-after-each-test-case.patch of Package erlang
From fd1ea68fbe7b98b651aaf050f100aab136a5be80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Thu, 31 Aug 2023 10:51:52 +0200 Subject: [PATCH] asn1: Unload generated code after each test case On 32-bit systems, we sometimes run out of address space when running the asn1 test suite. Try mitigating that by unloading generated code after each test case. --- lib/asn1/test/asn1_SUITE.erl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 2a02f08a95..b45a62ceab 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -191,9 +191,26 @@ init_per_testcase(Func, Config) -> end_per_testcase(_Func, Config) -> CaseDir = proplists:get_value(case_dir, Config), + unload_modules(CaseDir), asn1_test_lib:rm_dirs([CaseDir]), code:del_path(CaseDir). +unload_modules(CaseDir) -> + F = fun(Name0, Acc) -> + Name1 = filename:rootname(filename:basename(Name0)), + Name = list_to_existing_atom(Name1), + [Name|Acc] + end, + Beams1 = lists:usort(filelib:fold_files(CaseDir, "[.]beam\$", true, F, [])), + Beams = [M || M <- Beams1, code:is_loaded(M) =/= false], + _ = [begin + code:purge(M), + code:delete(M), + code:purge(M), + io:format("Unloaded ~p", [M]) + end || M <- Beams], + ok. + %%------------------------------------------------------------------------------ %% Test runners %%------------------------------------------------------------------------------ -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor