mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
new: 增加ktest_start函数以开启内核自测试
This commit is contained in:
@ -2,7 +2,10 @@
|
||||
CFLAGS += -I .
|
||||
|
||||
|
||||
all: bitree.o kfifo.o
|
||||
all: ktest.o bitree.o kfifo.o
|
||||
|
||||
ktest.o: ktest.c
|
||||
gcc $(CFLAGS) -c ktest.c -o ktest.o
|
||||
|
||||
bitree.o: test-bitree.c
|
||||
gcc $(CFLAGS) -c test-bitree.c -o test-bitree.o
|
||||
|
14
kernel/ktest/ktest.c
Normal file
14
kernel/ktest/ktest.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include "ktest.h"
|
||||
#include <process/process.h>
|
||||
|
||||
/**
|
||||
* @brief 开启一个新的内核线程以进行测试
|
||||
*
|
||||
* @param func 测试函数
|
||||
* @param arg 传递给测试函数的参数
|
||||
* @return pid_t 测试内核线程的pid
|
||||
*/
|
||||
pid_t ktest_start(uint64_t (*func)(uint64_t arg), uint64_t arg)
|
||||
{
|
||||
return kernel_thread(func, arg, 0);
|
||||
}
|
@ -2,4 +2,13 @@
|
||||
#include <common/sys/types.h>
|
||||
|
||||
uint64_t ktest_test_bitree(uint64_t arg);
|
||||
uint64_t ktest_test_kfifo(uint64_t arg);
|
||||
uint64_t ktest_test_kfifo(uint64_t arg);
|
||||
|
||||
/**
|
||||
* @brief 开启一个新的内核线程以进行测试
|
||||
*
|
||||
* @param func 测试函数
|
||||
* @param arg 传递给测试函数的参数
|
||||
* @return pid_t 测试内核线程的pid
|
||||
*/
|
||||
pid_t ktest_start(uint64_t (*func)(uint64_t arg), uint64_t arg);
|
Reference in New Issue
Block a user