x86 asm: fix test-executables after move from x86-assembly-cheat

Even QEMU has unimplemented x86 instructions!
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-24 00:00:00 +00:00
parent 23d8f703fd
commit 9fd9cb520e
2 changed files with 53 additions and 14 deletions

View File

@@ -48,6 +48,9 @@ class PathProperties:
# We should get rid of this if we ever properly implement dependency graphs. # We should get rid of this if we ever properly implement dependency graphs.
'extra_objs_lkmc_common': False, 'extra_objs_lkmc_common': False,
'gem5_unimplemented_instruction': False, 'gem5_unimplemented_instruction': False,
'qemu_unimplemented_instruction': False,
# For some reason QEMU fails with SIGSEGV on int syscalls in x86_64.
'qemu_x86_64_int_syscall': False,
'interactive': False, 'interactive': False,
# The script takes a perceptible amount of time to run. Possibly an infinite loop. # The script takes a perceptible amount of time to run. Possibly an infinite loop.
'more_than_1s': False, 'more_than_1s': False,
@@ -168,6 +171,7 @@ class PathProperties:
not self['requires_kernel_modules'] and not self['requires_kernel_modules'] and
not self['requires_sudo'] and not self['requires_sudo'] and
not self['skip_run_unclassified'] and not self['skip_run_unclassified'] and
not self['qemu_x86_64_int_syscall'] and
not ( not (
env['emulator'] == 'gem5' and env['emulator'] == 'gem5' and
( (
@@ -182,7 +186,10 @@ class PathProperties:
not ( not (
env['emulator'] == 'qemu' and env['emulator'] == 'qemu' and
( (
self['requires_m5ops'] self['requires_m5ops'] or
env['mode'] == 'baremetal' and (
self['qemu_unimplemented_instruction']
)
) )
) )
) )
@@ -394,29 +401,55 @@ path_properties_tuples = (
}, },
} }
), ),
'lkmc_assert_fail.S': {
'signal_received': signal.Signals.SIGABRT,
},
'x86_64': ( 'x86_64': (
{'allowed_archs': {'x86_64'}}, {'allowed_archs': {'x86_64'}},
{ {
'inline_asm': ( 'freestanding': (
freestanding_properties,
{ {
}, 'linux': (
{},
{
'int_system_call.S': {'qemu_x86_64_int_syscall': True},
}
),
}
),
'inline_asm': (
{},
{ {
'freestanding': freestanding_properties, 'freestanding': freestanding_properties,
} }
), ),
'intrinsics': (
{},
{
'rdtscp.c': {
'gem5_unimplemented_instruction': True,
'qemu_unimplemented_instruction': True,
},
}
),
'div_overflow.S': {'signal_received': signal.Signals.SIGFPE}, 'div_overflow.S': {'signal_received': signal.Signals.SIGFPE},
'div_zero.S': {'signal_received': signal.Signals.SIGFPE}, 'div_zero.S': {'signal_received': signal.Signals.SIGFPE},
'freestanding': freestanding_properties,
'lkmc_assert_eq_fail.S': {'signal_received': signal.Signals.SIGABRT}, 'lkmc_assert_eq_fail.S': {'signal_received': signal.Signals.SIGABRT},
'lkmc_assert_memcmp_fail.S': {'signal_received': signal.Signals.SIGABRT}, 'lkmc_assert_memcmp_fail.S': {'signal_received': signal.Signals.SIGABRT},
'ring0.c': { 'popcnt.S': {'qemu_unimplemented_instruction': True},
'signal_received': signal.Signals.SIGSEGV, 'rdrand.S': {
} 'gem5_unimplemented_instruction': True,
'qemu_unimplemented_instruction': True,
},
'rdtscp.S': {'qemu_unimplemented_instruction': True},
'ring0.c': {'signal_received': signal.Signals.SIGSEGV},
'vfmadd132pd.S': {
'gem5_unimplemented_instruction': True,
'qemu_unimplemented_instruction': True,
},
} }
), ),
'lkmc_assert_fail.S': {
'signal_received': signal.Signals.SIGABRT,
},
} }
), ),
'c': ( 'c': (

View File

@@ -6,6 +6,7 @@ import sys
import common import common
import lkmc.import_path import lkmc.import_path
import path_properties import path_properties
import signal
import thread_pool import thread_pool
class Main(common.TestCliFunction): class Main(common.TestCliFunction):
@@ -76,13 +77,18 @@ If given, run only the given tests. Otherwise, run all tests.
'run_obj': lkmc.import_path.import_path_main('run'), 'run_obj': lkmc.import_path.import_path_main('run'),
'test_id': '{} {}'.format(self.env['mode'], path_relative_root), 'test_id': '{} {}'.format(self.env['mode'], path_relative_root),
} }
signal = my_path_properties['signal_received'] if (my_path_properties['qemu_unimplemented_instruction'] and
if signal is not None: self.env['emulator'] == 'qemu' and
self.env['mode'] == 'userland'
):
run_test_args['expected_exit_status'] = -signal.Signals.SIGILL.value
my_signal = my_path_properties['signal_received']
if my_signal is not None:
if self.env['mode'] == 'baremetal': if self.env['mode'] == 'baremetal':
run_test_args['expected_exit_status'] = 128 + signal.value run_test_args['expected_exit_status'] = 128 + my_signal.value
elif self.env['mode'] == 'userland': elif self.env['mode'] == 'userland':
# Python subprocess reports signals differently from Bash's 128 + signal rule. # Python subprocess reports signals differently from Bash's 128 + signal rule.
run_test_args['expected_exit_status'] = -signal.value run_test_args['expected_exit_status'] = -my_signal.value
my_thread_pool.submit(run_test_args) my_thread_pool.submit(run_test_args)
return self._handle_thread_pool_errors(my_thread_pool) return self._handle_thread_pool_errors(my_thread_pool)