Re: [PATCH v3 4/4] testsuite/smokey/psostests: Fix compile error seen with gcc 16
Florian Bezdeka <[email protected]> Mon, 20 Jul 2026 17:02:11 +0200
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-07-20 at 16:40 +0200, Jan Kiszka wrote: > On 17.07.26 09:45, Florian Bezdeka wrote: > > Fixes the following compile errors: > >=20 > > rn-1.c: In function =E2=80=98alloc_task=E2=80=99: > > rn-1.c:16:18: error: variable =E2=80=98n=E2=80=99 set but not used [-We= rror=3Dunused-but-set-variable=3D] > > 16 | int ret, n; > > | ^ > > rn-1.c:15:22: error: variable =E2=80=98alloc_size=E2=80=99 set but not = used [-Werror=3Dunused-but-set-variable=3D] > > 15 | u_long size, alloc_size =3D 0; > > | > >=20 > > task-2.c: In function =E2=80=98backgroundTask=E2=80=99: > > task-2.c:19:42: error: variable =E2=80=98count=E2=80=99 set but not use= d [-Werror=3Dunused-but-set-variable=3D] > > 19 | unsigned int safety =3D 100000000, count =3D 0; > > | ^~~~~ > > cc1: all warnings being treated as errors > >=20 > > The counting busy loop has been replaced by an interval based busy > > loop. While at it: Enable this test for CI. It was previously marked > > as broken. The counting busy loop was not enough to keep the task alive= . > >=20 > > Signed-off-by: Florian Bezdeka <[email protected]> > > --- > > testsuite/smokey/psostests/psostests.c | 4 +--- > > testsuite/smokey/psostests/rn-1.c | 7 +++---- > > testsuite/smokey/psostests/task-2.c | 5 ++--- > > 3 files changed, 6 insertions(+), 10 deletions(-) > >=20 > > diff --git a/testsuite/smokey/psostests/psostests.c b/testsuite/smokey/= psostests/psostests.c > > index 289d563ac3595f0e2d21bc5f5746772fd51234b8..31347ba45ea430ac4b2e62b= e4c1e437519f2fb37 100644 > > --- a/testsuite/smokey/psostests/psostests.c > > +++ b/testsuite/smokey/psostests/psostests.c > > @@ -15,9 +15,7 @@ static const char * const tests[] =3D { > > "psostests_sem1", > > "psostests_sem2", > > "psostests_task1", > > - // 0"014.452| BUG in __traceobj_assert_failed(): [FGND] trace asserti= on failed: > > - // ../../../../../../../../../workspace/sources/xenomai/testsuite/sm= okey/psostests/task-2.c:56 =3D> "ret =3D=3D 0" > > - //"psostests_task2", > > + "psostests_task2", > > "psostests_task3", > > "psostests_task4", > > "psostests_task5", > > diff --git a/testsuite/smokey/psostests/rn-1.c b/testsuite/smokey/psost= ests/rn-1.c > > index 5e82d1506ca029ae2bf812ccbfbf9c3a9ab9cc7e..d2e847375212c9746de3e55= 0a5d10a8be4694de5 100644 > > --- a/testsuite/smokey/psostests/rn-1.c > > +++ b/testsuite/smokey/psostests/rn-1.c > > @@ -12,15 +12,15 @@ static u_long tid, rnid; > > =20 > > static void alloc_task(u_long a1, u_long a2, u_long a3, u_long a4) > > { > > - u_long size, alloc_size =3D 0; > > - int ret, n; > > + u_long size; > > void *buf; > > + int ret; > > =20 > > traceobj_enter(&trobj); > > =20 > > srandom(0x11223344); > > =20 > > - for (n =3D 0;; n++) { > > + for (;;) { > > size =3D (random() % (sizeof(rn_mem) / 8)) + 4; > > ret =3D 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 a= 3, u_long a4) > > break; > > } > > memset(buf, 0xaa, size); > > - alloc_size +=3D size; > > } > > =20 > > traceobj_exit(&trobj); > > diff --git a/testsuite/smokey/psostests/task-2.c b/testsuite/smokey/pso= stests/task-2.c > > index d24c13465367c7c2a6975dd4cbb01eb75f8fd1ad..21497433f1a3584184406b1= 72c367eacd5a8b127 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> > > =20 > > static struct traceobj trobj; > > @@ -16,7 +17,6 @@ static u_long sem_id; > > =20 > > static void backgroundTask(u_long a1, u_long a2, u_long a3, u_long a4) > > { > > - unsigned int safety =3D 100000000, count =3D 0; > > int ret; > > =20 > > traceobj_enter(&trobj); > > @@ -28,8 +28,7 @@ static void backgroundTask(u_long a1, u_long a2, u_lo= ng a3, u_long a4) > > =20 > > traceobj_mark(&trobj, 2); > > =20 > > - while (--safety > 0) > > - count++; > > + threadobj_spin(2000000); > > =20 >=20 > Here you do the right thing. >=20 > > traceobj_mark(&trobj, 3); > > =20 > >=20 >=20 > But the patch description is confusing: It only talks about fixing > compiler errors, but the code is actually re-enabling psostests_task2, > isn't it? Taken from the description above: While at it: Enable this test for CI. It was previously marked as broken. The counting busy loop was not enough to keep the task alive. I can re-order the description a bit to make that even clearer. >=20 > Jan >=20 > --=20 > Siemens AG, Foundational Technologies > Linux Expert Center