idmapped-mounts: introduce an explicit command line switch for testsuite
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 14 Aug 2021 10:48:00 +0000 (12:48 +0200)
committerEryu Guan <guaneryu@gmail.com>
Sun, 22 Aug 2021 11:48:39 +0000 (19:48 +0800)
Introduce an explicit command line switch to runs the basic test suite.
This prepares for the introduction of additional command line switches
to run additional tests.

Cc: fstests@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/idmapped-mounts/idmapped-mounts.c
tests/generic/633

index 0e6698bd24d61a284f8439031111b694739a49ce..e45248e1cdb06fe49c8ccfd72c6be2ef1b196278 100644 (file)
@@ -8722,6 +8722,7 @@ static void usage(void)
        fprintf(stderr, "--help          Print help\n");
        fprintf(stderr, "--mountpoint    Mountpoint of device\n");
        fprintf(stderr, "--supported     Test whether idmapped mounts are supported on this filesystem\n");
+       fprintf(stderr, "--test-core     Run core idmapped mount testsuite\n");
 
        _exit(EXIT_SUCCESS);
 }
@@ -8732,7 +8733,8 @@ static const struct option longopts[] = {
        {"mountpoint",  required_argument,      0,      'm'},
        {"supported",   no_argument,            0,      's'},
        {"help",        no_argument,            0,      'h'},
-       {NULL,          0,                      0,      0  },
+       {"test-core",   no_argument,            0,      'c'},
+       {NULL,          0,                      0,      0},
 };
 
 struct t_idmapped_mounts {
@@ -8827,7 +8829,7 @@ int main(int argc, char *argv[])
 {
        int fret, ret;
        int index = 0;
-       bool supported = false;
+       bool supported = false, test_core = false;
 
        while ((ret = getopt_long_only(argc, argv, "", longopts, &index)) != -1) {
                switch (ret) {
@@ -8843,6 +8845,9 @@ int main(int argc, char *argv[])
                case 's':
                        supported = true;
                        break;
+               case 'c':
+                       test_core = true;
+                       break;
                case 'h':
                        /* fallthrough */
                default:
@@ -8912,7 +8917,7 @@ int main(int argc, char *argv[])
 
        fret = EXIT_FAILURE;
 
-       if (!run_test(basic_suite, ARRAY_SIZE(basic_suite)))
+       if (test_core && !run_test(basic_suite, ARRAY_SIZE(basic_suite)))
                goto out;
 
        fret = EXIT_SUCCESS;
index 6be8a69e21e2a38636e2b18fdd566413e29c6229..6750117735f7c59905a413aa822442ec996aef3c 100755 (executable)
@@ -20,7 +20,8 @@ _require_test
 
 echo "Silence is golden"
 
-$here/src/idmapped-mounts/idmapped-mounts --device "$TEST_DEV" --mount "$TEST_DIR" --fstype "$FSTYP"
+$here/src/idmapped-mounts/idmapped-mounts --test-core --device "$TEST_DEV" \
+       --mount "$TEST_DIR" --fstype "$FSTYP"
 
 status=$?
 exit