Skip to content

Commit 98a0412

Browse files
committed
Merge pull request #1204 from pguyot/w25/eunit
Add support for eunit module Add a simplified implementation of eunit interface, with an output compatible with unity test as parsed by Python dut module for qemu-based eunit testing. Eunit can be used on rebar3 projects on generic_unix on both BEAM and AtomVM with: ```shell rebar3 eunit rebar3 as test atomvm packbeam atomvm ${ATOMVMDIR}/build/libs/etest/src/beams/eunit.beam \ ${ATOMVMDIR}/build/libs/atomvmlib.avm \ _build/test/lib/*.avm ``` These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents d760e3a + 15cd68e commit 98a0412

16 files changed

+451
-7
lines changed

.github/workflows/build-and-test-macos.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ jobs:
106106
run: |
107107
./tests/test-structs
108108
109+
- name: "Test: test_etest.avm"
110+
timeout-minutes: 5
111+
working-directory: build
112+
run: |
113+
./src/AtomVM ./tests/libs/etest/test_etest.avm
114+
109115
- name: "Test: test_estdlib.avm"
110116
timeout-minutes: 10
111117
working-directory: build

.github/workflows/build-and-test-on-freebsd.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ jobs:
105105
echo "%%"
106106
./tests/test-structs
107107
108+
echo "%%"
109+
echo "%% Running etest tests ..."
110+
echo "%%"
111+
./src/AtomVM tests/libs/etest/test_etest.avm
112+
108113
echo "%%"
109114
echo "%% Running estdlib tests ..."
110115
echo "%%"

.github/workflows/build-and-test-other.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
mkdir build_tests
5050
cd build_tests
5151
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
52-
ninja erlang_test_modules test_estdlib test_eavmlib test_alisp
52+
ninja erlang_test_modules test_etest test_estdlib test_eavmlib test_alisp
5353
5454
- name: Upload test modules
5555
uses: actions/upload-artifact@v4
@@ -159,6 +159,7 @@ jobs:
159159
cp ../build_tests/tests/erlang_tests/code_load/*.{avm,beam,hrl} tests/erlang_tests/code_load/ &&
160160
mkdir -p tests/erlang_tests/code_load/beams/ &&
161161
cp ../build_tests/tests/erlang_tests/code_load/beams/*.beam tests/erlang_tests/code_load/beams/ &&
162+
cp ../build_tests/tests/libs/etest/*.avm tests/libs/etest/ &&
162163
cp ../build_tests/tests/libs/estdlib/*.avm tests/libs/estdlib/ &&
163164
cp ../build_tests/tests/libs/eavmlib/*.avm tests/libs/eavmlib/ &&
164165
cp ../build_tests/tests/libs/alisp/*.avm tests/libs/alisp/ &&
@@ -176,6 +177,7 @@ jobs:
176177
file ./tests/test-structs &&
177178
./tests/test-structs &&
178179
file ./src/AtomVM &&
180+
./src/AtomVM tests/libs/etest/test_etest.avm &&
179181
./src/AtomVM tests/libs/estdlib/test_estdlib.avm &&
180182
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm &&
181183
./src/AtomVM tests/libs/alisp/test_alisp.avm

.github/workflows/build-and-test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,13 @@ jobs:
351351
./tests/test-structs
352352
valgrind ./tests/test-structs
353353
354+
- name: "Test: test_etest.avm"
355+
timeout-minutes: 5
356+
working-directory: build
357+
run: |
358+
./src/AtomVM ./tests/libs/etest/test_etest.avm
359+
valgrind ./src/AtomVM ./tests/libs/etest/test_etest.avm
360+
354361
- name: "Test: test_estdlib.avm"
355362
timeout-minutes: 5
356363
working-directory: build

.github/workflows/build-libraries.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ jobs:
6767
working-directory: build
6868
run: make dialyzer
6969

70+
- name: "Test: test_alisp.avm"
71+
timeout-minutes: 5
72+
working-directory: build
73+
run: |
74+
./src/AtomVM ./tests/libs/etest/test_alisp.avm
75+
valgrind ./src/AtomVM ./tests/libs/etest/test_alisp.avm
76+
77+
- name: "Test: test_etest.avm"
78+
timeout-minutes: 5
79+
working-directory: build
80+
run: |
81+
./src/AtomVM ./tests/libs/etest/test_etest.avm
82+
valgrind ./src/AtomVM ./tests/libs/etest/test_etest.avm
83+
7084
- name: "Test: test_estdlib.avm"
7185
timeout-minutes: 10
7286
working-directory: build

.github/workflows/build-linux-artifacts.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
mkdir build_tests
3535
cd build_tests
3636
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
37-
ninja erlang_test_modules test_estdlib test_eavmlib test_alisp
37+
ninja erlang_test_modules test_etest test_estdlib test_eavmlib test_alisp
3838
3939
- name: Upload test modules
4040
uses: actions/upload-artifact@v4
@@ -226,6 +226,7 @@ jobs:
226226
file ./tests/test-structs &&
227227
./tests/test-structs &&
228228
file ./src/AtomVM &&
229+
./src/AtomVM tests/libs/etest/test_etest.avm &&
229230
./src/AtomVM tests/libs/estdlib/test_estdlib.avm &&
230231
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm &&
231232
./src/AtomVM tests/libs/alisp/test_alisp.avm &&

.github/workflows/esp32-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
set -eu
7575
apt update
7676
DEBIAN_FRONTEND=noninteractive apt install -y -q \
77-
doxygen erlang-base erlang-dialyzer \
77+
doxygen erlang-base erlang-dev erlang-dialyzer erlang-eunit \
7878
libglib2.0-0 libpixman-1-0 \
7979
gcc g++ zlib1g-dev libsdl2-2.0-0 libslirp0 libmbedtls-dev
8080

.github/workflows/pico-build.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ jobs:
4646
run: sudo apt update
4747

4848
- name: "Install deps"
49-
run: sudo apt install -y cmake gperf ninja-build gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib erlang-base erlang-dialyzer
49+
run: |
50+
sudo apt install -y \
51+
cmake gperf ninja-build gcc-arm-none-eabi \
52+
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
53+
erlang-base erlang-dev erlang-dialyzer erlang-eunit
5054
5155
- name: Build
5256
shell: bash

.github/workflows/run-tests-with-beam.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,11 @@ jobs:
143143
run: |
144144
export PATH="${{ matrix.path_prefix }}$PATH"
145145
erl -pa tests/libs/estdlib/ -pa tests/libs/estdlib/beams/ -pa libs/etest/src/beams -s tests -s init stop -noshell
146+
147+
# Test
148+
- name: "Run tests/libs/etest/test_eunit with OTP eunit"
149+
timeout-minutes: 10
150+
working-directory: build
151+
run: |
152+
export PATH="${{ matrix.path_prefix }}$PATH"
153+
erl -pa tests/libs/etest/beams -s test_eunit test -s init stop -noshell

.github/workflows/wasm-build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
cd build
4848
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
4949
# test_eavmlib does not work with wasm due to http + ssl test
50-
ninja AtomVM atomvmlib test_alisp hello_world run_script call_cast html5_events wasm_webserver
50+
ninja AtomVM atomvmlib test_etest test_alisp hello_world run_script call_cast html5_events wasm_webserver
5151
5252
- name: Upload AtomVM and test modules
5353
uses: actions/upload-artifact@v4
@@ -114,6 +114,7 @@ jobs:
114114
node src/AtomVM.js ../../../../build/tests/libs/alisp/test_alisp.avm
115115
# test_eavmlib does not work with wasm due to http + ssl test
116116
# node src/AtomVM.js ../../../../build/tests/libs/eavmlib/test_eavmlib.avm
117+
node src/AtomVM.js ../../../../build/tests/libs/etest/test_etest.avm
117118
118119
- name: "Rename and write sha256sum (node)"
119120
if: startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)