Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
806fcdd
testing/drivertest: Fix timing issues on QEMU and sims.
Fix-Point Apr 22, 2025
a550f97
testing/drivers: Fix posix timer assertions.
Fix-Point Jul 10, 2025
1f98eff
testing/time: Relax the timing constraints.
Fix-Point Jul 24, 2025
f060f2d
testing/drivers: Fix posix timer assertions.
Fix-Point Jul 10, 2025
3f9c0b8
testing/drivers: Fixed the wrong test-case.
Fix-Point Jul 28, 2025
3c786cb
apps/testing: Fix Coverity.
Fix-Point Dec 31, 2024
ce9aac9
apps/testing: Fix timerjitter interval
Fix-Point Feb 21, 2025
91ed30a
apps/testing: Fix timerjitter iteration
Fix-Point Feb 24, 2025
424d96b
benchmark/taclebench: Add clock measurement.
Fix-Point Apr 3, 2025
48fc611
apps/ostest: Fix wqueue_test in flat mode.
Fix-Point Apr 16, 2025
f343dcf
ostest/wdog: Fix a synchronizing bug.
Fix-Point May 26, 2025
8e15ca1
testing/drivers: Change uint32_t time to uint64_t.
Fix-Point Sep 2, 2025
2605b0c
testing/drivers: Fix wrong test-cases.
Fix-Point Sep 2, 2025
8eb9ea4
ostest: Add spinlock/rspinlock.
Jun 20, 2025
edfa547
testing/drivers: Fix posix timer assertions.
Fix-Point Jul 10, 2025
d6f69d9
ostest/spinlock: Check the return value.
Fix-Point Oct 21, 2025
d830823
ostest/spinlock: fix the operations does not affect the result.
Jackapyun Oct 26, 2025
19606dc
ostest/spinlock: Check the return value.
Jackapyun Oct 26, 2025
fe0f0a2
testing/ostest: refactor the spinlock test.
Fix-Point Nov 7, 2025
4253152
testing/ostest: Fix Coverity for spinlock test.
Fix-Point Dec 30, 2025
0ae2a27
testing/ostest: run spinlock_test only in flat mode.
Fix-Point Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
From 71f51cd5ca4f492a464fb12d5bce91e5fbba300a Mon Sep 17 00:00:00 2001
From 6d0be04a4b4208447e75c369e9811d089f466739 Mon Sep 17 00:00:00 2001
From: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Date: Tue, 11 Jun 2024 16:01:23 +0800
Date: Thu, 3 Apr 2025 11:59:02 +0800
Subject: [PATCH] tacle-bench: add makefile and all-in-one main file

The original taclebench is used for WCET analysis. This commit allows most taclebench test cases (except parallel test cases) to be compiled and executed.

Change-Id: I707b8ac58d3ddc4b7974c5bedecac1a7b5c887f9
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
---
Makefile | 12 +
Expand Down Expand Up @@ -65,14 +66,14 @@ Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
bench/test/cover/cover.c | 3 +
bench/test/duff/duff.c | 3 +
bench/test/test3/test3.c | 3 +
taclebench.c | 349 ++++++++++++++++++
59 files changed, 532 insertions(+)
taclebench.c | 366 ++++++++++++++++++
59 files changed, 549 insertions(+)
create mode 100644 Makefile
create mode 100644 taclebench.c

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2385c61
index 0000000..75ca0a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
Expand All @@ -83,7 +84,7 @@ index 0000000..2385c61
+TEST_SRCS := $(shell find bench/test -name "*.c")
+
+all:
+ cc -DALL_IN_ONE ${APP_SRCS} ${KERNEL_SRCS} ${SEQUENTIAL_SRCS} ${TEST_SRCS} bench/kernel/cosf/wcclibm.c taclebench.c -static -o taclebench
+ cc -DALL_IN_ONE ${APP_SRCS} ${KERNEL_SRCS} ${SEQUENTIAL_SRCS} ${TEST_SRCS} bench/kernel/cosf/wcclibm.c taclebench.c -static -o taclebench -O3
+
+clean:
+ rm -f taclebench
Expand Down Expand Up @@ -888,11 +889,12 @@ index 0235738..6eaf8c2 100755

diff --git a/taclebench.c b/taclebench.c
new file mode 100644
index 0000000..1231b87
index 0000000..aaff1bb
--- /dev/null
+++ b/taclebench.c
@@ -0,0 +1,349 @@
@@ -0,0 +1,366 @@
+#include <stdio.h>
+#include <time.h>
+
+int main_epic(void);
+int main_mpeg2(void);
Expand Down Expand Up @@ -954,6 +956,10 @@ index 0000000..1231b87
+
+int main(void)
+{
+ struct timespec start_ts;
+ struct timespec end_ts;
+ clock_gettime(CLOCK_MONOTONIC, &start_ts);
+
+ if (main_epic() != 0)
+ {
+ printf("main_epic error\n");
Expand Down Expand Up @@ -1239,6 +1245,18 @@ index 0000000..1231b87
+ printf("main_bitonic error\n");
+ }
+
+ clock_gettime(CLOCK_MONOTONIC, &end_ts);
+ long sec_diff = end_ts.tv_sec - start_ts.tv_sec;
+ long nsec_diff = end_ts.tv_nsec - start_ts.tv_nsec;
+
+ if (nsec_diff < 0)
+ {
+ sec_diff -= 1;
+ nsec_diff += 1000000000;
+ }
+
+ printf("%ld.%09ld seconds\n", sec_diff, nsec_diff);
+
+ return 0;
+}
--
Expand Down
29 changes: 17 additions & 12 deletions testing/drivers/drivertest/drivertest_posix_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* Pre-processor Definitions
****************************************************************************/

#define RTC_DEFAULT_DEVIATION 10
#define RTC_DEFAULT_DEVIATION 100
#define DEFAULT_TIME_OUT 2
#define SLEEPSECONDS 10

Expand All @@ -64,7 +64,8 @@
struct posix_timer_state_s
{
struct itimerspec it;
uint32_t tim;
uint64_t tim;
uint32_t trigger_count;
uint32_t deviation;
};

Expand Down Expand Up @@ -140,12 +141,12 @@ static void parse_commandline(
* Name: get_timestamp
****************************************************************************/

static uint32_t get_timestamp(void)
static uint64_t get_timestamp(void)
{
struct timespec ts;
uint32_t ms;
uint64_t ms;
clock_gettime(CLOCK_MONOTONIC, &ts);
ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
ms = (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
return ms;
}

Expand All @@ -157,14 +158,17 @@ static void posix_timer_callback(union sigval arg)
{
FAR struct posix_timer_state_s *sigev_para =
(FAR struct posix_timer_state_s *)arg.sival_ptr;
int range = get_timestamp() - (*sigev_para).tim;
uint64_t expected = (*sigev_para).tim +
DEFAULT_TIME_OUT * (*sigev_para).trigger_count;
int range = get_timestamp() - expected;

assert_in_range(range,
sigev_para->it.it_interval.tv_sec * 1000 - sigev_para->deviation,
sigev_para->it.it_interval.tv_sec * 1000 + sigev_para->deviation);
syslog(0, "range: %d ms\n", range);

assert(range >= sigev_para->it.it_interval.tv_sec * 1000 -
sigev_para->deviation);

syslog(LOG_DEBUG, "callback trigger!!!\n");
(*sigev_para).tim = get_timestamp();
(*sigev_para).trigger_count++;
}

/****************************************************************************
Expand Down Expand Up @@ -195,11 +199,11 @@ static void drivertest_posix_timer(FAR void **state)

/* Start the timer */

posix_timer_state->tim = get_timestamp();

ret = timer_settime(timerid, 0, &(posix_timer_state->it), NULL);
assert_return_code(ret, OK);

posix_timer_state->tim = get_timestamp();

/* Get the timer status */

ret = timer_gettime(timerid, &it);
Expand All @@ -225,6 +229,7 @@ int main(int argc, FAR char *argv[])
.it.it_value.tv_nsec = 0,
.it.it_interval.tv_sec = DEFAULT_TIME_OUT,
.it.it_interval.tv_nsec = 0,
.trigger_count = 0,
.deviation = RTC_DEFAULT_DEVIATION
};

Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ if(CONFIG_TESTING_OSTEST)
endif()

if(CONFIG_BUILD_FLAT)
list(APPEND SRCS wdog.c)
list(APPEND SRCS wdog.c spinlock.c)
endif()

set(OSTEST_SRCS ostest_main.c ${SRCS})
Expand Down
9 changes: 9 additions & 0 deletions testing/ostest/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,13 @@ config TESTING_OSTEST_POWEROFF
default n
depends on BOARDCTL_POWEROFF && TESTING_OSTEST_WAITRESULT

config TESTING_OSTEST_SPINLOCK_THREADS
int "Number of spinlock test threads"
default 2
range 1 32

config TEST_LOOP_SCALE
int "Loop scale of spinlock test (N x 10,000)"
default 100

endif # TESTING_OSTEST
4 changes: 2 additions & 2 deletions testing/ostest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MODULE = $(CONFIG_TESTING_OSTEST)

# NuttX OS Test

CSRCS = getopt.c libc_memmem.c restart.c sighelper.c
CSRCS = getopt.c libc_memmem.c restart.c sighelper.c

ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y)
CSRCS += sighand.c signest.c
Expand Down Expand Up @@ -167,7 +167,7 @@ endif
endif

ifeq ($(CONFIG_BUILD_FLAT),y)
CSRCS += wdog.c
CSRCS += wdog.c spinlock.c
endif

include $(APPDIR)/Application.mk
4 changes: 4 additions & 0 deletions testing/ostest/ostest.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ void setjmp_test(void);
void smp_call_test(void);
#endif

/* spinlock.c ***************************************************************/

void spinlock_test(void);

/* APIs exported (conditionally) by the OS specifically for testing of
* priority inheritance
*/
Expand Down
6 changes: 5 additions & 1 deletion testing/ostest/ostest_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage();
#endif

#if !defined(CONFIG_DISABLE_PTHREAD) && defined(__KERNEL__) && \
#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_BUILD_FLAT) && \
defined(CONFIG_SCHED_WORKQUEUE)
/* Check work queues */

Expand Down Expand Up @@ -548,6 +548,10 @@ static int user_main(int argc, char *argv[])
#endif

#ifdef CONFIG_BUILD_FLAT
printf("\nuser_main: spinlock test\n");
spinlock_test();
check_test_memory_usage();

printf("\nuser_main: wdog test\n");
wdog_test();
check_test_memory_usage();
Expand Down
Loading
Loading