Re: [PATCH] testsuite/smokey/alchemytests: Relax mq-2 test over VM

Florian Bezdeka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On Thu, 2026-05-07 at 14:23 +0200, Jan Kiszka wrote:
> On 07.05.26 13:03, Florian Bezdeka wrote:
> > On Wed, 2026-05-06 at 12:26 +0200, Jan Kiszka wrote:
> > > From: Jan Kiszka <[email protected]>
> > > 
> > > VM environment may delay or reorder the execution of tasks, so relax the
> > > checks.
> > > 
> > > Part of #52.
> > > 
> > > Signed-off-by: Jan Kiszka <[email protected]>
> > > ---
> > >  testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/testsuite/smokey/alchemytests/mq-2.c b/testsuite/smokey/alchemytests/mq-2.c
> > > index a389e46db0..09b26b2135 100644
> > > --- a/testsuite/smokey/alchemytests/mq-2.c
> > > +++ b/testsuite/smokey/alchemytests/mq-2.c
> > > @@ -7,6 +7,7 @@
> > >  #include <alchemy/queue.h>
> > >  
> > >  static struct traceobj trobj;
> > > +static bool on_vm;
> > >  
> > >  static int tseq[] = {
> > >  	3, 4, 5, 6,
> > > @@ -87,9 +88,10 @@ static void main_task(void *arg)
> > >  
> > >  	ret = rt_queue_inquire(&q, &info);
> > >  	traceobj_check(&trobj, ret, 0);
> > > -	traceobj_assert(&trobj, info.nmessages == 0);
> > > +	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
> > >  
> > > -	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
> > > +	if (info.nmessages == 0)
> > > +		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
> > >  
> > >  	traceobj_exit(&trobj);
> > >  }
> > > @@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
> > >  	RT_TASK t_main;
> > >  	int ret;
> > >  
> > > +	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
> > > +
> > 
> > Seems a bit risky to expect --vm as first argument only.
> > 
> 
> It's not a new pattern, and I thought (please prove me wrong) that this
> is already a filtered argv, freed from generic switches.

Yes, that seems to be the case, but the filtering seems questionable:

Taken from run_alchemytests():

	tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
				 smokey_on_vm ? args : args + 5,
				 &test_ret);

Where args is

	const char *args = "--vm";

args + 5 is pointing to garbage in case smokey_on_vm is false. Right?

> 
> Jan
> 
> > >  	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
> > >  
> > >  	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
> > > -- 
> > > 2.47.3
> 
> 
> -- 
> Siemens AG, Foundational Technologies
> Linux Expert Center
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.