[LTP] [PATCH v5] save_restore: Introduce new struct field for flags

Li Wang liwang@redhat.com
Thu Nov 24 04:09:14 CET 2022


Hi All,

On Tue, Nov 22, 2022 at 4:02 PM Jan Stancek <jstancek@redhat.com> wrote:

> On Fri, Nov 18, 2022 at 2:30 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> >
> > Hi!
> > > > +#define TST_SR_TCONF (TST_SR_TCONF_MISSING | TST_SR_TCONF_RO)
> > > > +#define TST_SR_TBROK (TST_SR_TBROK_MISSING | TST_SR_TBROK_RO)
> > > > +#define TST_SR_SKIP (TST_SR_SKIP_MISSING | TST_SR_SKIP_RO)
> > > >
> > >
> > > I'd suggest using "_TSKIP" to replace "_SKIP' to be consistent.
> > > Then the whole format will look quite perfect and easy to memorize:).
> >
> > I think that it makse sense to keep it as _SKIP because that is the
> > option that does not map directly to the test result flags. If we named
> > it TSKIP people will be confused that there is no TSKIP in the test
> > result flags at all.
>
> +1 for SKIP
>
> Feel free to add my Acked-by back.
>

Sure, no problem.

But before applying patch-v5 as it is, I found additional two tiny issues:

1. the usage in newlib_tests should be corrected as well
2. tst_hugepage need to update the argument in tst_sys_conf_save()

If everyone agrees on the improvements, I will merge with below fixes:

--- a/lib/newlib_tests/test19.c
+++ b/lib/newlib_tests/test19.c
@@ -24,9 +24,9 @@ static struct tst_test test = {
        .test_all = run,
        .setup = setup,
        .save_restore = (const struct tst_path_val[]) {
-               {"?/proc/nonexistent", NULL},
-               {"!/proc/sys/kernel/numa_balancing", NULL},
-               {"/proc/sys/kernel/core_pattern", NULL},
+               {"/proc/nonexistent", NULL, TST_SR_SKIP},
+               {"/proc/sys/kernel/numa_balancing", NULL, TST_SR_TBROK},
+               {"/proc/sys/kernel/core_pattern", NULL, TST_SR_TCONF},
                {}
        },
 };
diff --git a/lib/newlib_tests/test20.c b/lib/newlib_tests/test20.c
index 3982ab7..3726cea 100644
--- a/lib/newlib_tests/test20.c
+++ b/lib/newlib_tests/test20.c
@@ -39,7 +39,7 @@ static struct tst_test test = {
        .test_all = do_test,
        .hugepages = {2, TST_NEEDS},
        .save_restore = (const struct tst_path_val[]) {
-               {"!/proc/sys/kernel/numa_balancing", "0"},
+               {"/proc/sys/kernel/numa_balancing", "0", TST_SR_TBROK},
                {}
        },
 };
diff --git a/lib/tst_hugepage.c b/lib/tst_hugepage.c
index e97cc56..41f65d7 100644
--- a/lib/tst_hugepage.c
+++ b/lib/tst_hugepage.c
@@ -7,6 +7,7 @@

 #include "tst_test.h"
 #include "tst_hugepage.h"
+#include "tst_sys_conf.h"

 unsigned long tst_hugepages;
 char *nr_opt;
@@ -24,6 +25,12 @@ unsigned long tst_reserve_hugepages(struct tst_hugepage
*hp)
 {
        unsigned long val, max_hpages;

+       struct tst_path_val pvl = {
+               .path = PATH_NR_HPAGES,
+               .val = NULL,
+               .flags = TST_SR_SKIP,
+       };
+
        if (access(PATH_HUGEPAGES, F_OK)) {
                if (hp->policy == TST_NEEDS)
                        tst_brk(TCONF, "hugetlbfs is not supported");
@@ -59,7 +66,7 @@ unsigned long tst_reserve_hugepages(struct tst_hugepage
*hp)
        }

 set_hugepages:
-       tst_sys_conf_save("?/proc/sys/vm/nr_hugepages");
+       tst_sys_conf_save(&pvl);
        SAFE_FILE_PRINTF(PATH_NR_HPAGES, "%lu", tst_hugepages);
        SAFE_FILE_SCANF(PATH_NR_HPAGES, "%lu", &val);
        if (val != tst_hugepages)


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20221124/f6530f26/attachment.htm>


More information about the ltp mailing list