mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 20:14:27 +01:00
baremetal: stat preparing to make perfect like userland/
This commit is contained in:
1
baremetal/assert_fail.c
Symbolic link
1
baremetal/assert_fail.c
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../lkmc/assert_fail.c
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
/* Test that input request through serial also works. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
This folder contains examples that are not very testable: either are supposed to return 0, or are interactive, etc.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../lkmc/assert_fail.c
|
|
||||||
@@ -108,8 +108,8 @@ Build the baremetal examples with crosstool-NG.
|
|||||||
[self.env['gcc'], LF] +
|
[self.env['gcc'], LF] +
|
||||||
cflags +
|
cflags +
|
||||||
[
|
[
|
||||||
'-c', LF,
|
|
||||||
'-D', 'UART0_ADDR={:#x}'.format(uart_address), LF,
|
'-D', 'UART0_ADDR={:#x}'.format(uart_address), LF,
|
||||||
|
'-c', LF,
|
||||||
'-o', obj, LF,
|
'-o', obj, LF,
|
||||||
src, LF,
|
src, LF,
|
||||||
] +
|
] +
|
||||||
|
|||||||
@@ -5,39 +5,47 @@ import os
|
|||||||
from shell_helpers import LF
|
from shell_helpers import LF
|
||||||
|
|
||||||
class PathProperties:
|
class PathProperties:
|
||||||
property_keys = {
|
default_properties = {
|
||||||
'allowed_archs',
|
'allowed_archs': None,
|
||||||
'c_std',
|
'c_std': default_c_std,
|
||||||
'cc_flags',
|
'cc_flags': [
|
||||||
'cc_flags_after',
|
'-Wall', LF,
|
||||||
'cc_pedantic',
|
'-Werror', LF,
|
||||||
'cxx_std',
|
'-Wextra', LF,
|
||||||
'exit_status',
|
'-Wno-unused-function', LF,
|
||||||
'interactive',
|
'-fopenmp', LF,
|
||||||
|
'-ggdb3', LF,
|
||||||
|
],
|
||||||
|
'cc_flags_after': [],
|
||||||
|
'cc_pedantic': True,
|
||||||
|
'cxx_std': default_cxx_std,
|
||||||
|
'exit_status': 0,
|
||||||
|
'extra_objs_baremetal_bootloader': False,
|
||||||
# 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',
|
'extra_objs_lkmc_common': False,
|
||||||
'extra_objs_userland_asm',
|
'extra_objs_userland_asm': False,
|
||||||
# We were lazy to properly classify why we are skipping these tests.
|
'interactive': False,
|
||||||
# TODO get it done.
|
|
||||||
'skip_run_unclassified',
|
|
||||||
# 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',
|
'more_than_1s': False,
|
||||||
# The path does not generate an executable in itself, e.g.
|
# The path does not generate an executable in itself, e.g.
|
||||||
# it only generates intermediate object files.
|
# it only generates intermediate object files.
|
||||||
'no_executable',
|
'no_executable': False,
|
||||||
# The script requires a non-trivial argument to be passed to run properly.
|
|
||||||
'requires_argument',
|
|
||||||
# the test receives a signal. We skip those tests for now,
|
# the test receives a signal. We skip those tests for now,
|
||||||
# on userland because we are lazy to figure out the exact semantics
|
# on userland because we are lazy to figure out the exact semantics
|
||||||
# of how Python + QEMU + gem5 determine the exit status of signals.
|
# of how Python + QEMU + gem5 determine the exit status of signals.
|
||||||
'receives_signal',
|
'receives_signal': False,
|
||||||
|
# The script requires a non-trivial argument to be passed to run properly.
|
||||||
|
'requires_argument': False,
|
||||||
# Requires certain of our custom kernel modules to be inserted to run.
|
# Requires certain of our custom kernel modules to be inserted to run.
|
||||||
'requires_kernel_modules',
|
'requires_kernel_modules': False,
|
||||||
# The example requires sudo, which usually implies that it can do something
|
# The example requires sudo, which usually implies that it can do something
|
||||||
# deeply to the system it runs on, which would preventing further interactive
|
# deeply to the system it runs on, which would preventing further interactive
|
||||||
# or test usage of the system, for example poweroff or messing up the GUI.
|
# or test usage of the system, for example poweroff or messing up the GUI.
|
||||||
'requires_sudo',
|
'requires_sudo': False,
|
||||||
'uses_dynamic_library',
|
# We were lazy to properly classify why we are skipping these tests.
|
||||||
|
# TODO get it done.
|
||||||
|
'skip_run_unclassified': False,
|
||||||
|
'uses_dynamic_library': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -50,7 +58,7 @@ class PathProperties:
|
|||||||
properties
|
properties
|
||||||
):
|
):
|
||||||
for key in properties:
|
for key in properties:
|
||||||
if not key in self.property_keys:
|
if not key in self.default_properties:
|
||||||
raise ValueError('Unknown key: {}'.format(key))
|
raise ValueError('Unknown key: {}'.format(key))
|
||||||
self.properties = properties.copy()
|
self.properties = properties.copy()
|
||||||
|
|
||||||
@@ -151,39 +159,46 @@ freestanding_properties = {
|
|||||||
}
|
}
|
||||||
# See: https://github.com/cirosantilli/linux-kernel-module-cheat#user-mode-simulation-path_properties
|
# See: https://github.com/cirosantilli/linux-kernel-module-cheat#user-mode-simulation-path_properties
|
||||||
path_properties_tuples = (
|
path_properties_tuples = (
|
||||||
|
PathProperties.default_properties,
|
||||||
{
|
{
|
||||||
'allowed_archs': None,
|
'baremetal': (
|
||||||
'c_std': default_c_std,
|
|
||||||
'cc_flags': [
|
|
||||||
'-Wall', LF,
|
|
||||||
'-Werror', LF,
|
|
||||||
'-Wextra', LF,
|
|
||||||
'-Wno-unused-function', LF,
|
|
||||||
'-fopenmp', LF,
|
|
||||||
'-ggdb3', LF,
|
|
||||||
],
|
|
||||||
'cc_flags_after': [
|
|
||||||
'-lm', LF,
|
|
||||||
'-pthread', LF,
|
|
||||||
],
|
|
||||||
'cc_pedantic': True,
|
|
||||||
'cxx_std': default_cxx_std,
|
|
||||||
'exit_status': 0,
|
|
||||||
'extra_objs_lkmc_common': False,
|
|
||||||
'extra_objs_userland_asm': False,
|
|
||||||
'interactive': False,
|
|
||||||
'more_than_1s': False,
|
|
||||||
'no_executable': False,
|
|
||||||
'receives_signal': False,
|
|
||||||
'requires_argument': False,
|
|
||||||
'requires_kernel_modules': False,
|
|
||||||
'requires_sudo': False,
|
|
||||||
'skip_run_unclassified': False,
|
|
||||||
'uses_dynamic_library': False,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'userland': (
|
|
||||||
{},
|
{},
|
||||||
|
{
|
||||||
|
'arch': (
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
'arm': (
|
||||||
|
{'allowed_archs': {'arm'}},
|
||||||
|
{
|
||||||
|
'no_bootloader': {'extra_objs_baremetal_bootloader': False},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'aarch64': (
|
||||||
|
{'allowed_archs': {'aarch64'}},
|
||||||
|
{
|
||||||
|
'no_bootloader': {'extra_objs_baremetal_bootloader': False},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
'assert_fail.c': {'exit_status': 1},
|
||||||
|
'exit1.c': {'exit_status': 1},
|
||||||
|
'infinite_loop.c': {'more_than_1s': True},
|
||||||
|
'lib': (
|
||||||
|
{'no_executable': True},
|
||||||
|
{}
|
||||||
|
),
|
||||||
|
'getchar.c': {'interactive': True},
|
||||||
|
'return1.c': {'exit_status': 1},
|
||||||
|
}
|
||||||
|
),
|
||||||
|
'userland': (
|
||||||
|
{
|
||||||
|
'cc_flags_after': [
|
||||||
|
'-lm', LF,
|
||||||
|
'-pthread', LF,
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'arch': (
|
'arch': (
|
||||||
{
|
{
|
||||||
@@ -306,9 +321,9 @@ path_properties_tuples = (
|
|||||||
'sleep_forever.c': {'more_than_1s': True},
|
'sleep_forever.c': {'more_than_1s': True},
|
||||||
'virt_to_phys_test.c': {'more_than_1s': True},
|
'virt_to_phys_test.c': {'more_than_1s': True},
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
path_properties_tree = PrefixTree.make_from_tuples(path_properties_tuples)
|
path_properties_tree = PrefixTree.make_from_tuples(path_properties_tuples)
|
||||||
|
|||||||
Reference in New Issue
Block a user