Skip to content

Commit 9fd9cb5

Browse files
committed
x86 asm: fix test-executables after move from x86-assembly-cheat
Even QEMU has unimplemented x86 instructions!
1 parent 23d8f70 commit 9fd9cb5

File tree

2 files changed

+53
-14
lines changed

2 files changed

+53
-14
lines changed

path_properties.py

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class PathProperties:
4848
# We should get rid of this if we ever properly implement dependency graphs.
4949
'extra_objs_lkmc_common': False,
5050
'gem5_unimplemented_instruction': False,
51+
'qemu_unimplemented_instruction': False,
52+
# For some reason QEMU fails with SIGSEGV on int syscalls in x86_64.
53+
'qemu_x86_64_int_syscall': False,
5154
'interactive': False,
5255
# The script takes a perceptible amount of time to run. Possibly an infinite loop.
5356
'more_than_1s': False,
@@ -168,6 +171,7 @@ def should_be_tested(self, env):
168171
not self['requires_kernel_modules'] and
169172
not self['requires_sudo'] and
170173
not self['skip_run_unclassified'] and
174+
not self['qemu_x86_64_int_syscall'] and
171175
not (
172176
env['emulator'] == 'gem5' and
173177
(
@@ -182,7 +186,10 @@ def should_be_tested(self, env):
182186
not (
183187
env['emulator'] == 'qemu' and
184188
(
185-
self['requires_m5ops']
189+
self['requires_m5ops'] or
190+
env['mode'] == 'baremetal' and (
191+
self['qemu_unimplemented_instruction']
192+
)
186193
)
187194
)
188195
)
@@ -394,29 +401,55 @@ def get(path):
394401
},
395402
}
396403
),
397-
'lkmc_assert_fail.S': {
398-
'signal_received': signal.Signals.SIGABRT,
399-
},
400404
'x86_64': (
401405
{'allowed_archs': {'x86_64'}},
402406
{
403-
'inline_asm': (
407+
'freestanding': (
408+
freestanding_properties,
404409
{
405-
},
410+
'linux': (
411+
{},
412+
{
413+
'int_system_call.S': {'qemu_x86_64_int_syscall': True},
414+
}
415+
),
416+
}
417+
),
418+
'inline_asm': (
419+
{},
406420
{
407421
'freestanding': freestanding_properties,
408422
}
409423
),
424+
'intrinsics': (
425+
{},
426+
{
427+
'rdtscp.c': {
428+
'gem5_unimplemented_instruction': True,
429+
'qemu_unimplemented_instruction': True,
430+
},
431+
}
432+
),
410433
'div_overflow.S': {'signal_received': signal.Signals.SIGFPE},
411434
'div_zero.S': {'signal_received': signal.Signals.SIGFPE},
412-
'freestanding': freestanding_properties,
413435
'lkmc_assert_eq_fail.S': {'signal_received': signal.Signals.SIGABRT},
414436
'lkmc_assert_memcmp_fail.S': {'signal_received': signal.Signals.SIGABRT},
415-
'ring0.c': {
416-
'signal_received': signal.Signals.SIGSEGV,
417-
}
437+
'popcnt.S': {'qemu_unimplemented_instruction': True},
438+
'rdrand.S': {
439+
'gem5_unimplemented_instruction': True,
440+
'qemu_unimplemented_instruction': True,
441+
},
442+
'rdtscp.S': {'qemu_unimplemented_instruction': True},
443+
'ring0.c': {'signal_received': signal.Signals.SIGSEGV},
444+
'vfmadd132pd.S': {
445+
'gem5_unimplemented_instruction': True,
446+
'qemu_unimplemented_instruction': True,
447+
},
418448
}
419449
),
450+
'lkmc_assert_fail.S': {
451+
'signal_received': signal.Signals.SIGABRT,
452+
},
420453
}
421454
),
422455
'c': (

test-executables

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import sys
66
import common
77
import lkmc.import_path
88
import path_properties
9+
import signal
910
import thread_pool
1011

1112
class Main(common.TestCliFunction):
@@ -76,13 +77,18 @@ If given, run only the given tests. Otherwise, run all tests.
7677
'run_obj': lkmc.import_path.import_path_main('run'),
7778
'test_id': '{} {}'.format(self.env['mode'], path_relative_root),
7879
}
79-
signal = my_path_properties['signal_received']
80-
if signal is not None:
80+
if (my_path_properties['qemu_unimplemented_instruction'] and
81+
self.env['emulator'] == 'qemu' and
82+
self.env['mode'] == 'userland'
83+
):
84+
run_test_args['expected_exit_status'] = -signal.Signals.SIGILL.value
85+
my_signal = my_path_properties['signal_received']
86+
if my_signal is not None:
8187
if self.env['mode'] == 'baremetal':
82-
run_test_args['expected_exit_status'] = 128 + signal.value
88+
run_test_args['expected_exit_status'] = 128 + my_signal.value
8389
elif self.env['mode'] == 'userland':
8490
# Python subprocess reports signals differently from Bash's 128 + signal rule.
85-
run_test_args['expected_exit_status'] = -signal.value
91+
run_test_args['expected_exit_status'] = -my_signal.value
8692
my_thread_pool.submit(run_test_args)
8793
return self._handle_thread_pool_errors(my_thread_pool)
8894

0 commit comments

Comments
 (0)