diff options
author | Tom Davies <todavies5@gmail.com> | 2022-04-28 06:24:42 -0700 |
---|---|---|
committer | Tom Davies <tomdavies@fb.com> | 2022-05-06 09:28:12 -0700 |
commit | a22b140e4f456a0b872f3205e59f8f0d4ced7114 (patch) | |
tree | d38a8bbd05968a9e3a2caf9a1e04ac5fb9192703 /lib/compiler/test | |
parent | 8d87cd67aa8f987d3b2a8b1439c95a635ec17e33 (diff) | |
download | erlang-a22b140e4f456a0b872f3205e59f8f0d4ced7114.tar.gz |
compiler: Make test_lib robust to +deterministic
Makes test_lib avoid a crash if +deterministic is enabled to tests.
+deterministic strips the compilation options entirely, which test_lib
wasn't able to handle. Now, an empty list is returned in that case.
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/test_lib.erl | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl index 4f24310d15..39a887834c 100644 --- a/lib/compiler/test/test_lib.erl +++ b/lib/compiler/test/test_lib.erl @@ -82,32 +82,36 @@ uniq() -> opt_opts(Mod) -> Comp = Mod:module_info(compile), - {options,Opts} = lists:keyfind(options, 1, Comp), - lists:filter(fun - (debug_info) -> true; - (dialyzer) -> true; - ({feature,_,enable}) -> true; - ({feature,_,disable}) -> true; - (inline) -> true; - (no_bs_create_bin) -> true; - (no_bsm_opt) -> true; - (no_copt) -> true; - (no_fun_opt) -> true; - (no_init_yregs) -> true; - (no_make_fun3) -> true; - (no_module_opt) -> true; - (no_postopt) -> true; - (no_recv_opt) -> true; - (no_share_opt) -> true; - (no_shared_fun_wrappers) -> true; - (no_ssa_opt_float) -> true; - (no_ssa_opt_ranges) -> true; - (no_ssa_opt) -> true; - (no_stack_trimming) -> true; - (no_swap) -> true; - (no_type_opt) -> true; - (_) -> false - end, Opts). + case lists:keyfind(options, 1, Comp) of + {options,Opts} -> + lists:filter(fun + (debug_info) -> true; + (dialyzer) -> true; + (deterministic) -> true; + ({enable_feature,_}) -> true; + (inline) -> true; + (no_bs_create_bin) -> true; + (no_bsm_opt) -> true; + (no_copt) -> true; + (no_fun_opt) -> true; + (no_init_yregs) -> true; + (no_make_fun3) -> true; + (no_module_opt) -> true; + (no_postopt) -> true; + (no_recv_opt) -> true; + (no_share_opt) -> true; + (no_shared_fun_wrappers) -> true; + (no_ssa_opt_float) -> true; + (no_ssa_opt_ranges) -> true; + (no_ssa_opt) -> true; + (no_stack_trimming) -> true; + (no_swap) -> true; + (no_type_opt) -> true; + (_) -> false + end, Opts); + %% `options` may not be set at all if +deterministic is enabled + false -> [] + end. %% Some test suites gets cloned (e.g. to "record_SUITE" to %% "record_no_opt_SUITE"), but the data directory is not cloned. |