From ef813930bfe6c6a9e313d676114e4343da686320 Mon Sep 17 00:00:00 2001 From: Per Andersson Date: Wed, 10 Jan 2024 15:30:37 +0100 Subject: [PATCH] Skip dhfile tests on broken OTP-26 releases Guessing that the fix will be released in the next OTP-26 point release, OTP 26.2.2. --- testsuite/dhfile_SUITE.erl | 49 ++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/testsuite/dhfile_SUITE.erl b/testsuite/dhfile_SUITE.erl index a1a21a82..85ad99a7 100644 --- a/testsuite/dhfile_SUITE.erl +++ b/testsuite/dhfile_SUITE.erl @@ -15,15 +15,50 @@ groups() -> [ ]. +%% Skip dhfile tests on broken OTP-26 releases. +%% Guessing that OTP-26.2.2+ will be fixed. +-define(OTP26_FIXED_DHFILE, <<"26.2.2">>). + +-ifdef(OTP_RELEASE). + -if(?OTP_RELEASE == 26). +otp26_broken_dhfile() -> + case otp_release_version("26") of + {ok, OtpVsn} + when OtpVsn =< ?OTP26_FIXED_DHFILE -> + true; + _ -> + false + end. + -else. +otp26_broken_dhfile() -> + false. + -endif. +-endif. + +otp_release_version(Rel) -> + try + {ok, _OtpVsn} = + file:read_file(filename:join([code:root_dir(), "releases", Rel, + "OTP_VERSION"])) + catch + error:{badmatch, _} -> + file:read_file(filename:join([code:root_dir(), "OTP_VERSION"])) + end. + %%==================================================================== init_per_suite(Config) -> - Id = "testsuite-server", - YConf = filename:join(?tempdir(?MODULE), "yaws.conf"), - application:load(yaws), - application:set_env(yaws, id, Id), - application:set_env(yaws, conf, YConf), - ok = yaws:start(), - [{yaws_id, Id}, {yaws_config, YConf} | Config]. + case otp26_broken_dhfile() of + true -> + {skip, otp26_broken_dhfile}; + false -> + Id = "testsuite-server", + YConf = filename:join(?tempdir(?MODULE), "yaws.conf"), + application:load(yaws), + application:set_env(yaws, id, Id), + application:set_env(yaws, conf, YConf), + ok = yaws:start(), + [{yaws_id, Id}, {yaws_config, YConf} | Config] + end. end_per_suite(_Config) -> ok = application:stop(yaws),