From a651990fb12e2cc972e8a984378ec3d57bdce27c Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 7 May 2014 15:45:07 +0200 Subject: [PATCH] test-charset-fidelity: allow to skip testing specific FSes Allow to skip testing the filesystem "foo" if the environment variable SKIP_TEST_CHARSET_FIDELITY_foo=1 is set. This way it possible to not test one or more filesystems without disabling the test altogether. --- tests/charsets/test-charset-fidelity.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c index c669b9d2b..d149a3f67 100644 --- a/tests/charsets/test-charset-fidelity.c +++ b/tests/charsets/test-charset-fidelity.c @@ -33,6 +33,8 @@ #include "guestfs.h" #include "guestfs-internal-frontend.h" +static const char ourenvvar[] = "SKIP_TEST_CHARSET_FIDELITY"; + struct filesystem { const char *fs_name; /* Name of filesystem. */ int fs_case_insensitive; /* True if filesystem is case insensitive. */ @@ -78,7 +80,7 @@ main (int argc, char *argv[]) struct filesystem *fs; /* Allow this test to be skipped. */ - str = getenv ("SKIP_TEST_CHARSET_FIDELITY"); + str = getenv (ourenvvar); if (str && STREQ (str, "1")) { printf ("%s: test skipped because environment variable is set.\n", program_name); @@ -113,6 +115,8 @@ static void test_filesystem (guestfs_h *g, const struct filesystem *fs) { const char *feature[] = { fs->fs_feature, NULL }; + char envvar[sizeof (ourenvvar) + 20]; + char *str; if (fs->fs_feature && !guestfs_feature_available (g, (char **) feature)) { printf ("skipped test of %s because %s feature not available\n", @@ -120,6 +124,14 @@ test_filesystem (guestfs_h *g, const struct filesystem *fs) return; } + snprintf (envvar, sizeof envvar, "%s_%s", ourenvvar, fs->fs_name); + str = getenv (envvar); + if (str && STREQ (str, "1")) { + printf ("skipped test of %s because environment variable is set\n", + fs->fs_name); + return; + } + printf ("testing charset fidelity on %s\n", fs->fs_name); make_filesystem (g, fs);