mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 07:06:47 +00:00
🆕 ktest模块
This commit is contained in:
parent
a704fe5cfe
commit
992f292f89
@ -18,7 +18,7 @@ LD_LIST := head.o
|
|||||||
OBJ_LIST := head.o
|
OBJ_LIST := head.o
|
||||||
|
|
||||||
|
|
||||||
kernel_subdirs := common driver process debug filesystem time arch exception mm smp sched syscall
|
kernel_subdirs := common driver process debug filesystem time arch exception mm smp sched syscall ktest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ all: kernel
|
|||||||
|
|
||||||
# 重新链接
|
# 重新链接
|
||||||
echo "Re-Linking kernel..."
|
echo "Re-Linking kernel..."
|
||||||
ld -b elf64-x86-64 -z muldefs -o kernel head.o main.o $(shell find . -name "*.o") -T link.lds
|
ld -b elf64-x86-64 -z muldefs -o kernel head.o main.o $(shell find . -name "*.o") ./debug/kallsyms.o -T link.lds
|
||||||
echo "Generating kernel ELF file..."
|
echo "Generating kernel ELF file..."
|
||||||
# 生成内核文件
|
# 生成内核文件
|
||||||
objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf
|
objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf
|
||||||
|
8
kernel/ktest/Makefile
Normal file
8
kernel/ktest/Makefile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
CFLAGS += -I .
|
||||||
|
|
||||||
|
|
||||||
|
all: bitree.o
|
||||||
|
|
||||||
|
bitree.o: test-bitree.c
|
||||||
|
gcc $(CFLAGS) -c test-bitree.c -o test-bitree.o
|
4
kernel/ktest/ktest.h
Normal file
4
kernel/ktest/ktest.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <common/sys/types.h>
|
||||||
|
|
||||||
|
uint64_t ktest_test_bitree(uint64_t arg);
|
27
kernel/ktest/ktest_utils.h
Normal file
27
kernel/ktest/ktest_utils.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <common/printk.h>
|
||||||
|
#include <common/compiler.h>
|
||||||
|
|
||||||
|
#define assert(condition) ({ \
|
||||||
|
int __condition = !!(condition); \
|
||||||
|
if (unlikely(!(__condition))) \
|
||||||
|
{ \
|
||||||
|
printk("[ kTEST FAILED ] Ktest Assertion Failed, file:%s, Line:%d\n", __FILE__, __LINE__); \
|
||||||
|
} \
|
||||||
|
likely(__condition); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define kTEST(...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
printk("[ kTEST ] file:%s, Line:%d\t", __FILE__, __LINE__); \
|
||||||
|
printk(__VA_ARGS__); \
|
||||||
|
printk("\n"); \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 测试用例函数表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef long (*ktest_case_table)(uint64_t arg0, uint64_t arg1);
|
Loading…
x
Reference in New Issue
Block a user