base: add simple exception tests

This commit is contained in:
Denis Drakhnia 2023-12-25 08:28:17 +02:00
parent 98dc504a04
commit b505304e47
3 changed files with 50 additions and 0 deletions

24
tests/asm/base/excp-1.S Normal file
View File

@ -0,0 +1,24 @@
#include "test_start.S"
sys_rt_sigaction SIGSEGV, act
addd,0 0, 1, %g16
{
stb,2 %g16, [ flag ]
ldb,5 [ 0 ], %empty
}
sys_exit 1
#include "test_end.S"
sig_handler:
ldb,0 [ flag ], %g16
assert_eq_i64(%g16, 1)
exit_with_code
.section ".rodata"
act:
init_sigaction sig_handler
.data
flag:
.byte 0

24
tests/asm/base/excp-2.S Normal file
View File

@ -0,0 +1,24 @@
#include "test_start.S"
sys_rt_sigaction SIGSEGV, act
addd,0 0, 1, %g16
{
ldb,0 [ 0 ], %empty
stb,2 %g16, [ flag ]
}
sys_exit 1
#include "test_end.S"
sig_handler:
ldb,0 [ flag ], %g16
assert_eq_i64(%g16, 0)
exit_with_code
.section ".rodata"
act:
init_sigaction sig_handler
.data
flag:
.byte 0

View File

@ -44,6 +44,8 @@ asm_tests = {
'exit-1': { 'should_fail': true },
'template': {},
'signal-1': {},
'excp-1': {},
'excp-2': {},
},
'win': {
'setwd-1': {},