diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-07-28 09:35:14 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-08-12 10:13:59 +0300 |
commit | 57cee4649c3950675a50b56c5ab1b62fbb022e5f (patch) | |
tree | 1eb8deef45af35dce5dbc24fa63bcf7fbcdfa60b | |
parent | Print version, compiler id and version, and cpuid on boot (diff) | |
download | kernel-57cee4649c3950675a50b56c5ab1b62fbb022e5f.tar.xz |
Enable coverage report
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | arch/i686/toolchain.ini | 2 | ||||
-rw-r--r-- | lib/memcpy.c | 4 | ||||
-rw-r--r-- | lib/memset.c | 4 | ||||
-rw-r--r-- | lib/meson.build | 11 | ||||
-rw-r--r-- | meson.build | 19 |
6 files changed, 34 insertions, 12 deletions
@@ -11,6 +11,12 @@ meson setup --cross-file=arch/i686/toolchain.ini build ``` +## code coverage +```sh +ninja test +ninja coverage-html +``` + # musl - arch/i686/include/sys/io.h - lib/string/itoa.c diff --git a/arch/i686/toolchain.ini b/arch/i686/toolchain.ini index bad3095..5114cfe 100644 --- a/arch/i686/toolchain.ini +++ b/arch/i686/toolchain.ini @@ -13,6 +13,6 @@ ar = 'i686-elf-ar' strip = 'i686-elf-strip' [built-in options] -c_args = ['-fanalyzer', '-ffreestanding'] +c_args = ['-ffreestanding'] c_link_args = ['-nostdlib'] diff --git a/lib/memcpy.c b/lib/memcpy.c index c648501..059738f 100644 --- a/lib/memcpy.c +++ b/lib/memcpy.c @@ -6,7 +6,7 @@ * @return */ void * -memcpy(void *restrict dest, const void *restrict src, unsigned n) +memcpy(void *restrict dest, const void *restrict src, long unsigned n) { char *pDest = (char *)dest; const char *pSrc = (const char *)src; @@ -17,4 +17,4 @@ memcpy(void *restrict dest, const void *restrict src, unsigned n) } return dest; -}
\ No newline at end of file +} diff --git a/lib/memset.c b/lib/memset.c index 442a305..670e4b6 100644 --- a/lib/memset.c +++ b/lib/memset.c @@ -6,9 +6,9 @@ * @return */ void * -memset(void *s, char c, unsigned n) +memset(void *s, int c, long unsigned n) { char *pDest = (char *)s; for (unsigned i = 0; i < n; ++i) pDest[i] = c; return s; -}
\ No newline at end of file +} diff --git a/lib/meson.build b/lib/meson.build new file mode 100644 index 0000000..841c050 --- /dev/null +++ b/lib/meson.build @@ -0,0 +1,11 @@ +libk_srcs = ['memcpy.c', 'memset.c', 'string/itoa.c'] + +libk = static_library('k', [libk_srcs, 'stdio/printf.c'], + include_directories: ['.', '..'], + override_options: 'b_coverage=false' +) + +library('tk', libk_srcs, + include_directories: ['.', '..'], + native: true +) diff --git a/meson.build b/meson.build index 9896e66..2966733 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,11 @@ -project('glitch kernel', 'c', version: '0.0.0', default_options: ['c_std=gnu11', 'warning_level=2']) -python3 = import('python').find_installation('python3') +project('glitch kernel', 'c', version: '0.0.0', default_options: ['c_std=gnu11', 'warning_level=2', 'b_coverage=true']) + cc = meson.get_compiler('c') +if(cc.has_argument('-fanalyzer')) + add_project_arguments('-fanalyzer', language: 'c') +endif +python3 = import('python').find_installation('python3') +qemu = find_program('qemu-system-i386') conf = configuration_data() conf.set_quoted('VERSION', run_command(['git', 'describe', '--long'], capture: true, check: true).stdout().strip()) @@ -9,14 +14,15 @@ configure_file(output: 'conf.h', configuration: conf) subdir('arch/i686') subdir('devices') +subdir('lib') kernel = executable('glitch.elf', ['src/multiboot2.c', 'src/mmap.c', 'src/kernel.c', - 'src/isr.c', 'src/mem/vmm.c', - 'lib/string/itoa.c', 'lib/stdio/printf.c'], + 'src/isr.c', 'src/mem/vmm.c'], + link_with: [libk], link_language: 'c', - link_args: ['-ffreestanding', '-static', '-T', meson.current_source_dir()/'arch/i686/linker.ld'], - install: true, native: false, + link_args: ['-static', '-T', meson.current_source_dir()/'arch/i686/linker.ld'], + install: true, native: false, override_options: ['b_coverage=false'], include_directories: [ include_directories('grub/include', is_system: true), include_directories('lib') @@ -28,5 +34,4 @@ glitch_iso = custom_target('glitch.iso', input: 'scripts/mkiso.py', output: 'glitch.iso', depends: [kernel], command: [python3, '@INPUT@', kernel, '@SOURCE_ROOT@/grub/grub.cfg']) -qemu = find_program('qemu-system-i386') run_target('run', depends: glitch_iso, command: [qemu, '-cdrom', 'glitch.iso', '-accel', 'kvm']) |