Re: [PATCH v2 4/4] testsuite/smokey/psostests: Fix compile error seen with gcc 16
Florian Bezdeka <[email protected]>
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-05-18 at 13:49 +0200, Jan Kiszka wrote: > On 18.05.26 12:24, Florian Bezdeka wrote: > > On Mon, 2026-05-18 at 11:21 +0200, Jan Kiszka wrote: > > > On 18.05.26 11:02, Florian Bezdeka wrote: > > > > Fixes the following compile errors: > > > > > > > > rn-1.c: In function ‘alloc_task’: > > > > rn-1.c:16:18: error: variable ‘n’ set but not used [-Werror=unused-but-set-variable=] > > > > 16 | int ret, n; > > > > | ^ > > > > rn-1.c:15:22: error: variable ‘alloc_size’ set but not used [-Werror=unused-but-set-variable=] > > > > 15 | u_long size, alloc_size = 0; > > > > | > > > > > > > > task-2.c: In function ‘backgroundTask’: > > > > task-2.c:19:42: error: variable ‘count’ set but not used [-Werror=unused-but-set-variable=] > > > > 19 | unsigned int safety = 100000000, count = 0; > > > > | ^~~~~ > > > > cc1: all warnings being treated as errors > > > > > > > > The counting busy loop has been replaced by an interval based busy > > > > loop. > > > > > > > > Signed-off-by: Florian Bezdeka <[email protected]> > > > > --- > > > > testsuite/smokey/psostests/rn-1.c | 7 +++---- > > > > testsuite/smokey/psostests/task-2.c | 5 ++--- > > > > 2 files changed, 5 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/testsuite/smokey/psostests/rn-1.c b/testsuite/smokey/psostests/rn-1.c > > > > index 5e82d1506ca029ae2bf812ccbfbf9c3a9ab9cc7e..d2e847375212c9746de3e550a5d10a8be4694de5 100644 > > > > --- a/testsuite/smokey/psostests/rn-1.c > > > > +++ b/testsuite/smokey/psostests/rn-1.c > > > > @@ -12,15 +12,15 @@ static u_long tid, rnid; > > > > > > > > static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4) > > > > { > > > > - u_long size, alloc_size = 0; > > > > - int ret, n; > > > > + u_long size; > > > > void *buf; > > > > + int ret; > > > > > > > > traceobj_enter(&trobj); > > > > > > > > srandom(0x11223344); > > > > > > > > - for (n = 0;; n++) { > > > > + for (;;) { > > > > size = (random() % (sizeof(rn_mem) / 8)) + 4; > > > > ret = rn_getseg(rnid, size, RN_NOWAIT, 0, &buf); > > > > if (ret) { > > > > @@ -28,7 +28,6 @@ static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4) > > > > break; > > > > } > > > > memset(buf, 0xaa, size); > > > > - alloc_size += size; > > > > } > > > > > > > > traceobj_exit(&trobj); > > > > diff --git a/testsuite/smokey/psostests/task-2.c b/testsuite/smokey/psostests/task-2.c > > > > index d24c13465367c7c2a6975dd4cbb01eb75f8fd1ad..be1b6ca18c5354ba092d55b3655bae9a294f2ce7 100644 > > > > --- a/testsuite/smokey/psostests/task-2.c > > > > +++ b/testsuite/smokey/psostests/task-2.c > > > > @@ -2,6 +2,7 @@ > > > > #include <stdio.h> > > > > #include <stdlib.h> > > > > #include <copperplate/traceobj.h> > > > > +#include <copperplate/threadobj.h> > > > > #include <psos/psos.h> > > > > > > > > static struct traceobj trobj; > > > > @@ -16,7 +17,6 @@ static u_long sem_id; > > > > > > > > static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4) > > > > { > > > > - unsigned int safety = 100000000, count = 0; > > > > int ret; > > > > > > > > traceobj_enter(&trobj); > > > > @@ -28,8 +28,7 @@ static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4) > > > > > > > > traceobj_mark(&trobj, 2); > > > > > > > > - while (--safety > 0) > > > > - count++; > > > > + threadobj_spin(1000); > > > > > > That's just 1 µs, isn't it? That sounds rather short, not only for VM > > > setups. > > > > > > > Arg, this is crazy. I measured the execution time of the previous > > counting loop on my nested virtualized test system and tried to get down > > as much as possible until CI would complain. Turned out: This test is > > actually never run in CI... > > > > Haha! > > > There is a comment in psostests.c that this test (as it was) is broken, > > so disabled. > > > > To get that running on my nested VM setup here I have to increase to > > something around 2ms. > > > > Let me spawn another couple of CI test runs, maybe we can re-enable that > > test - or delete it entirely? > > Someone who wrote it may help us to understand its original purpose: > adding Philippe. > > testsuite/smokey/vxworkstests/task-2.c looks similar on first glance, > but it is not disabled. > My understanding is that those tests are actually testing the same thing, just for different skins. In my case both busy loops (the counting ones) are executed that fast that I was always entering the "should not be reached anymore" sections. In case of the vxworkstest I'm ending up in pause(). That's why I simply removed the busy waiting in this case. Let's wait for Philippe, I can't tell from the available information (git log, ...) what exactly should be tested. Florian