Skip to content

Replace .S test for bs_test_unit with .erl test#2210

Open
pguyot wants to merge 2 commits intoatomvm:mainfrom
pguyot:w12/rework-op_bs_test_unit-test
Open

Replace .S test for bs_test_unit with .erl test#2210
pguyot wants to merge 2 commits intoatomvm:mainfrom
pguyot:w12/rework-op_bs_test_unit-test

Conversation

@pguyot
Copy link
Collaborator

@pguyot pguyot commented Mar 17, 2026

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

Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails on OTP-29 rc1:

test_op_bs_test_unit:
CRASH 
======
pid: <0.1.0>

Stacktrace:
[{test_op_bs_test_unit,test_unit_16,0,[{file,"/home/runner/work/AtomVM/AtomVM/tests/erlang_tests/test_op_bs_test_unit.erl"},{line,53}]},{test_op_bs_test_unit,start,0,[{file,"/home/runner/work/AtomVM/AtomVM/tests/erlang_tests/test_op_bs_test_unit.erl"},{line,36}]}]

cp: #CP<module: 0, label: 9, offset: 529>

x[0]: error
x[1]: {badmatch,<<2>>}
x[2]: {2,2,75,1,[{0,310},{0,2111}],error}

Stack 
-----

#CP<module: 0, label: 2, offset: 120>
#CP<module: 0, label: 0, offset: 125>


Mailbox
-------


Monitors
--------


**End Of Crash Report**
Expected 0 but result is not an integer
test_op_bs_test_unit:FAILED

@pguyot
Copy link
Collaborator Author

pguyot commented Mar 17, 2026

I suspect OTP29 to not be able to emit this opcode as the no_bs_match option is gone

OTP29 emits this opcode but eventually this test uncovered a bug in bs_match ensure_at_least which this PR now fixes in the first commit.

@pguyot pguyot force-pushed the w12/rework-op_bs_test_unit-test branch 2 times, most recently from 7e32f73 to 2a36dd7 Compare March 17, 2026 21:16
pguyot added 2 commits March 17, 2026 23:31
The unit alignment check in ensure_at_least must apply to
(remaining - stride) not remaining, since stride bits will be
consumed before the byte-aligned tail.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
@pguyot pguyot force-pushed the w12/rework-op_bs_test_unit-test branch from 2a36dd7 to 1a3a797 Compare March 17, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants