mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
common: rename _src_ to _source_ everywhere
This commit is contained in:
16
README.adoc
16
README.adoc
@@ -535,7 +535,7 @@ You have to checkout to the latest tag to ensure that the scripts match the rele
|
||||
Be saner and use our custom built QEMU instead:
|
||||
|
||||
....
|
||||
git submodule update --init --recursive "$(./getvar qemu_src_dir)"
|
||||
git submodule update --init --recursive "$(./getvar qemu_source_dir)"
|
||||
./build-qemu
|
||||
./run
|
||||
....
|
||||
@@ -656,7 +656,7 @@ which is equivalent to:
|
||||
Or just remove the `.c` extension from the failing files and try again:
|
||||
|
||||
....
|
||||
cd "$(./getvar kernel_modules_src_dir)"
|
||||
cd "$(./getvar kernel_modules_source_dir)"
|
||||
mv broken.c broken.c~
|
||||
....
|
||||
|
||||
@@ -9249,7 +9249,7 @@ A few workarounds are:
|
||||
If you do this, don't forget to do a:
|
||||
+
|
||||
....
|
||||
cd "$(./getvar parsec_src_dir)"
|
||||
cd "$(./getvar parsec_source_dir)"
|
||||
git clean -xdf .
|
||||
....
|
||||
before going for the cross compile build.
|
||||
@@ -11521,9 +11521,9 @@ Analogous to the <<linux-kernel-build-variants>> but with the `--qemu-build-id`
|
||||
|
||||
....
|
||||
./build-qemu
|
||||
git -C "$(./getvar qemu_src_dir)" checkout v2.12.0
|
||||
git -C "$(./getvar qemu_source_dir)" checkout v2.12.0
|
||||
./build-qemu --qemu-build-id v2.12.0
|
||||
git -C "$(./getvar qemu_src_dir)" checkout -
|
||||
git -C "$(./getvar qemu_source_dir)" checkout -
|
||||
./run
|
||||
./run --qemu-build-id v2.12.0
|
||||
....
|
||||
@@ -11656,9 +11656,9 @@ Analogous to the <<linux-kernel-build-variants>> but with the `--build-id` optio
|
||||
|
||||
....
|
||||
./build-buildroot
|
||||
git -C "$(./getvar buildroot_src_dir)" checkout 2018.05
|
||||
git -C "$(./getvar buildroot_source_dir)" checkout 2018.05
|
||||
./build-buildroot --buildroot-build-id 2018.05
|
||||
git -C "$(./getvar buildroot_src_dir)" checkout -
|
||||
git -C "$(./getvar buildroot_source_dir)" checkout -
|
||||
./run
|
||||
./run --buildroot-build-id 2018.05
|
||||
....
|
||||
@@ -11956,7 +11956,7 @@ We then bisected it as explained at: https://stackoverflow.com/questions/4713088
|
||||
|
||||
....
|
||||
root_dir="$(pwd)"
|
||||
cd "$(./getvar qemu_src_dir)"
|
||||
cd "$(./getvar qemu_source_dir)"
|
||||
git bisect start
|
||||
|
||||
# Check that our test script fails on v3.0.0-rc3 as expected, and mark it as bad.
|
||||
|
||||
@@ -100,7 +100,7 @@ if "$bench_gem5_build"; then
|
||||
common_arch="$default_arch"
|
||||
gem5_build_id=bench
|
||||
common_gem5_build_dir="$("$getvar" --arch "$common_arch" --gem5-build-id "$gem5_build_id" gem5_build_dir)"
|
||||
common_gem5_source_dir="$("$getvar" --arch "$common_arch" --gem5-build-id "$gem5_build_id" gem5_src_dir)"
|
||||
common_gem5_source_dir="$("$getvar" --arch "$common_arch" --gem5-build-id "$gem5_build_id" gem5_source_dir)"
|
||||
results_file="${common_gem5_build_dir}/lkmc-bench-build.txt"
|
||||
git -C "${common_gem5_source_dir}" clean -xdf
|
||||
rm -f "$results_file"
|
||||
|
||||
2
build
2
build
@@ -461,7 +461,7 @@ Which components to build. Default: qemu-buildroot
|
||||
|
||||
# Do the build.
|
||||
for component in selected_components:
|
||||
component.build(self.env['archs'][0])
|
||||
component.build(self.env['arch'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
Main().cli()
|
||||
|
||||
@@ -20,11 +20,11 @@ Build the baremetal examples with crosstool-NG.
|
||||
common_src = os.path.join(self.env['root_dir'], common_basename_noext + self.env['c_ext'])
|
||||
common_obj = os.path.join(self.env['baremetal_build_lib_dir'], common_basename_noext + self.env['obj_ext'])
|
||||
syscalls_basename_noext = 'syscalls'
|
||||
syscalls_src = os.path.join(self.env['baremetal_src_lib_dir'], syscalls_basename_noext + self.env['c_ext'])
|
||||
syscalls_src = os.path.join(self.env['baremetal_source_lib_dir'], syscalls_basename_noext + self.env['c_ext'])
|
||||
syscalls_obj = os.path.join(self.env['baremetal_build_lib_dir'], syscalls_basename_noext + self.env['obj_ext'])
|
||||
common_objs = [common_obj, syscalls_obj]
|
||||
cflags = [
|
||||
'-I', self.env['baremetal_src_lib_dir'], LF,
|
||||
'-I', self.env['baremetal_source_lib_dir'], LF,
|
||||
'-I', self.env['root_dir'], LF,
|
||||
'-O0', LF,
|
||||
'-ggdb3', LF,
|
||||
@@ -51,7 +51,7 @@ Build the baremetal examples with crosstool-NG.
|
||||
uart_address = 0x09000000
|
||||
os.makedirs(build_dir, exist_ok=True)
|
||||
os.makedirs(self.env['baremetal_build_lib_dir'], exist_ok=True)
|
||||
src = os.path.join(self.env['baremetal_src_lib_dir'], '{}{}'.format(self.env['arch'], self.env['asm_ext']))
|
||||
src = os.path.join(self.env['baremetal_source_lib_dir'], '{}{}'.format(self.env['arch'], self.env['asm_ext']))
|
||||
if self.need_rebuild([src], bootloader_obj):
|
||||
self.sh.run_cmd(
|
||||
[gcc, LF] +
|
||||
@@ -93,9 +93,9 @@ Build the baremetal examples with crosstool-NG.
|
||||
bootloader_obj=bootloader_obj,
|
||||
common_objs=common_objs,
|
||||
)
|
||||
if os.path.isdir(os.path.join(self.env['baremetal_src_arch_dir'])):
|
||||
if os.path.isdir(os.path.join(self.env['baremetal_source_arch_dir'])):
|
||||
self._build_dir(
|
||||
self.env['baremetal_src_arch_subpath'],
|
||||
self.env['baremetal_source_arch_subpath'],
|
||||
gcc=gcc,
|
||||
cflags=cflags,
|
||||
entry_address=entry_address,
|
||||
@@ -103,7 +103,7 @@ Build the baremetal examples with crosstool-NG.
|
||||
common_objs=common_objs,
|
||||
)
|
||||
arch_dir = os.path.join('arch', self.env['arch'], 'no_bootloader')
|
||||
if os.path.isdir(os.path.join(self.env['baremetal_src_dir'], arch_dir)):
|
||||
if os.path.isdir(os.path.join(self.env['baremetal_source_dir'], arch_dir)):
|
||||
self._build_dir(
|
||||
arch_dir,
|
||||
gcc=gcc,
|
||||
@@ -133,7 +133,7 @@ Build the baremetal examples with crosstool-NG.
|
||||
|
||||
Place outputs on the same subpath or the output directory.
|
||||
'''
|
||||
in_dir = os.path.join(self.env['baremetal_src_dir'], subpath)
|
||||
in_dir = os.path.join(self.env['baremetal_source_dir'], subpath)
|
||||
out_dir = os.path.join(self.env['baremetal_build_dir'], subpath)
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
common_objs = common_objs.copy()
|
||||
@@ -144,7 +144,7 @@ Build the baremetal examples with crosstool-NG.
|
||||
if os.path.isfile(in_path) and os.path.splitext(in_basename)[1] in (self.env['c_ext'], self.env['asm_ext']):
|
||||
in_name = os.path.splitext(in_basename)[0]
|
||||
main_obj = os.path.join(self.env['baremetal_build_dir'], subpath, '{}{}'.format(in_name, self.env['obj_ext']))
|
||||
src = os.path.join(self.env['baremetal_src_dir'], in_path)
|
||||
src = os.path.join(self.env['baremetal_source_dir'], in_path)
|
||||
if self.need_rebuild([src], main_obj):
|
||||
self.sh.run_cmd(
|
||||
[gcc, LF] +
|
||||
@@ -157,7 +157,7 @@ Build the baremetal examples with crosstool-NG.
|
||||
)
|
||||
objs = common_objs + [main_obj]
|
||||
out = os.path.join(self.env['baremetal_build_dir'], subpath, in_name + self.env['baremetal_build_ext'])
|
||||
link_script = os.path.join(self.env['baremetal_src_dir'], 'link.ld')
|
||||
link_script = os.path.join(self.env['baremetal_source_dir'], 'link.ld')
|
||||
if self.need_rebuild(objs + [link_script], out):
|
||||
self.sh.run_cmd(
|
||||
[gcc, LF] +
|
||||
|
||||
@@ -97,7 +97,7 @@ usually extra Buildroot targets.
|
||||
'BR2_EXTERNAL={}'.format(br2_external_str), LF,
|
||||
defconfig, LF,
|
||||
],
|
||||
cwd=self.env['buildroot_src_dir'],
|
||||
cwd=self.env['buildroot_source_dir'],
|
||||
)
|
||||
configs = self.env['config']
|
||||
configs.extend([
|
||||
@@ -143,7 +143,7 @@ usually extra Buildroot targets.
|
||||
'O={}'.format(self.env['buildroot_build_dir']), LF,
|
||||
'olddefconfig', LF,
|
||||
],
|
||||
cwd=self.env['buildroot_src_dir'],
|
||||
cwd=self.env['buildroot_source_dir'],
|
||||
)
|
||||
self.make_build_dirs()
|
||||
if not self.env['no_all']:
|
||||
@@ -152,7 +152,7 @@ usually extra Buildroot targets.
|
||||
[
|
||||
'make', LF,
|
||||
'LKMC_GEM5_SRCDIR="{}"'.format(self.env['gem5_source_dir']), LF,
|
||||
'LKMC_PARSEC_BENCHMARK_SRCDIR="{}"'.format(self.env['parsec_benchmark_src_dir']), LF,
|
||||
'LKMC_PARSEC_BENCHMARK_SRCDIR="{}"'.format(self.env['parsec_benchmark_source_dir']), LF,
|
||||
'O={}'.format(self.env['buildroot_build_dir']), LF,
|
||||
'V={}'.format(int(self.env['verbose'])), LF,
|
||||
] +
|
||||
@@ -160,7 +160,7 @@ usually extra Buildroot targets.
|
||||
,
|
||||
out_file=os.path.join(self.env['buildroot_build_dir'], 'lkmc.log'),
|
||||
delete_env=['LD_LIBRARY_PATH'],
|
||||
cwd=self.env['buildroot_src_dir'],
|
||||
cwd=self.env['buildroot_source_dir'],
|
||||
)
|
||||
# Create the qcow2 from ext2.
|
||||
# Skip if qemu is not present, because gem5 does not need the qcow2.
|
||||
@@ -172,7 +172,7 @@ usually extra Buildroot targets.
|
||||
return self.env['buildroot_build_dir']
|
||||
|
||||
def _path_relative_to_buildroot(self, abspath):
|
||||
return os.path.relpath(abspath, self.env['buildroot_src_dir'])
|
||||
return os.path.relpath(abspath, self.env['buildroot_source_dir'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
Main().cli()
|
||||
|
||||
@@ -22,14 +22,14 @@ Build crosstool-NG with Newlib for bare metal compilation
|
||||
|
||||
# Bootstrap out-ot-tree WONTFIX. I've tried.
|
||||
# https://github.com/crosstool-ng/crosstool-ng/issues/1021
|
||||
os.chdir(self.env['crosstool_ng_src_dir'])
|
||||
os.chdir(self.env['crosstool_ng_source_dir'])
|
||||
self.sh.run_cmd(
|
||||
[os.path.join(self.env['crosstool_ng_src_dir'], 'bootstrap'), LF],
|
||||
[os.path.join(self.env['crosstool_ng_source_dir'], 'bootstrap'), LF],
|
||||
)
|
||||
os.chdir(self.env['crosstool_ng_util_dir'])
|
||||
self.sh.run_cmd(
|
||||
[
|
||||
os.path.join(self.env['crosstool_ng_src_dir'], 'configure'), LF,
|
||||
os.path.join(self.env['crosstool_ng_source_dir'], 'configure'), LF,
|
||||
'--enable-local', LF,
|
||||
],
|
||||
)
|
||||
|
||||
22
build-gem5
22
build-gem5
@@ -24,11 +24,11 @@ class Main(common.BuildCliFunction):
|
||||
os.makedirs(disks_dir, exist_ok=True)
|
||||
if self.env['gem5_source_dir'] is None:
|
||||
if not os.path.exists(os.path.join(self.env['gem5_source_dir'], '.git')):
|
||||
if self.env['gem5_source_dir'] == self.env['gem5_default_src_dir']:
|
||||
if self.env['gem5_source_dir'] == self.env['gem5_default_source_dir']:
|
||||
raise Exception('gem5 submodule not checked out')
|
||||
self.sh.run_cmd([
|
||||
'git', LF,
|
||||
'-C', self.env['gem5_default_src_dir'], LF,
|
||||
'-C', self.env['gem5_default_source_dir'], LF,
|
||||
'worktree', 'add', LF,
|
||||
'-b', os.path.join('wt', self.env['gem5_build_id']), LF,
|
||||
self.env['gem5_source_dir'], LF,
|
||||
@@ -49,20 +49,20 @@ class Main(common.BuildCliFunction):
|
||||
# I'm not even joking. No one has ever built x86 gem5 without the magic dist dir present.
|
||||
pass
|
||||
elif self.env['arch'] == 'arm' or self.env['arch'] == 'aarch64':
|
||||
gem5_system_src_dir = os.path.join(self.env['gem5_source_dir'], 'system')
|
||||
gem5_system_source_dir = os.path.join(self.env['gem5_source_dir'], 'system')
|
||||
|
||||
# dtb
|
||||
dt_src_dir = os.path.join(gem5_system_src_dir, 'arm', 'dt')
|
||||
dt_source_dir = os.path.join(gem5_system_source_dir, 'arm', 'dt')
|
||||
dt_build_dir = os.path.join(self.env['gem5_system_dir'], 'arm', 'dt')
|
||||
self.sh.run_cmd(['make', '-C', dt_src_dir, LF])
|
||||
self.sh.run_cmd(['make', '-C', dt_source_dir, LF])
|
||||
self.sh.copy_dir_if_update_non_recursive(
|
||||
srcdir=dt_src_dir,
|
||||
srcdir=dt_source_dir,
|
||||
destdir=dt_build_dir,
|
||||
filter_ext='.dtb',
|
||||
)
|
||||
|
||||
# Bootloader 32.
|
||||
bootloader32_dir = os.path.join(gem5_system_src_dir, 'arm', 'simple_bootloader')
|
||||
bootloader32_dir = os.path.join(gem5_system_source_dir, 'arm', 'simple_bootloader')
|
||||
# TODO use the buildroot cross compiler here, and remove the dependencies from configure.
|
||||
self.sh.run_cmd([
|
||||
'make', LF,
|
||||
@@ -73,7 +73,7 @@ class Main(common.BuildCliFunction):
|
||||
self.sh.cp(os.path.join(bootloader32_dir, 'boot_emm.arm'), binaries_dir)
|
||||
|
||||
# Bootloader 64.
|
||||
bootloader64_dir = os.path.join(gem5_system_src_dir, 'arm', 'aarch64_bootloader')
|
||||
bootloader64_dir = os.path.join(gem5_system_source_dir, 'arm', 'aarch64_bootloader')
|
||||
# TODO cross_compile is ignored because the make does not use CC...
|
||||
self.sh.run_cmd(['make', '-C', bootloader64_dir, LF])
|
||||
self.sh.cp(os.path.join(bootloader64_dir, 'boot_emm.arm64'), binaries_dir)
|
||||
@@ -92,9 +92,9 @@ class Main(common.BuildCliFunction):
|
||||
cwd=self.env['gem5_source_dir'],
|
||||
extra_paths=[self.env['ccache_dir']],
|
||||
)
|
||||
term_src_dir = os.path.join(self.env['gem5_source_dir'], 'util/term')
|
||||
m5term_build = os.path.join(term_src_dir, 'm5term')
|
||||
self.sh.run_cmd(['make', '-C', term_src_dir, LF])
|
||||
term_source_dir = os.path.join(self.env['gem5_source_dir'], 'util/term')
|
||||
m5term_build = os.path.join(term_source_dir, 'm5term')
|
||||
self.sh.run_cmd(['make', '-C', term_source_dir, LF])
|
||||
if os.path.exists(self.env['gem5_m5term']):
|
||||
# Otherwise self.sh.cp would fail with "Text file busy" if you
|
||||
# tried to rebuild while running m5term:
|
||||
|
||||
@@ -47,18 +47,18 @@ Use the host packaged cross toolchain.
|
||||
# This copies only modified files as per:
|
||||
# https://stackoverflow.com/questions/5718899/building-an-out-of-tree-linux-kernel-module-in-a-separate-object-directory
|
||||
distutils.dir_util.copy_tree(
|
||||
self.env['kernel_modules_src_dir'],
|
||||
self.env['kernel_modules_source_dir'],
|
||||
os.path.join(build_dir, self.env['kernel_modules_subdir']),
|
||||
update=1,
|
||||
)
|
||||
distutils.dir_util.copy_tree(
|
||||
self.env['include_src_dir'],
|
||||
self.env['include_source_dir'],
|
||||
os.path.join(build_dir, self.env['include_subdir']),
|
||||
update=1,
|
||||
)
|
||||
all_kernel_modules = []
|
||||
for basename in os.listdir(self.env['kernel_modules_src_dir']):
|
||||
src = os.path.join(self.env['kernel_modules_src_dir'], basename)
|
||||
for basename in os.listdir(self.env['kernel_modules_source_dir']):
|
||||
src = os.path.join(self.env['kernel_modules_source_dir'], basename)
|
||||
if os.path.isfile(src):
|
||||
noext, ext = os.path.splitext(basename)
|
||||
if ext == self.env['c_ext']:
|
||||
|
||||
@@ -33,7 +33,7 @@ class Main(common.BuildCliFunction):
|
||||
target_list = '{}-softmmu'.format(self.env['arch'])
|
||||
self.sh.run_cmd(
|
||||
[
|
||||
os.path.join(self.env['qemu_src_dir'], 'configure'), LF,
|
||||
os.path.join(self.env['qemu_source_dir'], 'configure'), LF,
|
||||
'--enable-debug', LF,
|
||||
'--enable-trace-backends=simple', LF,
|
||||
'--target-list={}'.format(target_list), LF,
|
||||
|
||||
43
common.py
43
common.py
@@ -35,7 +35,7 @@ consts['in_docker'] = os.path.exists('/.dockerenv')
|
||||
consts['root_dir'] = os.path.dirname(os.path.abspath(__file__))
|
||||
consts['data_dir'] = os.path.join(consts['root_dir'], 'data')
|
||||
consts['p9_dir'] = os.path.join(consts['data_dir'], '9p')
|
||||
consts['gem5_non_default_src_root_dir'] = os.path.join(consts['data_dir'], 'gem5')
|
||||
consts['gem5_non_default_source_root_dir'] = os.path.join(consts['data_dir'], 'gem5')
|
||||
if consts['in_docker']:
|
||||
consts['out_dir'] = os.path.join(consts['root_dir'], 'out.docker')
|
||||
else:
|
||||
@@ -49,23 +49,23 @@ consts['crosstool_ng_out_dir'] = os.path.join(consts['out_dir'], 'crosstool-ng')
|
||||
consts['bench_boot'] = os.path.join(consts['out_dir'], 'bench-boot.txt')
|
||||
consts['packages_dir'] = os.path.join(consts['root_dir'], 'buildroot_packages')
|
||||
consts['kernel_modules_subdir'] = 'kernel_modules'
|
||||
consts['kernel_modules_src_dir'] = os.path.join(consts['root_dir'], consts['kernel_modules_subdir'])
|
||||
consts['kernel_modules_source_dir'] = os.path.join(consts['root_dir'], consts['kernel_modules_subdir'])
|
||||
consts['userland_subdir'] = 'userland'
|
||||
consts['userland_source_dir'] = os.path.join(consts['root_dir'], consts['userland_subdir'])
|
||||
consts['userland_build_ext'] = '.out'
|
||||
consts['include_subdir'] = 'include'
|
||||
consts['include_src_dir'] = os.path.join(consts['root_dir'], consts['include_subdir'])
|
||||
consts['include_source_dir'] = os.path.join(consts['root_dir'], consts['include_subdir'])
|
||||
consts['submodules_dir'] = os.path.join(consts['root_dir'], 'submodules')
|
||||
consts['buildroot_src_dir'] = os.path.join(consts['submodules_dir'], 'buildroot')
|
||||
consts['crosstool_ng_src_dir'] = os.path.join(consts['submodules_dir'], 'crosstool-ng')
|
||||
consts['buildroot_source_dir'] = os.path.join(consts['submodules_dir'], 'buildroot')
|
||||
consts['crosstool_ng_source_dir'] = os.path.join(consts['submodules_dir'], 'crosstool-ng')
|
||||
consts['crosstool_ng_supported_archs'] = set(['arm', 'aarch64'])
|
||||
consts['linux_source_dir'] = os.path.join(consts['submodules_dir'], 'linux')
|
||||
consts['linux_config_dir'] = os.path.join(consts['root_dir'], 'linux_config')
|
||||
consts['gem5_default_src_dir'] = os.path.join(consts['submodules_dir'], 'gem5')
|
||||
consts['gem5_default_source_dir'] = os.path.join(consts['submodules_dir'], 'gem5')
|
||||
consts['rootfs_overlay_dir'] = os.path.join(consts['root_dir'], 'rootfs_overlay')
|
||||
consts['extract_vmlinux'] = os.path.join(consts['linux_source_dir'], 'scripts', 'extract-vmlinux')
|
||||
consts['qemu_src_dir'] = os.path.join(consts['submodules_dir'], 'qemu')
|
||||
consts['parsec_benchmark_src_dir'] = os.path.join(consts['submodules_dir'], 'parsec-benchmark')
|
||||
consts['qemu_source_dir'] = os.path.join(consts['submodules_dir'], 'qemu')
|
||||
consts['parsec_benchmark_source_dir'] = os.path.join(consts['submodules_dir'], 'parsec-benchmark')
|
||||
consts['ccache_dir'] = os.path.join('/usr', 'lib', 'ccache')
|
||||
consts['default_build_id'] = 'default'
|
||||
consts['arch_short_to_long_dict'] = collections.OrderedDict([
|
||||
@@ -473,9 +473,9 @@ Valid emulators: {}
|
||||
assert os.path.exists(env['gem5_source_dir'])
|
||||
else:
|
||||
if env['gem5_worktree'] is not None:
|
||||
env['gem5_source_dir'] = join(env['gem5_non_default_src_root_dir'], env['gem5_worktree'])
|
||||
env['gem5_source_dir'] = join(env['gem5_non_default_source_root_dir'], env['gem5_worktree'])
|
||||
else:
|
||||
env['gem5_source_dir'] = env['gem5_default_src_dir']
|
||||
env['gem5_source_dir'] = env['gem5_default_source_dir']
|
||||
env['gem5_m5_source_dir'] = join(env['gem5_source_dir'], 'util', 'm5')
|
||||
env['gem5_config_dir'] = join(env['gem5_source_dir'], 'configs')
|
||||
env['gem5_se_file'] = join(env['gem5_config_dir'], 'example', 'se.py')
|
||||
@@ -574,10 +574,10 @@ Valid emulators: {}
|
||||
env['out_rootfs_overlay_bin_dir'] = join(env['out_rootfs_overlay_dir'], 'bin')
|
||||
|
||||
# Baremetal.
|
||||
env['baremetal_src_dir'] = join(env['root_dir'], 'baremetal')
|
||||
env['baremetal_src_arch_subpath'] = join('arch', env['arch'])
|
||||
env['baremetal_src_arch_dir'] = join(env['baremetal_src_dir'], env['baremetal_src_arch_subpath'])
|
||||
env['baremetal_src_lib_dir'] = join(env['baremetal_src_dir'], env['baremetal_lib_basename'])
|
||||
env['baremetal_source_dir'] = join(env['root_dir'], 'baremetal')
|
||||
env['baremetal_source_arch_subpath'] = join('arch', env['arch'])
|
||||
env['baremetal_source_arch_dir'] = join(env['baremetal_source_dir'], env['baremetal_source_arch_subpath'])
|
||||
env['baremetal_source_lib_dir'] = join(env['baremetal_source_dir'], env['baremetal_lib_basename'])
|
||||
if env['emulator'] == 'gem5':
|
||||
env['simulator_name'] = 'gem5'
|
||||
else:
|
||||
@@ -614,12 +614,12 @@ Valid emulators: {}
|
||||
else:
|
||||
path = self.resolve_executable(
|
||||
env['baremetal'],
|
||||
env['baremetal_src_dir'],
|
||||
env['baremetal_source_dir'],
|
||||
env['baremetal_build_dir'],
|
||||
env['baremetal_build_ext'],
|
||||
)
|
||||
source_path_noext = os.path.splitext(join(
|
||||
env['baremetal_src_dir'],
|
||||
env['baremetal_source_dir'],
|
||||
os.path.relpath(path, env['baremetal_build_dir'])
|
||||
))[0]
|
||||
for ext in [env['c_ext'], env['asm_ext']]:
|
||||
@@ -670,6 +670,11 @@ Valid emulators: {}
|
||||
return files
|
||||
|
||||
def get_common_args(self):
|
||||
'''
|
||||
These are arguments that might be used by more than one script,
|
||||
and are all defined in this class instead of in the derived class
|
||||
of the script.
|
||||
'''
|
||||
return {key:self.env[key] for key in self._common_args | {'_args_given'}}
|
||||
|
||||
def get_stats(self, stat_re=None, stats_file=None):
|
||||
@@ -765,9 +770,11 @@ Valid emulators: {}
|
||||
def log_error(self, msg):
|
||||
print('error: {}'.format(msg), file=sys.stdout)
|
||||
|
||||
def log_info(self, msg, **kwargs):
|
||||
def log_info(self, msg, flush=False, **kwargs):
|
||||
if not self.env['quiet']:
|
||||
print('{}'.format(msg), **kwargs)
|
||||
if flush:
|
||||
sys.stdout.flush()
|
||||
|
||||
def main(self, *args, **kwargs):
|
||||
'''
|
||||
@@ -930,7 +937,7 @@ Valid emulators: {}
|
||||
end = '\n'
|
||||
else:
|
||||
end = ' '
|
||||
self.log_info(test_id_string, end=end)
|
||||
self.log_info(test_id_string, flush=True, end=end)
|
||||
return test_id_string
|
||||
|
||||
def timed_main(self):
|
||||
|
||||
@@ -10,12 +10,12 @@ from shell_helpers import LF
|
||||
def main():
|
||||
return self.sh.run_cmd(
|
||||
[
|
||||
os.path.join(kwargs['qemu_src_dir'], 'scripts/simpletrace.py'), LF,
|
||||
os.path.join(kwargs['qemu_build_dir'], 'trace-events-all'), LF,
|
||||
os.path.join(kwargs['qemu_trace_file']), LF,
|
||||
os.path.join(self.env['qemu_source_dir'], 'scripts/simpletrace.py'), LF,
|
||||
os.path.join(self.env['qemu_build_dir'], 'trace-events-all'), LF,
|
||||
os.path.join(self.env['qemu_trace_file']), LF,
|
||||
],
|
||||
cmd_file=os.path.join(kwargs['run_dir'], 'qemu-trace2txt'),
|
||||
out_file=kwargs['qemu_trace_txt_file'],
|
||||
cmd_file=os.path.join(self.env['run_dir'], 'qemu-trace2txt'),
|
||||
out_file=self.env['qemu_trace_txt_file'],
|
||||
show_stdout=False,
|
||||
)
|
||||
|
||||
|
||||
7
test-gdb
7
test-gdb
@@ -14,7 +14,6 @@ class Main(common.LkmcCliFunction):
|
||||
)
|
||||
self.add_argument(
|
||||
'tests',
|
||||
metavar='tests',
|
||||
nargs='*',
|
||||
help='''\
|
||||
If given, run only the given tests. Otherwise, run all tests,
|
||||
@@ -28,16 +27,16 @@ found by searching for the Python test files.
|
||||
if self.env['arch'] in self.env['crosstool_ng_supported_archs']:
|
||||
if self.env['tests'] == []:
|
||||
test_scripts_noext = []
|
||||
for f in os.listdir(self.env['baremetal_src_dir']):
|
||||
for f in os.listdir(self.env['baremetal_source_dir']):
|
||||
base, ext = os.path.splitext(f)
|
||||
if ext == '.py':
|
||||
test_scripts_noext.append(base)
|
||||
for root, dirs, files in os.walk(os.path.join(self.env['baremetal_src_dir'], 'arch', self.env['arch'])):
|
||||
for root, dirs, files in os.walk(os.path.join(self.env['baremetal_source_dir'], 'arch', self.env['arch'])):
|
||||
for f in files:
|
||||
base, ext = os.path.splitext(f)
|
||||
if ext == '.py':
|
||||
full_path = os.path.join(root, base)
|
||||
relpath = os.path.relpath(full_path, self.env['baremetal_src_dir'])
|
||||
relpath = os.path.relpath(full_path, self.env['baremetal_source_dir'])
|
||||
test_scripts_noext.append(relpath)
|
||||
else:
|
||||
test_scripts_noext = self.env['tests']
|
||||
|
||||
Reference in New Issue
Block a user