mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
create userland tests
Fix some more tabs. Parse the "Simulated exit code not 0!" string in gem5 and exit with the proper status
This commit is contained in:
47
test-userland
Executable file
47
test-userland
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
|
||||
import common
|
||||
|
||||
class Main(common.LkmcCliFunction):
|
||||
def timed_main(self):
|
||||
run = self.import_path('run').Main()
|
||||
sources = [
|
||||
'add.c',
|
||||
'hello.c',
|
||||
'hello_cpp.cpp',
|
||||
'print_argv.c',
|
||||
]
|
||||
# for emulator in self.env['emulators']:
|
||||
for emulator in ['gem5']:
|
||||
if emulator == 'gem5':
|
||||
extra_args = {
|
||||
'userland_build_id': 'static',
|
||||
}
|
||||
else:
|
||||
extra_args = {}
|
||||
for arch in self.env['all_archs']:
|
||||
if arch == 'x86_64':
|
||||
arch_sources = [
|
||||
'asm_hello'
|
||||
]
|
||||
elif arch == 'aarch64':
|
||||
arch_sources = [
|
||||
'asm_hello'
|
||||
]
|
||||
else:
|
||||
arch_sources = []
|
||||
arch_sources[:] = [os.path.join('arch', arch, arch_source) for arch_source in arch_sources]
|
||||
for source in sources + arch_sources:
|
||||
exit_status = run(
|
||||
arch=arch,
|
||||
userland=source,
|
||||
emulator=emulator,
|
||||
**extra_args,
|
||||
)
|
||||
if exit_status != 0:
|
||||
raise Exception('Test failed: {} {} {} {}'.format(emulator, arch, source, exit_status))
|
||||
|
||||
if __name__ == '__main__':
|
||||
Main().cli()
|
||||
Reference in New Issue
Block a user