From 04c54a6369f0506f42285352067a92b24be57acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 28 May 2019 00:00:00 +0000 Subject: [PATCH] test-user-mode: classify and skip all failing gem5 tests Create userlan/posix/kill.c to better test signals. --- README.adoc | 1 + path_properties.py | 14 +++++++++++++- userland/posix/kill.c | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 userland/posix/kill.c diff --git a/README.adoc b/README.adoc index de24af8..60c5b5f 100644 --- a/README.adoc +++ b/README.adoc @@ -15383,6 +15383,7 @@ The following examples end up testing that our setup is working: * link:userland/c/exit0.c[] * link:userland/c/exit1.c[] * link:userland/c/exit2.c[] +* link:userland/posix/kill.c[] Beware that on Linux kernel simulations, you cannot even echo that string from userland, since userland stdout shows up on the serial. diff --git a/path_properties.py b/path_properties.py index c893377..3375158 100644 --- a/path_properties.py +++ b/path_properties.py @@ -47,6 +47,7 @@ class PathProperties: 'extra_objs_disable_baremetal_bootloader': False, # We should get rid of this if we ever properly implement dependency graphs. 'extra_objs_lkmc_common': False, + 'gem5_unimplemented_instruction': False, 'interactive': False, # The script takes a perceptible amount of time to run. Possibly an infinite loop. 'more_than_1s': False, @@ -149,6 +150,7 @@ class PathProperties: self['signal_generated_by_os'] ) ) and + not self['disrupts_system'] and not self['interactive'] and not self['more_than_1s'] and not self['no_executable'] and @@ -159,6 +161,9 @@ class PathProperties: not ( env['emulator'] == 'gem5' and ( + self['gem5_unimplemented_instruction'] or + # gem5 does not report signals properly. + self['signal_received'] is not None or self['requires_dynamic_library'] or self['requires_semihosting'] or self['requires_syscall_getcpu'] @@ -347,7 +352,10 @@ path_properties_tuples = ( 'signal_generated_by_os': True, 'signal_received': signal.Signals.SIGILL, }, - 'vcvta.S': {'arm_aarch32': True}, + 'vcvta.S': { + 'arm_aarch32': True, + 'gem5_unimplemented_instruction': True, + }, } ), 'aarch64': ( @@ -452,6 +460,10 @@ path_properties_tuples = ( {}, { 'count.c': {'more_than_1s': True}, + 'kill.c': { + 'baremetal': True, + 'signal_received': signal.Signals.SIGHUP, + }, 'sleep_forever.c': {'more_than_1s': True}, 'virt_to_phys_test.c': {'more_than_1s': True}, } diff --git a/userland/posix/kill.c b/userland/posix/kill.c new file mode 100644 index 0000000..08ddf6f --- /dev/null +++ b/userland/posix/kill.c @@ -0,0 +1,16 @@ +/* A process that commits suicide by signal. */ + +#define _XOPEN_SOURCE 700 +#include +#include +#include + +int main(int argc, char **argv) { + int sig; + if (argc <= 1) { + sig = 1; + } else { + sig = strtoull(argv[1], NULL, 0); + } + kill(getpid(), sig); +}