diff options
author | Tomas Abrahamsson <tomas.abrahamsson@gmail.com> | 2021-04-14 22:14:50 +0200 |
---|---|---|
committer | Tomas Abrahamsson <tomas.abrahamsson@gmail.com> | 2021-04-28 23:45:34 +0200 |
commit | ce2c4ab42d0628c5be73a17972389a37053063b4 (patch) | |
tree | 552754e814d400faab1c4145b5afa903dde94c7b /lib/common_test/src/ct_run.erl | |
parent | dd36117cca61bfd2554bf7980b170f76bbf92278 (diff) | |
download | erlang-ce2c4ab42d0628c5be73a17972389a37053063b4.tar.gz |
common_test: Allow floats to -multiply_timetraps N
For the ct_run option -multiply_timetraps N, allow N to be a float
as well as previously an integer. This makes it possible to scale down
timetraps. This applies also to the associated test spec option.
Diffstat (limited to 'lib/common_test/src/ct_run.erl')
-rw-r--r-- | lib/common_test/src/ct_run.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 2704873276..a69267f5ea 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -237,7 +237,7 @@ script_start1(Parent, Args) -> [], Args), Verbosity = verbosity_args2opts(Args), MultTT = get_start_opt(multiply_timetraps, - fun([MT]) -> list_to_integer(MT) end, Args), + fun([MT]) -> list_to_number(MT) end, Args), ScaleTT = get_start_opt(scale_timetraps, fun([CT]) -> list_to_atom(CT); ([]) -> true @@ -3148,6 +3148,8 @@ opts2args(EnvStartOpts) -> [{Opt,[atom_to_list(A)]}]; ({Opt,I}) when is_integer(I) -> [{Opt,[integer_to_list(I)]}]; + ({Opt,I}) when is_float(I) -> + [{Opt,[float_to_list(I)]}]; ({Opt,S}) when is_list(S) -> [{Opt,[S]}]; (Opt) -> @@ -3263,6 +3265,11 @@ stop_trace(true) -> stop_trace(false) -> ok. +list_to_number(S) -> + try list_to_integer(S) + catch error:badarg -> list_to_float(S) + end. + ensure_atom(Atom) when is_atom(Atom) -> Atom; ensure_atom(String) when is_list(String), is_integer(hd(String)) -> |