This is an automated email from the ASF dual-hosted git repository.
casaroli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new d40132fba testing/ostest: Rename TEST_LOOP_SCALE to TESTING_LOOP_SCALE
d40132fba is described below
commit d40132fbaea27b50ea981beeacc887a782d483c8
Author: Swatantra Yadav <[email protected]>
AuthorDate: Fri Oct 30 10:02:33 2026 +0530
testing/ostest: Rename TEST_LOOP_SCALE to TESTING_LOOP_SCALE
Conform the Kconfig option name to the standard CONFIG_TESTING_*
namespace convention used throughout apps/testing/, and resolve
pre-existing nxstyle issues in spinlock.c.
Signed-off-by: Swatantra Yadav <[email protected]>
---
testing/ostest/Kconfig | 2 +-
testing/ostest/spinlock.c | 19 +++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/testing/ostest/Kconfig b/testing/ostest/Kconfig
index c714d179d..635d9fc63 100644
--- a/testing/ostest/Kconfig
+++ b/testing/ostest/Kconfig
@@ -142,7 +142,7 @@ config TESTING_OSTEST_MULTIUSER
CONFIG_LIBC_PASSWD_FILEPATH (default /tmp/ostest_passwd when
this
option is enabled).
-config TEST_LOOP_SCALE
+config TESTING_LOOP_SCALE
int "Loop scale of spinlock test (N x 10,000)"
default 100
diff --git a/testing/ostest/spinlock.c b/testing/ostest/spinlock.c
index b3df08294..191c7184b 100644
--- a/testing/ostest/spinlock.c
+++ b/testing/ostest/spinlock.c
@@ -39,7 +39,7 @@
****************************************************************************/
#define MAX_THREAD_NUM (CONFIG_SMP_NCPUS)
-#define LOOP_TIMES (CONFIG_TEST_LOOP_SCALE * 100000)
+#define LOOP_TIMES (CONFIG_TESTING_LOOP_SCALE * 100000)
aligned_data(64) struct spinlock_pub_args_s
{
@@ -55,6 +55,13 @@ struct spinlock_thread_args_s
FAR struct spinlock_pub_args_s *pub;
};
+aligned_data(64) union spinlock_test_u
+{
+ spinlock_t spinlock;
+ rspinlock_t rspinlock;
+ seqcount_t seqcount;
+};
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -62,10 +69,11 @@ struct spinlock_thread_args_s
/* Helper functions for timespec calculating */
static inline uint64_t calc_diff(FAR struct timespec *start,
- FAR struct timespec *end)
+ FAR struct timespec *end)
{
uint64_t diff_sec = end->tv_sec - start->tv_sec;
long diff_nsec = end->tv_nsec - start->tv_nsec;
+
if (diff_nsec < 0)
{
diff_sec -= 1;
@@ -241,12 +249,7 @@ void run_test_thread(void *lock, FAR void
*(*thread_func)(FAR void *arg),
static void spinlock_test_thread_num(unsigned thread_num)
{
- aligned_data(64) union
- {
- spinlock_t spinlock;
- rspinlock_t rspinlock;
- seqcount_t seqcount;
- } lock;
+ union spinlock_test_u lock;
printf("Start Lock test:\n");
printf("Thread num: %u, Loop times: %d\n\n", thread_num, LOOP_TIMES);