diff options
author | Maxim Fedorov <dane@whatsapp.com> | 2022-02-28 21:24:12 -0800 |
---|---|---|
committer | Maxim Fedorov <dane@whatsapp.com> | 2022-02-28 21:24:12 -0800 |
commit | 9070492df0fe193ef721e5c193111223dca2df89 (patch) | |
tree | 024c35de45de3f1b643f01c7e66e34e50e35e455 /erts | |
parent | 13f394e66a2930cb3a0737b09253b3f45a13e474 (diff) | |
download | erlang-9070492df0fe193ef721e5c193111223dca2df89.tar.gz |
time_SUITE: skip tz-specific tests when running out of Stockholm
These tests always fail when running in any timezone other
than Stockholm.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/time_SUITE.erl | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/erts/emulator/test/time_SUITE.erl b/erts/emulator/test/time_SUITE.erl index 36f67e086d..c5ad735688 100644 --- a/erts/emulator/test/time_SUITE.erl +++ b/erts/emulator/test/time_SUITE.erl @@ -130,9 +130,26 @@ local_to_univ_utc(Config) when is_list(Config) -> %% Tests conversion from universal to local time. +%% These cases are currently implemented only for MET and fail in +%% all other timezones +is_stockholm_time() -> + case os:type() of + {win32, _} -> case os:cmd("tzutil /g") of + "W. Europe Standard Time"++_ -> true; + _ -> false + end; + {unix, _} -> case os:cmd("date '+%Z'") of + "ME"++_ -> true; %% covers MET/MEST + "CE"++_ -> true; %% covers CET/CEST + _ -> false + end + end. univ_to_local(Config) when is_list(Config) -> - test_univ_to_local(test_data()). + case is_stockholm_time() of + true -> test_univ_to_local(test_data()); + false -> {skip, "This test is only valid for Stockholm timezone"} + end. test_univ_to_local([{Utc, Local}|Rest]) -> io:format("Testing ~p => ~p~n", [Local, Utc]), @@ -144,7 +161,10 @@ test_univ_to_local([]) -> %% Tests conversion from local to universal time. local_to_univ(Config) when is_list(Config) -> - test_local_to_univ(test_data()). + case is_stockholm_time() of + true -> test_local_to_univ(test_data()); + false -> {skip, "This test is only valid for Stockholm timezone"} + end. test_local_to_univ([{Utc, Local}|Rest]) -> io:format("Testing ~p => ~p~n", [Utc, Local]), |