Skip to content

Commit

Permalink
Test with rebar3 (#234)
Browse files Browse the repository at this point in the history
* Add proper exports instead of export_all

* Silence a deliberate export_all directive

* Add export_type declarations

* Enable testing with rebar3

* Enable some nowarn_* options when compiling the tests

* Remove a broken test

PR #184, along with various improvements and very good tests, also
introduced a test that does not make much sense: containing a ?SUCHTHAT
as the third argument of a ?LET macro.  This commit removes that test.

See also the comment and discussion at:
6540152#commitcomment-35664733

* Eliminate clause cannot match warnings from proper_tests

* So Long, patched rebar (and Thanks for All the Fish)

* Remove obsolete entries from .gitignore

* Fix code coverage measurements on Travis
  • Loading branch information
kostis authored Apr 1, 2020
1 parent 11b936e commit 0365dd2
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 241 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ doc/edoc-info
rebar3
rebar.lock
ebin
.eunit/
.rebar/
_build/
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
before_script:
- >
printf "\n{cover_enabled, true}.\n{cover_export_enabled, true}.
\n{cover_skip_modules, [
\n{cover_excl_mods, [
proper_array,
proper_dict,
proper_gb_sets,
Expand All @@ -36,8 +36,8 @@ jobs:
after_success:
- git clone https://github.com/covertool/covertool.git
- cd covertool && make compile && cd ..
- find .eunit/ -name *.coverdata -exec ./covertool/covertool -cover {} -output {}.coverage.xml \;
- mv .eunit/*.xml .
- find _build/test/cover/ -name *.coverdata -exec ./covertool/covertool -cover {} -output {}.coverage.xml \;
- mv _build/test/cover/*.xml .
- rm -rf covertool/
- bash <(curl -s https://codecov.io/bash)

Expand Down
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2010-2019 Manolis Papadakis <[email protected]>,
# Copyright 2010-2020 Manolis Papadakis <[email protected]>,
# Eirini Arvaniti <[email protected]>
# and Kostis Sagonas <[email protected]>
#
Expand Down Expand Up @@ -28,8 +28,6 @@ else
SEP := $(strip /)
endif

PROPER_REBAR := .$(SEP)rebar

REBAR3_URL := https://s3.amazonaws.com/rebar3/rebar3
REBAR3 ?= $(shell which rebar3 || which .$(SEP)rebar3 || \
(wget $(REBAR3_URL) && chmod +x rebar3 && echo .$(SEP)rebar3))
Expand All @@ -44,7 +42,7 @@ compile:
ln -s _build/default/lib/proper/ebin .

dialyzer: .plt/proper_plt compile
dialyzer -n -nn --plt $< -Wunmatched_returns ebin
dialyzer -n -nn --plt $< -Wunmatched_returns -Wunknown ebin

.plt/proper_plt: .plt
dialyzer --build_plt --output_plt $@ --apps erts kernel stdlib compiler crypto syntax_tools eunit
Expand All @@ -53,7 +51,7 @@ check_escripts:
./scripts/check_escripts.sh make_doc

test:
$(PROPER_REBAR) eunit
$(REBAR3) eunit

doc: compile
./scripts/make_doc
Expand All @@ -63,12 +61,11 @@ clean:

distclean: clean
$(REBAR3) clean
$(RM) -r .eunit .rebar
$(RM) .plt/proper_plt
$(RM) -r _build ebin rebar3 rebar.lock

rebuild: distclean compile

retest:
$(RM) -r .eunit
$(PROPER_REBAR) eunit
$(RM) -r _build/test/lib/proper/test
$(REBAR3) eunit
Binary file removed rebar
Binary file not shown.
183 changes: 0 additions & 183 deletions rebar.b6d3094.patch

This file was deleted.

15 changes: 9 additions & 6 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@
%%% Author(s): Manolis Papadakis, Kostis Sagonas
%%% Description: Options for rebar/rebar3

%% WARNING: Our version of rebar does NOT automatically report warnings,
%% nor does it add erl_opts to eunit_compile_opts.

{minimum_otp_vsn, "19.0"}.

{erl_first_files, ["src/vararg.erl"]}.

{eunit_first_files, ["src/vararg.erl",
"src/proper_transformer.erl",
"src/proper_prop_remover.erl",
"src/proper_typeserver.erl"]}.

{erl_opts, [debug_info,
report_warnings, {warn_format,1}, warn_export_vars,
report_warnings, {warn_format,1},
warn_export_vars, warn_unused_vars,
warn_obsolete_guard, warn_unused_import,
warn_missing_spec, warn_untyped_record,
{platform_define, "^2", 'AT_LEAST_20'}]}.

{profiles, [{test, [{erl_opts, [nowarn_untyped_record,
nowarn_missing_spec]}]}]}.

{post_hooks, [{clean, "./scripts/clean_doc.sh"}]}.

{dialyzer, [{warnings, [unmatched_returns]},
{plt_extra_apps, [erts, kernel, stdlib, compiler, crypto, syntax_tools]}]}.
{dialyzer, [{warnings, [unmatched_returns, unknown]},
{plt_extra_apps, [erts, kernel, stdlib, compiler, crypto, syntax_tools, eunit]}]}.
7 changes: 4 additions & 3 deletions test/error_statem.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%% -*- coding: utf-8 -*-
%%% -*- erlang-indent-level: 2 -*-
%%% -------------------------------------------------------------------
%%% Copyright 2010-2019 Manolis Papadakis <[email protected]>,
%%% Copyright 2010-2020 Manolis Papadakis <[email protected]>,
%%% Eirini Arvaniti <[email protected]>
%%% and Kostis Sagonas <[email protected]>
%%%
Expand All @@ -20,12 +20,13 @@
%%% You should have received a copy of the GNU General Public License
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.

%%% @copyright 2010-2019 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @version {@version}
%%% @author Eirini Arvaniti

-module(error_statem).
-compile(export_all).
-export([command/1, initial_state/0, next_state/3,
precondition/2, postcondition/3, foo/1, bar/0]).

-include_lib("proper/include/proper.hrl").

Expand Down
7 changes: 4 additions & 3 deletions test/nogen_statem.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%% -*- coding: utf-8 -*-
%%% -*- erlang-indent-level: 2 -*-
%%% -------------------------------------------------------------------
%%% Copyright 2010-2011 Manolis Papadakis <[email protected]>,
%%% Copyright 2010-2020 Manolis Papadakis <[email protected]>,
%%% Eirini Arvaniti <[email protected]>
%%% and Kostis Sagonas <[email protected]>
%%%
Expand All @@ -20,12 +20,13 @@
%%% You should have received a copy of the GNU General Public License
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.

%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @version {@version}
%%% @author Eirini Arvaniti

-module(nogen_statem).
-compile(export_all).
-export([command/1, initial_state/0, next_state/3,
precondition/2, postcondition/3, foo/1, bar/0]).

-include_lib("proper/include/proper.hrl").

Expand Down
14 changes: 9 additions & 5 deletions test/numbers_fsm.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%% -*- coding: utf-8 -*-
%%% -*- erlang-indent-level: 2 -*-
%%% -------------------------------------------------------------------
%%% Copyright 2010-2011 Manolis Papadakis <[email protected]>,
%%% Copyright 2010-2020 Manolis Papadakis <[email protected]>,
%%% Eirini Arvaniti <[email protected]>
%%% and Kostis Sagonas <[email protected]>
%%%
Expand All @@ -20,13 +20,17 @@
%%% You should have received a copy of the GNU General Public License
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.

%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
%%% @version {@version}
%%% @author Eirini Arvaniti
%%% @doc Tests for fsm transition targets

-module(numbers_fsm).
-compile(export_all).

-export([zero/1, one/1, two/1, three/1, four/1, num/4]).
-export([idle/0, inc/0, dec/0, insert/1, delete/1]).
-export([initial_state/0, initial_state_data/0, precondition/4,
postcondition/5, weight/3, next_state_data/5]).

-include_lib("proper/include/proper.hrl").

Expand All @@ -35,7 +39,7 @@
-define(LOOKUP, [{zero,0}, {one,1}, {two,2}, {three,3}, {four,4}]).


%%% Fsm callbacks
%%% FSM callbacks

zero(S) ->
idle_transition() ++
Expand Down Expand Up @@ -131,8 +135,8 @@ mod(0, _Y) -> 0.
mod_add(X, Y) -> mod(X+Y, 5).
mod_sub(X, Y) -> mod(X-Y, 5).

inc() -> ok.
idle() -> ok.
inc() -> ok.
dec() -> ok.
insert(_) -> ok.
delete(_) -> ok.
Expand Down
Loading

0 comments on commit 0365dd2

Please sign in to comment.