[LTP] [PATCH v2 1/1] lib: Multiply slow config only for a real tests

Petr Vorel pvorel@suse.cz
Fri Jan 17 11:51:47 CET 2025


> Hi!
> > > diff --git a/testcases/lib/tst_ns_exec.c b/testcases/lib/tst_ns_exec.c
> > > index 6a8e39339..989bb8910 100644
> > > --- a/testcases/lib/tst_ns_exec.c
> > > +++ b/testcases/lib/tst_ns_exec.c
> > > @@ -100,7 +100,12 @@ int main(int argc, char *argv[])
> > >         for (i = 0; i < ns_fds; i++)
> > >                 SAFE_SETNS(ns_fd[i], 0);

> > > -       pid = SAFE_CLONE(&args);
> > > +       pid = tst_clone(&args);
> > > +       if (pid < 0) {
> > > +               printf("clone() failed");
> > > +               return 1;
> > > +       }
> > > +
> > >         if (!pid)
> > >                 SAFE_EXECVP(argv[3], argv+3);

> > Thanks, it works! Could you please merge it? Maybe update the comment?

> > -       .forks_child = 1, /* Needed by SAFE_CLONE */
> > +       .forks_child = 1, /* Needed by safe_clone() */

> I guess that we do not need that one anymore. Does the helper work if
> we remove it?

Good catch, it works (I didn't notice we're using tst_clone(), not
safe_clone()). I tested it on the patch below.

Thanks!

Kind regards,
Petr

> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > Fixes: 893ca0abe7 ("lib: multiply the timeout if detect slow kconfigs")

+++ testcases/lib/tst_ns_exec.c
@@ -20,12 +20,6 @@
 #include "tst_test.h"
 #include "tst_ns_common.h"
 
-extern struct tst_test *tst_test;
-
-static struct tst_test test = {
-	.forks_child = 1, /* Needed by SAFE_CLONE */
-};
-
 static int ns_fd[NS_TOTAL];
 static int ns_fds;
 
@@ -71,8 +65,6 @@ int main(int argc, char *argv[])
 	int i, status, pid;
 	char *token;
 
-	tst_test = &test;
-
 	if (argc < 4) {
 		print_help();
 		return 1;
@@ -100,7 +92,12 @@ int main(int argc, char *argv[])
 	for (i = 0; i < ns_fds; i++)
 		SAFE_SETNS(ns_fd[i], 0);
 
-	pid = SAFE_CLONE(&args);
+	pid = tst_clone(&args);
+	if (pid < 0) {
+		printf("clone() failed");
+		return 1;
+	}
+
 	if (!pid)
 		SAFE_EXECVP(argv[3], argv+3);
 


More information about the ltp mailing list