Skip to content

Commit 1d1c8a9

Browse files
authored
Merge pull request #114 from getong/test_erlang_21
Add OTP 21 support and CI coverage
2 parents e111c9c + a002358 commit 1d1c8a9

16 files changed

+42
-25
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ rel/example_project
1010
.concrete/DEV_MODE
1111
.rebar
1212
logs
13+
rebar3.crashdump

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
sudo: false
22
language: erlang
3-
script: "make ci"
3+
script:
4+
- wget -c https://github.com/erlang/rebar3/releases/download/3.6.2/rebar3
5+
- chmod +x rebar3
6+
- REBAR3=./rebar3 make ci
47
otp_release:
8+
- 21.1
59
- 20.3
610
- 20.2
711
- 20.1

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REBAR3=$(shell which rebar3 || echo ./rebar3)
1+
REBAR3 ?= rebar3
22

33
.PHONY: all clean clean_plt compile test doc dialyzer xref ci
44

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ processing is complete.
720720
[hex]: https://hex.pm/packages/exometer_core
721721
[hex version badge]: https://img.shields.io/hexpm/v/exometer_core.svg?style=flat-square
722722
[hex license badge]: https://img.shields.io/hexpm/l/exometer_core.svg?style=flat-square
723-
[erlang version badge]: https://img.shields.io/badge/erlang-18--20-blue.svg?style=flat-square
723+
[erlang version badge]: https://img.shields.io/badge/erlang-18--21-blue.svg?style=flat-square
724724
[build tool]: https://img.shields.io/badge/build%20tool-rebar3-orange.svg?style=flat-square
725725

726726

doc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ processing is complete.
720720
[hex]: https://hex.pm/packages/exometer_core
721721
[hex version badge]: https://img.shields.io/hexpm/v/exometer_core.svg?style=flat-square
722722
[hex license badge]: https://img.shields.io/hexpm/l/exometer_core.svg?style=flat-square
723-
[erlang version badge]: https://img.shields.io/badge/erlang-18--20-blue.svg?style=flat-square
723+
[erlang version badge]: https://img.shields.io/badge/erlang-18--21-blue.svg?style=flat-square
724724
[build tool]: https://img.shields.io/badge/build%20tool-rebar3-orange.svg?style=flat-square
725725

726726

doc/overview.edoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,5 +661,5 @@ processing is complete.
661661
[hex]: https://hex.pm/packages/exometer_core
662662
[hex version badge]: https://img.shields.io/hexpm/v/exometer_core.svg?style=flat-square
663663
[hex license badge]: https://img.shields.io/hexpm/l/exometer_core.svg?style=flat-square
664-
[erlang version badge]: https://img.shields.io/badge/erlang-18--20-blue.svg?style=flat-square
664+
[erlang version badge]: https://img.shields.io/badge/erlang-18--21-blue.svg?style=flat-square
665665
[build tool]: https://img.shields.io/badge/build%20tool-rebar3-orange.svg?style=flat-square

include/exometer.hrl

+8
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@
3636
-record(exometer_shared, {
3737
name
3838
}).
39+
40+
-ifdef(OTP_RELEASE). %% this implies 21 or higher
41+
-define(EXCEPTION(Class, Reason, Stacktrace), Class:Reason:Stacktrace).
42+
-define(GET_STACK(Stacktrace), Stacktrace).
43+
-else.
44+
-define(EXCEPTION(Class, Reason, _), Class:Reason).
45+
-define(GET_STACK(_), erlang:get_stacktrace()).
46+
-endif.

rebar.config

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
{deps,
1111
[
12-
{parse_trans, "3.2.0"},
13-
{folsom, "0.8.5"},
12+
{parse_trans, "3.3.0"},
13+
{folsom, "0.8.7"},
1414
{hut, "1.2.0"},
1515
{setup, "2.0.2"}
1616
]}.
1717

1818
{profiles,
1919
[
20-
{test, [{deps, [{meck, "0.8.9"}]}]},
20+
{test, [{deps, [{meck, "0.8.12"}]}]},
2121
{docs, [{deps, [{edown, "0.8.1"}]}]}
2222
]}.
2323

rebar.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{"1.1.0",
2-
[{<<"bear">>,{pkg,<<"bear">>,<<"0.8.5">>},1},
3-
{<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.5">>},0},
2+
[{<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},1},
3+
{<<"folsom">>,{pkg,<<"folsom">>,<<"0.8.7">>},0},
44
{<<"hut">>,{pkg,<<"hut">>,<<"1.2.0">>},0},
5-
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.2.0">>},0},
5+
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},0},
66
{<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},0}]}.
77
[
88
{pkg_hash,[
9-
{<<"bear">>, <<"E95FCA1627CD9E15BAF93CE0A52AFF16917BAF325F0EE65B88CD715376CD2344">>},
10-
{<<"folsom">>, <<"94A027B56FE84FEED264F9B33CB4C6AC9A801FAD84B87DBDA0836CE83C3B8D69">>},
9+
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
10+
{<<"folsom">>, <<"A885F0AEEE4C84270954C88A55A5A473D6B2C7493E32FFDC5765412DD555A951">>},
1111
{<<"hut">>, <<"0089DF0FAA2827C605BBADA88153F24FFF5EA7A4BE32ECF0250A7FDC2719CAFB">>},
12-
{<<"parse_trans">>, <<"2ADFA4DAF80C14DC36F522CF190EB5C4EE3E28008FC6394397C16F62A26258C2">>},
12+
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
1313
{<<"setup">>, <<"1203F4CDA11306C2E34434244576DED0A7BBFB0908D9A572356C809BD0CDF085">>}]}
1414
].

rebar3

-664 KB
Binary file not shown.

src/exometer_admin.erl

+4-4
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,18 @@ handle_call({new_entry, Name, Type, Opts, AllowExisting} = _Req, _From, S) ->
279279
Res = try exometer:create_entry(E1),
280280
exometer_report:new_entry(E1)
281281
catch
282-
error:Error1 ->
282+
?EXCEPTION(error, Error1, Stacktrace1) ->
283283
?log(debug,
284284
"ERROR create_entry(~p) :- ~p~n~p",
285-
[E1, Error1, erlang:get_stacktrace()]),
285+
[E1, Error1, ?GET_STACK(Stacktrace1)]),
286286
erlang:error(Error1)
287287
end,
288288
{reply, Res, S}
289289
end
290290
catch
291-
error:Error ->
291+
?EXCEPTION(error, Error, Stacktrace) ->
292292
?log(error, "~p -*-> error:~p~n~p~n",
293-
[_Req, Error, erlang:get_stacktrace()]),
293+
[_Req, Error, ?GET_STACK(Stacktrace)]),
294294
{reply, {error, Error}, S}
295295
end;
296296
handle_call({repair_entry, Name}, _From, S) ->

src/exometer_folsom_monitor.erl

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ monitor(FromMod, Callback) when is_atom(FromMod), is_atom(Callback) ->
6969

7070
%% @private
7171
hook(Args) ->
72-
Stack = try error(x) catch error:_ -> erlang:get_stacktrace() end,
72+
Stack = try error(x)
73+
catch
74+
?EXCEPTION(error, _, Stacktrace) ->
75+
?GET_STACK(Stacktrace)
76+
end,
7377
gen_server:cast(?MODULE, {hook, Args, Stack}).
7478

7579
%% @doc Start the server (called automatically by exometer).

src/exometer_report.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1554,9 +1554,9 @@ unsubscribe_(#subscriber{key = #key{reporter = Reporter,
15541554
report_values(Found, #key{reporter = Reporter, extra = Extra} = Key) ->
15551555
try Reporter ! {exometer_report, Found, Extra}
15561556
catch
1557-
error:Reason ->
1557+
?EXCEPTION(error, Reason, Stacktrace) ->
15581558
?log(error, "~p~nKey = ~p~nTrace: ~p",
1559-
[Reason, Key, erlang:get_stacktrace()])
1559+
[Reason, Key, ?GET_STACK(Stacktrace)])
15601560
end.
15611561

15621562
retrieve_metric({Metric, Type, Enabled}, Acc) ->

test/exometer_alias_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ init_per_suite(Config) ->
6767
end_per_suite(_Config) ->
6868
ok.
6969

70-
init_per_testcase(Case, Config) ->
70+
init_per_testcase(_Case, Config) ->
7171
{ok, StartedApps} = exometer_test_util:ensure_all_started(exometer_core),
7272
[{started_apps, StartedApps} | Config].
7373

test/exometer_report_SUITE.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ stop_started_apps(Config) ->
8888
test_newentry(Config) ->
8989
majority(fun test_newentry_/1, Config).
9090

91-
test_newentry_({cleanup, Config}) ->
91+
test_newentry_({cleanup, _Config}) ->
9292
restart_exometer_core();
9393
test_newentry_(Config) ->
9494
{ok, Info} = start_logger_and_reporter(test_udp, Config),
@@ -218,7 +218,7 @@ start_logger_and_reporter(Reporter, XArgs, Config) ->
218218

219219

220220
test_subscription_race_regression(Config) ->
221-
{ok, Info} = start_logger_and_reporter(brittle_reporter, Config),
221+
{ok, _Info} = start_logger_and_reporter(brittle_reporter, Config),
222222
ok = exometer:new([c,1], counter, []),
223223
exometer_report:subscribe(brittle_reporter, {find,[c,'_']}, value, main, true),
224224
LoggerPid = whereis(brittle_reporter),

test/exometer_test_udp_reporter.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ exometer_report(Metric, DataPoint, Extra, Value, #st{type_map = TypeMap,
6565
{value, Value}]}, St),
6666
{ok, St}.
6767

68-
exometer_report_bulk(Found, Extra, #st{} = St) ->
68+
exometer_report_bulk(Found, _Extra, #st{} = St) ->
6969
ok = send({report_bulk, Found}, St),
7070
{ok, St}.
7171

0 commit comments

Comments
 (0)