Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ jobs:
run: |
./tests/test-structs
- name: "Test: test-term"
working-directory: build
run: |
./tests/test-term
- name: "Test: test_etest.avm"
timeout-minutes: 5
working-directory: build
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-and-test-on-freebsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ jobs:
cd build
./tests/test-structs
- name: "Test: test-term"
shell: freebsd {0}
run: |
cd $GITHUB_WORKSPACE;
cd build
./tests/test-term
- name: "Test: test_etest.avm"
shell: freebsd {0}
run: |
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,19 @@ jobs:
ulimit -c unlimited
./tests/test-structs

- name: "Test: test-term with valgrind"
if: matrix.library-arch == ''
working-directory: build
run: |
ulimit -c unlimited
valgrind --error-exitcode=1 ./tests/test-term

- name: "Test: test-term"
working-directory: build
run: |
ulimit -c unlimited
./tests/test-term

- name: "Test: test_etest.avm with valgrind"
if: matrix.library-arch == ''
timeout-minutes: 5
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-linux-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ jobs:
make test-heap &&
make test-mailbox &&
make test-structs &&
make test-term &&
file ./tests/test-erlang &&
./tests/test-erlang -s prime_smp &&
file ./tests/test-enif &&
Expand All @@ -246,6 +247,8 @@ jobs:
./tests/test-mailbox &&
file ./tests/test-structs &&
./tests/test-structs &&
file ./tests/test-term &&
./tests/test-term &&
file ./src/AtomVM &&
./src/AtomVM tests/libs/etest/test_etest.avm &&
./src/AtomVM tests/libs/estdlib/test_estdlib.avm &&
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a bug where negative or oversized segment sizes were not rejected in binary matching
- Fixed the `network` mdns configuration to read the documented `host` key; the previously
required, undocumented `hostname` key is still accepted
- Fixed `term_is_uint32` accepting big integers whose low 64 bits are within range on 32-bit
builds, which made `erlang:crc32/2`, `erlang:crc32_combine/3` and `crypto:pbkdf2_hmac/5`
silently truncate huge integer arguments instead of raising `badarg`

## [0.7.0-alpha.1] - 2026-04-06

Expand Down
2 changes: 1 addition & 1 deletion src/libAtomVM/term.h
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ static inline bool term_is_uint32(term t)
#endif

#if BOXED_TERMS_REQUIRED_FOR_INT != BOXED_TERMS_REQUIRED_FOR_INT64
} else {
} else if (term_boxed_size(t) == BOXED_TERMS_REQUIRED_FOR_INT64) {
avm_int64_t unboxed64 = term_unbox_int64(t);
return unboxed64 <= UINT32_MAX;
#endif
Expand Down
10 changes: 10 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ add_executable(test-heap test-heap.c)
add_executable(test-jit_stream_flash test-jit_stream_flash.c ../src/libAtomVM/jit_stream_flash.c)
add_executable(test-mailbox test-mailbox.c)
add_executable(test-structs test-structs.c)
add_executable(test-term test-term.c)

target_compile_features(test-erlang PUBLIC c_std_11)
target_compile_features(test-enif PUBLIC c_std_11)
target_compile_features(test-heap PUBLIC c_std_11)
target_compile_features(test-jit_stream_flash PUBLIC c_std_11)
target_compile_features(test-mailbox PUBLIC c_std_11)
target_compile_features(test-structs PUBLIC c_std_11)
target_compile_features(test-term PUBLIC c_std_11)

if(CMAKE_COMPILER_IS_GNUCC)
target_compile_options(test-erlang PUBLIC -Wall -pedantic -Wextra -ggdb)
Expand All @@ -42,6 +44,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
target_compile_options(test-jit_stream_flash PUBLIC -Wall -pedantic -Wextra -ggdb)
target_compile_options(test-mailbox PUBLIC -Wall -pedantic -Wextra -ggdb)
target_compile_options(test-structs PUBLIC -Wall -pedantic -Wextra -ggdb)
target_compile_options(test-term PUBLIC -Wall -pedantic -Wextra -ggdb)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
Expand All @@ -56,6 +59,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(test-jit_stream_flash PRIVATE ${LIBRT})
target_link_libraries(test-mailbox PRIVATE ${LIBRT})
target_link_libraries(test-structs PRIVATE ${LIBRT})
target_link_libraries(test-term PRIVATE ${LIBRT})
else()
# might also be in libc
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
Expand All @@ -70,6 +74,7 @@ if (MbedTLS_FOUND)
target_link_libraries(test-jit_stream_flash PRIVATE MbedTLS::mbedtls)
target_link_libraries(test-mailbox PRIVATE MbedTLS::mbedtls)
target_link_libraries(test-structs PRIVATE MbedTLS::mbedtls)
target_link_libraries(test-term PRIVATE MbedTLS::mbedtls)
endif()

set(
Expand All @@ -87,6 +92,7 @@ if((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") OR
target_include_directories(test-jit_stream_flash PRIVATE ../src/platforms/generic_unix/lib)
target_include_directories(test-mailbox PRIVATE ../src/platforms/generic_unix/lib)
target_include_directories(test-structs PRIVATE ../src/platforms/generic_unix/lib)
target_include_directories(test-term PRIVATE ../src/platforms/generic_unix/lib)
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
Expand All @@ -97,6 +103,7 @@ target_include_directories(test-heap PRIVATE ../src/libAtomVM)
target_include_directories(test-jit_stream_flash PRIVATE ../src/libAtomVM ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(test-mailbox PRIVATE ../src/libAtomVM)
target_include_directories(test-structs PRIVATE ../src/libAtomVM)
target_include_directories(test-term PRIVATE ../src/libAtomVM)
target_link_libraries(test-erlang PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
target_link_libraries(test-enif PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
target_link_libraries(test-heap PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
Expand All @@ -108,6 +115,7 @@ endif()
target_link_libraries(test-jit_stream_flash PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
target_link_libraries(test-mailbox PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
target_link_libraries(test-structs PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})
target_link_libraries(test-term PRIVATE libAtomVM libAtomVM${PLATFORM_LIB_SUFFIX})

# Except for XCode, also compile beams
if (NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
Expand All @@ -133,12 +141,14 @@ if (COVERAGE)
append_coverage_compiler_flags_to_target(test-jit_stream_flash)
append_coverage_compiler_flags_to_target(test-mailbox)
append_coverage_compiler_flags_to_target(test-structs)
append_coverage_compiler_flags_to_target(test-term)
append_coverage_linker_flags_to_target(test-erlang)
append_coverage_linker_flags_to_target(test-enif)
append_coverage_linker_flags_to_target(test-heap)
append_coverage_linker_flags_to_target(test-jit_stream_flash)
append_coverage_linker_flags_to_target(test-mailbox)
append_coverage_linker_flags_to_target(test-structs)
append_coverage_linker_flags_to_target(test-term)
if (CMAKE_COMPILER_IS_GNUCC)
setup_target_for_coverage_lcov(NAME coverage EXECUTABLE test-erlang DEPENDENCIES test-erlang)
endif()
Expand Down
9 changes: 9 additions & 0 deletions tests/erlang_tests/test_crc32.erl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ test_crc32_badarg() ->
ok = expect_badarg(fun() -> erlang:crc32_combine(0, 0, ?MODULE:id(-1)) end),
ok = expect_badarg(fun() -> erlang:crc32_combine(?MODULE:id(16#100000000), 0, 0) end),
ok = expect_badarg(fun() -> erlang:crc32_combine(0, ?MODULE:id(16#100000000), 0) end),

% big integers whose low 64 bits are small must not pass the uint32 check
ok = expect_badarg(fun() -> erlang:crc32(?MODULE:id(1 bsl 64), <<"data">>) end),
ok = expect_badarg(fun() -> erlang:crc32(?MODULE:id((1 bsl 64) + 7), <<"data">>) end),
ok = expect_badarg(fun() -> erlang:crc32(?MODULE:id(-(1 bsl 64)), <<"data">>) end),
ok = expect_badarg(fun() -> erlang:crc32(?MODULE:id(1 bsl 130), <<"data">>) end),
ok = expect_badarg(fun() -> erlang:crc32_combine(?MODULE:id(1 bsl 64), 0, 0) end),
ok = expect_badarg(fun() -> erlang:crc32_combine(0, ?MODULE:id((1 bsl 64) + 7), 0) end),
ok = expect_badarg(fun() -> erlang:crc32_combine(0, 0, ?MODULE:id(1 bsl 64)) end),
ok.

test_crc32_boundary() ->
Expand Down
Loading
Loading