From d7fc14aa3437dead4989edb59ae24111244635df Mon Sep 17 00:00:00 2001 From: John Goff Date: Mon, 8 Jan 2024 20:35:29 -0500 Subject: [PATCH 01/11] Relax versions of hex.pm dependencies Right now ltest does not work on any project trying to use lfe 2.1.3. Since hex.pm requires semver, and rebar3 supports this, we can relax the required versions listed in the rebar.config. This allows for this library to work with any minor version without requiring a version bump for ltest. --- rebar.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index dcfcad9..e7b3b6f 100644 --- a/rebar.config +++ b/rebar.config @@ -5,8 +5,8 @@ ]}. {deps, [ - {lfe, "2.1.2"}, - {erlang_color, "1.0.0"} + {lfe, "~> 2.1"}, + {erlang_color, "~> 1.0"} ]}. {plugins, [ From 81faa33f71e1d2d1204612e030b0fd900bf966e3 Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 21:40:09 -0500 Subject: [PATCH 02/11] Upgrade locked version of LFE to latest --- rebar.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rebar.lock b/rebar.lock index b0cbfcd..a7c1a5a 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,11 +1,11 @@ {"1.2.0", [{<<"erlang_color">>,{pkg,<<"erlang_color">>,<<"1.0.0">>},0}, - {<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.1">>},0}]}. + {<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. [ {pkg_hash,[ {<<"erlang_color">>, <<"145FE1D2E65C4516E4F03FEFCA6C2F47EBAD5899D978D70382A5CFE643E4AC9E">>}, - {<<"lfe">>, <<"4A888B26172D198DC7A5AFEB897E8248AF7D56E1638D9C8249AAF933AE811B96">>}]}, + {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, {pkg_hash_ext,[ {<<"erlang_color">>, <<"6B17E5E589C8FEF540574C9EA32B67CEC2C8A44283AAFE474D6E5818FB3EE038">>}, - {<<"lfe">>, <<"C484D3B655D40DED58BC41B17B22F173711C681BF36063A234A9BAA9506947E1">>}]} + {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} ]. From 04e45e220da202da1292ae704c9755a46b81ca06 Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 21:40:25 -0500 Subject: [PATCH 03/11] Use latest version of rebar3_lfe plugin --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index e7b3b6f..48af747 100644 --- a/rebar.config +++ b/rebar.config @@ -61,7 +61,7 @@ "test/*.lfe"} ]}, {plugins, [ - {rebar3_lfe, {git, "https://github.com/lfe-rebar3/rebar3_lfe.git", {branch, "release/0.3.x"}}} + {rebar3_lfe, {git, "https://github.com/lfe-rebar3/rebar3_lfe.git", {branch, "release/0.4.x"}}} ]} ]} ]}. From a6f181e72b9bc1f2ca3cd5fcb4fe024d8e52c4cb Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 21:40:41 -0500 Subject: [PATCH 04/11] Typo fixes --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bee432d..277fdc7 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ you may use the most recent rebar2-compatible release of ltest: 0.6.3. ## EUnit Compatibility [↟](#contents) -The tests created with ltest are compatible with EUnit ane can be run from +The tests created with ltest are compatible with EUnit and can be run from either Erlang or LFE, using the standard EUnit listener or the ltest listener (test runner). @@ -51,7 +51,8 @@ listener (test runner). * `(deftest ...)` for standard unit tests * `(deftestgen ...)` for writing tests with generators, including the standard EUnit test fixtures (see naming caveat below) -* `(deftestskip ...)` for skipping unit tests; note that for a test to show up as skipped in the test runner, it has to be `export`ed in the module +* `(deftestskip ...)` for skipping unit tests; note that for a test to show up + as skipped in the test runner, it has to be `export`ed in the module * `(list ...)`-wrapped tests (of arbitrary depth) for use as test sets * `(tuple ...)`-wrapped tests for naming/describing tests (first element of tuple) From e5a3b58a889f04fe2ce039acae9a52bfde3c1e6c Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 22:10:35 -0500 Subject: [PATCH 05/11] Use the rebar3 plugin to compile instead of lfec --- rebar.config | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/rebar.config b/rebar.config index 48af747..ddaaf0a 100644 --- a/rebar.config +++ b/rebar.config @@ -10,9 +10,14 @@ ]}. {plugins, [ + {rebar3_lfe, "~> 0.4.8"}, {rebar_cmd, "0.2.6"} ]}. +{provider_hooks, [ + {pre, [{compile, {lfe, compile}}]} +]}. + {xref_checks,[ undefined_function_calls,undefined_functions,locals_not_used, deprecated_function_calls,deprecated_functions @@ -22,44 +27,14 @@ {warnings, [unknown]} ]}. -{pre_hooks, [ - %% DEBUG: - %% {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", compile, - %% "echo REBAR_DEPS_DIR = $REBAR_DEPS_DIR"}, - {app_compile, - "$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec" - " -o $REBAR_DEPS_DIR/ltest/ebin" - " src/*.lfe"} - ]}. - {profiles, [ {test, [ {eunit_opts, [verbose]}, {erl_opts, [ {src_dirs, ["src", "test"]} - ]}, - {pre_hooks, [ - {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile, - "$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec " - "-o $REBAR_DEPS_DIR/ltest/ebin " - "src/*.lfe"}, - {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile, - "$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec " - "-o $REBAR_DEPS_DIR/ltest/ebin " - "test/*.lfe"} ]} ]}, {repl, [ - {pre_hooks, [ - {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile, - "$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec " - "-o $REBAR_DEPS_DIR/ltest/ebin " - "src/*.lfe"}, - {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile, - "$REBAR_DEPS_DIR/lfe/bin/lfescript $REBAR_DEPS_DIR/lfe/bin/lfec " - "-o $REBAR_DEPS_DIR/ltest/ebin " - "test/*.lfe"} - ]}, {plugins, [ {rebar3_lfe, {git, "https://github.com/lfe-rebar3/rebar3_lfe.git", {branch, "release/0.4.x"}}} ]} From cc601e21600cc9119447cedf7de4c237bbb74267 Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 22:12:35 -0500 Subject: [PATCH 06/11] Remove redundant repl profile --- priv/make/code.mk | 7 +------ rebar.config | 9 +-------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/priv/make/code.mk b/priv/make/code.mk index f87329c..8641658 100644 --- a/priv/make/code.mk +++ b/priv/make/code.mk @@ -1,13 +1,8 @@ compile: @$(REBAR3) compile -# repl: -# $(REBAR3) as $(REBAR_PROFILE) compile -# $(LFE) -pa `$(REBAR3) as $(REBAR_PROFILE) path -s " -pa "` - repl: - @$(REBAR3) as repl compile - @$(REBAR3) as repl lfe repl + @$(REBAR3) lfe repl shell: @$(REBAR3) shell diff --git a/rebar.config b/rebar.config index ddaaf0a..7bee62a 100644 --- a/rebar.config +++ b/rebar.config @@ -30,14 +30,7 @@ {profiles, [ {test, [ {eunit_opts, [verbose]}, - {erl_opts, [ - {src_dirs, ["src", "test"]} - ]} - ]}, - {repl, [ - {plugins, [ - {rebar3_lfe, {git, "https://github.com/lfe-rebar3/rebar3_lfe.git", {branch, "release/0.4.x"}}} - ]} + {erl_opts, [{src_dirs, ["src", "test"]}]} ]} ]}. From 358920cda0d1940fc467625735ef6d95cd70c4f6 Mon Sep 17 00:00:00 2001 From: John Goff Date: Tue, 6 Feb 2024 22:39:43 -0500 Subject: [PATCH 07/11] Correct package name of erlang_color --- rebar.config | 2 +- rebar.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index 7bee62a..5130b6f 100644 --- a/rebar.config +++ b/rebar.config @@ -6,7 +6,7 @@ {deps, [ {lfe, "~> 2.1"}, - {erlang_color, "~> 1.0"} + {color, "~> 1.0", {pkg, erlang_color}} ]}. {plugins, [ diff --git a/rebar.lock b/rebar.lock index a7c1a5a..d7ecc28 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,11 +1,11 @@ {"1.2.0", -[{<<"erlang_color">>,{pkg,<<"erlang_color">>,<<"1.0.0">>},0}, +[{<<"color">>,{pkg,<<"erlang_color">>,<<"1.0.0">>},0}, {<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.3">>},0}]}. [ {pkg_hash,[ - {<<"erlang_color">>, <<"145FE1D2E65C4516E4F03FEFCA6C2F47EBAD5899D978D70382A5CFE643E4AC9E">>}, + {<<"color">>, <<"145FE1D2E65C4516E4F03FEFCA6C2F47EBAD5899D978D70382A5CFE643E4AC9E">>}, {<<"lfe">>, <<"6EFCB2BBC1FFC21DC5D1C092F00EFDB397EAC889474AC5C86EDF78A3557CC730">>}]}, {pkg_hash_ext,[ - {<<"erlang_color">>, <<"6B17E5E589C8FEF540574C9EA32B67CEC2C8A44283AAFE474D6E5818FB3EE038">>}, + {<<"color">>, <<"6B17E5E589C8FEF540574C9EA32B67CEC2C8A44283AAFE474D6E5818FB3EE038">>}, {<<"lfe">>, <<"4E4BAD515A169AE418FEB7374EA1C8D741FAEA9D95E266CE343B45BCC377F55B">>}]} ]. From de33457983863ab7608bd3e22940090b4166e93f Mon Sep 17 00:00:00 2001 From: John Goff Date: Wed, 7 Feb 2024 22:18:54 -0500 Subject: [PATCH 08/11] Return a list from behaviour info function instead of undefined --- src/ltest-integration.lfe | 2 +- src/ltest-system.lfe | 2 +- src/ltest-unit.lfe | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ltest-integration.lfe b/src/ltest-integration.lfe index c2015f9..866ac5c 100644 --- a/src/ltest-integration.lfe +++ b/src/ltest-integration.lfe @@ -3,7 +3,7 @@ (defun behaviour_info (('callbacks) - 'undefined) + '()) ((_) 'undefined)) diff --git a/src/ltest-system.lfe b/src/ltest-system.lfe index 7fbfda0..5d47542 100644 --- a/src/ltest-system.lfe +++ b/src/ltest-system.lfe @@ -3,7 +3,7 @@ (defun behaviour_info (('callbacks) - 'undefined) + '()) ((_) 'undefined)) diff --git a/src/ltest-unit.lfe b/src/ltest-unit.lfe index a1d9695..f7bcf91 100644 --- a/src/ltest-unit.lfe +++ b/src/ltest-unit.lfe @@ -3,7 +3,7 @@ (defun behaviour_info (('callbacks) - 'undefined) + '()) ((_) 'undefined)) From b65591e5442e2ac3a8c901ad2c592d8cbd60e120 Mon Sep 17 00:00:00 2001 From: John Goff Date: Mon, 19 Feb 2024 17:15:39 -0500 Subject: [PATCH 09/11] Remove OTP 19 and 20 from test matrix and add 26 --- .github/workflows/cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 98290d9..e5e75f9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -15,8 +15,8 @@ jobs: strategy: matrix: - otp_version: [19, 20, 21, 22, 23, 24, 25] - # otp_version: [22] + # otp_version: [19, 20] Removed due to an incompatibility with rebar3_lfe + otp_version: [21, 22, 23, 24, 25, 26] os: [ubuntu-latest] container: From e866cba202384752ea449f3d91cab60b3f796d65 Mon Sep 17 00:00:00 2001 From: John Goff Date: Mon, 19 Feb 2024 17:34:15 -0500 Subject: [PATCH 10/11] Replace calls to non existing functions --- src/ltest-util.lfe | 2 +- src/ltest.lfe | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ltest-util.lfe b/src/ltest-util.lfe index 34ce30f..2152f18 100644 --- a/src/ltest-util.lfe +++ b/src/ltest-util.lfe @@ -75,7 +75,7 @@ exports)) (defun filtered (func beams) - (lists:filter-files + (lists:filter (lambda (x) (=/= x 'false)) (funcall func beams))) diff --git a/src/ltest.lfe b/src/ltest.lfe index be70248..787b38b 100644 --- a/src/ltest.lfe +++ b/src/ltest.lfe @@ -123,12 +123,12 @@ funcs)) (defun get-skip-funcs (module) - (ltest-util:filter-files + (lists:filter #'check-skip-funcs/1 (ltest-util:get-module-exports module))) (defun get-skipped-tests (module) - (ltest-util:filter-files + (lists:filter #'check-skipped-tests/1 (ltest-util:get-module-exports module))) From 7e5a5197efbba710272a51c5a667103126f23db9 Mon Sep 17 00:00:00 2001 From: John Goff Date: Mon, 19 Feb 2024 18:03:29 -0500 Subject: [PATCH 11/11] Continue the run if xref fails --- .github/workflows/cicd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index e5e75f9..850f4c1 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -29,6 +29,7 @@ jobs: - name: Compile run: rebar3 compile - name: Xref Check + continue-on-error: true run: rebar3 xref - name: Run Tests run: rebar3 as test eunit