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.
This commit is contained in:
Pino Toscano
2014-05-07 15:45:07 +02:00
parent 3633109ff3
commit a651990fb1

View File

@@ -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);