From b505304e47838095d7f9e77be9c11f663ecb6a15 Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Mon, 25 Dec 2023 08:28:17 +0200 Subject: [PATCH] base: add simple exception tests --- tests/asm/base/excp-1.S | 24 ++++++++++++++++++++++++ tests/asm/base/excp-2.S | 24 ++++++++++++++++++++++++ tests/asm/meson.build | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 tests/asm/base/excp-1.S create mode 100644 tests/asm/base/excp-2.S diff --git a/tests/asm/base/excp-1.S b/tests/asm/base/excp-1.S new file mode 100644 index 0000000..e398059 --- /dev/null +++ b/tests/asm/base/excp-1.S @@ -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 diff --git a/tests/asm/base/excp-2.S b/tests/asm/base/excp-2.S new file mode 100644 index 0000000..5a0665d --- /dev/null +++ b/tests/asm/base/excp-2.S @@ -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 diff --git a/tests/asm/meson.build b/tests/asm/meson.build index 89d5e84..fef21d4 100644 --- a/tests/asm/meson.build +++ b/tests/asm/meson.build @@ -44,6 +44,8 @@ asm_tests = { 'exit-1': { 'should_fail': true }, 'template': {}, 'signal-1': {}, + 'excp-1': {}, + 'excp-2': {}, }, 'win': { 'setwd-1': {},