Browse Source

Ditch rebar 2, cleanup for OTP 23 (#182)

* Ditch rebar 2, cleanup for OTP 23

* rebar3 built with OTP 20

* Subtle backtrace change in OTP 23
Ulf Wiger 4 years ago
parent
commit
6f67c9bd28
13 changed files with 37 additions and 126 deletions
  1. 4 2
      .gitignore
  2. 4 8
      .travis.yml
  3. 8 11
      Makefile
  4. 0 2
      ebin/.gitignore
  5. 0 14
      eqc/gproc_eqc_tests.erl
  6. BIN
      rebar
  7. 17 6
      rebar.config
  8. BIN
      rebar3
  9. 0 79
      src/Makefile
  10. 1 0
      src/gproc.erl
  11. 2 2
      src/gproc_dist.erl
  12. 1 1
      test/gproc_pt_tests.erl
  13. 0 1
      test/gproc_tests.erl

+ 4 - 2
.gitignore

@@ -1,6 +1,8 @@
 current_counterexample.eqc
 current_counterexample.eqc
-deps/
-.eunit/
+_build
+.rebar3
+eqc/.eqc-info
+eqc/*.beam
 *~
 *~
 */*~
 */*~
 */#*#
 */#*#

+ 4 - 8
.travis.yml

@@ -1,11 +1,7 @@
 language: erlang
 language: erlang
 script: "GPROC_DIST=true rebar get-deps compile eunit"
 script: "GPROC_DIST=true rebar get-deps compile eunit"
 otp_release:
 otp_release:
-    - 20.0
-    - 19.3
-    - 19.0
-    - 18.3
-    - 18.2.1
-    - 18.2
-    - 18.1
-    - 18.0
+    - 23.0.3
+    - 22.3
+    - 21.3
+    - 20.3.8.22

+ 8 - 11
Makefile

@@ -19,32 +19,29 @@
 ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 ## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 ## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 ## DEALINGS IN THE SOFTWARE.
 ## DEALINGS IN THE SOFTWARE.
-REBAR=$(shell which rebar || echo ./rebar)
+REBAR3=$(shell which rebar3 || echo ./rebar3)
 
 
-.PHONY: all compile clean eunit test eqc doc check dialyzer
+.PHONY: all compile clean eunit test doc check dialyzer
 
 
 DIRS=src
 DIRS=src
 
 
-all: deps compile
+all: check test
 
 
 check: compile dialyzer
 check: compile dialyzer
 
 
 compile:
 compile:
-	$(REBAR) compile
-
-deps:
-	$(REBAR) get-deps
+	$(REBAR3) compile
 
 
 clean:
 clean:
-	$(REBAR) clean
+	$(REBAR3) clean
 
 
 eunit:
 eunit:
-	$(REBAR) eunit
+	$(REBAR3) eunit
 
 
 test: eunit
 test: eunit
 
 
 doc:
 doc:
-	$(REBAR) get-deps compile doc
+	$(REBAR3) doc
 
 
 dialyzer:
 dialyzer:
-	$(REBAR) skip_deps=true dialyze
+	$(REBAR3) dialyzer

+ 0 - 2
ebin/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 14
test/eqc/gproc_eqc_tests.erl → eqc/gproc_eqc_tests.erl

@@ -7,14 +7,8 @@
 
 
 -module(gproc_eqc_tests).
 -module(gproc_eqc_tests).
 
 
--ifdef(EQC).
-
 -include_lib("eqc/include/eqc.hrl").
 -include_lib("eqc/include/eqc.hrl").
 -include_lib("eqc/include/eqc_statem.hrl").
 -include_lib("eqc/include/eqc_statem.hrl").
--ifdef(TEST).
--include_lib("eunit/include/eunit.hrl").
--endif.
-
 -compile(export_all).
 -compile(export_all).
 
 
 %%
 %%
@@ -61,12 +55,6 @@
 good_number_of_tests() ->
 good_number_of_tests() ->
     3000.
     3000.
 
 
-%% hook to run from eunit. Note: a small number of tests.
-%% I recommend running at least 3000 to get to interesting stuff.
-%%
-gproc_test_() ->
-    {timeout, 60, [fun() -> run(100) end]}.
-
 %% When run from eunit, we need to set the group leader so that EQC
 %% When run from eunit, we need to set the group leader so that EQC
 %% reporting (the dots) are made visible - that is, if that's what we want.
 %% reporting (the dots) are made visible - that is, if that's what we want.
 verbose_run(N) ->
 verbose_run(N) ->
@@ -671,5 +659,3 @@ check_waiter(WPid, Pid, _Key, Value) ->
     after 1000 ->
     after 1000 ->
             erlang:error(timeout)
             erlang:error(timeout)
     end.
     end.
-
--endif.

BIN
rebar


+ 17 - 6
rebar.config

@@ -1,19 +1,30 @@
 %% -*- erlang -*-
 %% -*- erlang -*-
 {erl_opts, [debug_info]}.
 {erl_opts, [debug_info]}.
+
 {deps, [
 {deps, [
         {edown, ".*", {git, "https://github.com/uwiger/edown.git", "HEAD"}},
         {edown, ".*", {git, "https://github.com/uwiger/edown.git", "HEAD"}},
         {gen_leader, ".*",
         {gen_leader, ".*",
-	 {git, "https://github.com/garret-smith/gen_leader_revival.git", "HEAD"}}
+         {git, "https://github.com/garret-smith/gen_leader_revival.git", "HEAD"}}
        ]}.
        ]}.
+
 {dialyzer_opts, [{warnings, [no_unused,
 {dialyzer_opts, [{warnings, [no_unused,
                              no_improper_lists, no_fun_app, no_match,
                              no_improper_lists, no_fun_app, no_match,
                              no_opaque, no_fail_call,
                              no_opaque, no_fail_call,
                              error_handling, no_match,
                              error_handling, no_match,
                              unmatched_returns,
                              unmatched_returns,
                              behaviours, underspecs]}]}.
                              behaviours, underspecs]}]}.
-{edoc_opts, [{doclet, edown_doclet},
-	     {app_default, "http://www.erlang.org/doc/man"},
-             {top_level_readme,
-              {"./README.md",
-               "http://github.com/uwiger/gproc"}}]}.
+{profiles, [
+            {doc, [
+                    {deps, [
+                             {edown, ".*",
+                              {git, "https://github.com/uwiger/edown.git", "HEAD"}}
+                            ]}
+                  , {edoc_opts, [{doclet, edown_doclet},
+                                 {app_default, "http://www.erlang.org/doc/man"},
+                                 {top_level_readme,
+                                  {"./README.md",
+                                   "http://github.com/uwiger/gproc"}}]}
+                  ]}
+            ]}.
+
 {shell, [{apps, [gproc]}]}.
 {shell, [{apps, [gproc]}]}.

BIN
rebar3


+ 0 - 79
src/Makefile

@@ -1,79 +0,0 @@
-## The MIT License
-##
-## Copyright (c) 2008 Ulf Wiger <ulf@wiger.net>,
-##
-## Permission is hereby granted, free of charge, to any person obtaining a
-## copy of this software and associated documentation files (the "Software"),
-## to deal in the Software without restriction, including without limitation
-## the rights to use, copy, modify, merge, publish, distribute, sublicense,
-## and/or sell copies of the Software, and to permit persons to whom the
-## Software is furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be included in
-## all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
-## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-## DEALINGS IN THE SOFTWARE.
-
-
-.SUFFIXES: .erl .beam
-
-APP = gproc
-
-vpath %.beam ../ebin
-vpath %.pdf ../doc
-
-ERLC = erlc -W -I ../include -o ../ebin
-ERLC += +debug_info
-
-#EQC ?= /host/dev/eqc-1.16
-
-EQC_ERLC = $(ERLC) -pa $(EQC)/ebin -I ../include -DEQC
-EQC_ERL = erl -pz ../ebin -pz $(EQC)/ebin -pz ../test/eqc
-
-
-SOURCES = $(wildcard *.erl)
-
-beams = gproc.beam \
-	gproc_app.beam \
-	gproc_dist.beam \
-	gproc_lib.beam \
-	gproc_sup.beam
-
-all : $(beams)
-clean :
-	rm -f  *~ ../ebin/*.beam ../test/eqc/*.beam
-
-## erlc targets
-$(beams) : %.beam : %.erl
-	$(ERLC) $<
-
-../test/eqc/gproc_eqc_tests.beam : ../test/eqc/gproc_eqc_tests.erl
-	$(EQC_ERLC) $<
-
-../test/eqc/gproc_pulse.beam : ../test/eqc/gproc_pulse.erl
-	$(EQC_ERLC) $<
-
-doc: ../doc/edoc-info
-
-../doc/edoc-info: ../doc/overview.edoc $(SOURCES)
-	erl -noshell -eval 'edoc:application($(APP),"..",[])' -s init stop
-
-## test targets
-eunit: all 
-	erl -noshell -boot start_clean -sasl errlog_type error \
-	-pa ../ebin -eval 'eunit:test("../ebin", [verbose])' -s init stop
-
-eqc : all ../test/eqc/gproc_eqc_tests.beam
-	$(EQC_ERL) -s gproc_eqc_tests run -s erlang halt
-
-itest : all ../test/eqc/gproc_eqc_tests.beam
-	$(EQC_ERL) -s eqc start
-
-pulsetest : all ../test/eqc/gproc_pulse.beam
-	$(EQC_ERL) -pa ../../scheduler_msg -pa -s eqc start 

+ 1 - 0
src/gproc.erl

@@ -2183,6 +2183,7 @@ info_cur_f(T, Default) ->
 			      [global,{capture,[1,2,3],list}]),
 			      [global,{capture,[1,2,3],list}]),
     case lists:dropwhile(fun(["gproc","info",_]) -> true;
     case lists:dropwhile(fun(["gproc","info",_]) -> true;
 			    (["gproc","'-info/1-lc" ++ _, _]) -> true;
 			    (["gproc","'-info/1-lc" ++ _, _]) -> true;
+                            (["erlang","process_info", _]) -> true;
 			    (_) -> false
 			    (_) -> false
 			 end, Matches) of
 			 end, Matches) of
 	[] ->
 	[] ->

+ 2 - 2
src/gproc_dist.erl

@@ -22,7 +22,8 @@
 %% <p>For a detailed description, see gproc/doc/erlang07-wiger.pdf.</p>
 %% <p>For a detailed description, see gproc/doc/erlang07-wiger.pdf.</p>
 %% @end
 %% @end
 -module(gproc_dist).
 -module(gproc_dist).
--behaviour(gen_leader).
+
+%% -behaviour(gen_leader).  % to avoid unnecessary warnings
 
 
 -export([start_link/0, start_link/1,
 -export([start_link/0, start_link/1,
          reg/1, reg/4, unreg/1,
          reg/1, reg/4, unreg/1,
@@ -550,7 +551,6 @@ handle_leader_call({reset_counter, {c,g,_Ctr} = Key, Pid}, _From, S, _E) ->
 	 {reply, {Current, New}, [{insert, Vals}], S}
 	 {reply, {Current, New}, [{insert, Vals}], S}
     catch
     catch
 	error:_R ->
 	error:_R ->
-	    io:fwrite("reset_counter failed: ~p~n~p~n", [_R, erlang:get_stacktrace()]),
 	    {reply, badarg, S}
 	    {reply, badarg, S}
     end;
     end;
 handle_leader_call({Unreg, {T,g,Name} = K, Pid}, _From, S, _E)
 handle_leader_call({Unreg, {T,g,Name} = K, Pid}, _From, S, _E)

+ 1 - 1
test/gproc_pt_tests.erl

@@ -14,7 +14,7 @@ reg_and_send_test_() ->
 gproc() ->
 gproc() ->
     gproc:reg({n, l, <<"test">>}),
     gproc:reg({n, l, <<"test">>}),
 
 
-    Msg = random:uniform(1000),
+    Msg = rand:uniform(1000),
     {n, l, <<"test">>} ! Msg,
     {n, l, <<"test">>} ! Msg,
 
 
     Echo = receive
     Echo = receive

+ 0 - 1
test/gproc_tests.erl

@@ -476,7 +476,6 @@ t_is_clean() ->
     sys:get_status(gproc_monitor),
     sys:get_status(gproc_monitor),
     T = ets:tab2list(gproc),
     T = ets:tab2list(gproc),
     Tm = ets:tab2list(gproc_monitor),
     Tm = ets:tab2list(gproc_monitor),
-    ?debugFmt("self() = ~p~n", [self()]),
     ?assertMatch([], Tm),
     ?assertMatch([], Tm),
     ?assertMatch([], T -- [{{whereis(gproc_monitor), l}},
     ?assertMatch([], T -- [{{whereis(gproc_monitor), l}},
                            {{self(), l}}]).
                            {{self(), l}}]).