test-user-mode: handle exit status for signals. Fix #61.

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-08 00:00:04 +00:00
parent 7a007c66fe
commit 887dd8a31f
3 changed files with 16 additions and 6 deletions

View File

@@ -9286,7 +9286,7 @@ And in QEMU:
Or for a faster development loop:
....
./run --debug-vm --debug-vm-args '-ex "break edu_mmio_read" -ex "run"'
./run --debug-vm-args '-ex "break edu_mmio_read" -ex "run"'
....
When in <<qemu-text-mode>>, using `--debug-vm` makes Ctrl-C not get passed to the QEMU guest anymore: it is instead captured by GDB itself, so allow breaking. So e.g. you won't be able to easily quit from a guest program like:

View File

@@ -21,6 +21,8 @@ class PathProperties:
'cc_flags_after': [],
'cc_pedantic': True,
'cxx_std': default_cxx_std,
# Expected program exit status. When signals are raised, this refers
# to the native exit status. as reported by Bash #?.
'exit_status': 0,
'extra_objs_baremetal_bootloader': False,
# We should get rid of this if we ever properly implement dependency graphs.
@@ -111,7 +113,6 @@ class PathProperties:
not self['interactive'] and
not self['more_than_1s'] and
not self['no_executable'] and
not self['receives_signal'] and
not self['requires_argument'] and
not self['requires_kernel_modules'] and
not self['requires_sudo'] and
@@ -334,7 +335,10 @@ path_properties_tuples = (
},
{
'freestanding': freestanding_properties,
'ring0.c': {'receives_signal': True}
'ring0.c': {
'exit_status': 139,
'receives_signal': True
}
}
),
'freestanding': freestanding_properties,
@@ -345,7 +349,10 @@ path_properties_tuples = (
'c': (
{},
{
'assert_fail.c': {'receives_signal': True},
'assert_fail.c': {
'exit_status': 134,
'receives_signal': True,
},
'false.c': {'exit_status': 1},
'getchar.c': {'interactive': True},
'infinite_loop.c': {'more_than_1s': True},

View File

@@ -59,12 +59,15 @@ If given, run only the given tests. Otherwise, run all tests.
'userland': os.path.relpath(os.path.join(path_abs, in_filename), os.getcwd()),
})
cur_run_args.update(my_path_properties['test_run_args'])
error = thread_pool.submit({
run_test_args = {
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': self.import_path_main('run'),
'test_id': path_relative_root,
})
}
if my_path_properties['receives_signal']:
run_test_args['expected_exit_status'] = 128 - my_path_properties['exit_status']
error = thread_pool.submit(run_test_args)
if error is not None:
if self.env['quit_on_fail']:
raise common.ExitLoop()