Skip to content

Commit

Permalink
utest: 解决hrtimer测试例程bug
Browse files Browse the repository at this point in the history
Signed-off-by: 无烬 <[email protected]>
  • Loading branch information
AlexHAHA committed Oct 27, 2024
1 parent 6a7bc43 commit 2e9cd49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 15 additions & 0 deletions apps/utest/test_hrtimer/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import rtconfig
from building import *

cwd = GetCurrentDir()
group = []


# 添加当前文件夹下的代码
src = Glob("*.c") + Glob("*.cpp")
inc = []

group += DefineGroup("utest", src, depend=["TEST_PKG_HRTIMER"], CPPPATH=inc)

Return("group")
7 changes: 5 additions & 2 deletions apps/utest/test_hrtimer/test_hrtimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#define LOG_TAG "test_hrtimer"
#define LOG_LVL LOG_LVL_INFO

#include <rtthread.h>
#include "hrtimer.h"
#include "rtdbg.h"

#include "stdlib.h"

hrt_call hrt_call_every_call{};

Expand All @@ -36,6 +37,8 @@ static int test_hrt_call_every_func(void *param) {
total_count = 0;
hrt_call_every_call.period = 0;
}

return 0;
}

static int test_hrt_call_every_main(int argc, char *argv) {
Expand All @@ -49,7 +52,7 @@ static int test_hrt_call_every_main(int argc, char *argv) {
hrt_call_every_count = strtol(&argv[3], nullptr, 10);

rt_kprintf("period=%d,delay=%d,count=%d\n", hrt_call_every_period, hrt_call_every_delay, 10);
hrt_call_every(&hrt_call_every_call, hrt_call_every_delay, hrt_call_every_period, test_hrt_call_every_func, nullptr);
hrt_call_every(&hrt_call_every_call, hrt_call_every_delay, hrt_call_every_period, (hrt_callout)(test_hrt_call_every_func), nullptr);
return 0;
}

Expand Down

0 comments on commit 2e9cd49

Please sign in to comment.