[PATCH] test: use unique names for all the test suite names
Peter Hutterer
peter.hutterer at who-t.net
Thu Jun 8 22:26:42 UTC 2017
On Thu, Jun 08, 2017 at 03:45:24PM +0100, Eric Engestrom wrote:
> On Wednesday, 2017-06-07 11:28:28 +1000, Peter Hutterer wrote:
> > This makes it possible to run multiple test suite simultaneously on the same
> > host without messing up the other runs (provided that all instances use
> > the same udev/hwdb files). Previously, removing the udev rules/hwdb at the end
> > of a test run would cause test case failures in other runs that hadn't
> > completed yet.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > test/litest.c | 25 ++++++++++++++++---------
> > 1 file changed, 16 insertions(+), 9 deletions(-)
> >
> > diff --git a/test/litest.c b/test/litest.c
> > index ef474455..8991ed54 100644
> > --- a/test/litest.c
> > +++ b/test/litest.c
> > @@ -55,13 +55,13 @@
> > #define UDEV_RULE_PREFIX "99-litest-"
> > #define UDEV_HWDB_D "/etc/udev/hwdb.d"
> > #define UDEV_MODEL_QUIRKS_RULE_FILE UDEV_RULES_D \
> > - "/91-litest-model-quirks-REMOVEME.rules"
> > + "/91-litest-model-quirks-REMOVEME-XXXXXX.rules"
> > #define UDEV_MODEL_QUIRKS_HWDB_FILE UDEV_HWDB_D \
> > - "/91-litest-model-quirks-REMOVEME.hwdb"
> > + "/91-litest-model-quirks-REMOVEME-XXXXXX.hwdb"
> > #define UDEV_TEST_DEVICE_RULE_FILE UDEV_RULES_D \
> > - "/91-litest-test-device-REMOVEME.rules"
> > + "/91-litest-test-device-REMOVEME-XXXXXXX.rules"
> > #define UDEV_DEVICE_GROUPS_FILE UDEV_RULES_D \
> > - "/80-libinput-device-groups-litest.rules"
> > + "/80-libinput-device-groups-litest-XXXXXX.rules"
> >
> > static int jobs = 8;
> > static int in_debugger = -1;
> > @@ -1125,17 +1125,20 @@ litest_copy_file(const char *dest, const char *src, const char *header)
> > {
> > int in, out, length;
> > struct created_file *file;
> > + long int suffixlen;
>
> My man says `int suffixlen` (without `long`), but it doesn't really
> matter. Everything else looks good to me:
oops. I wonder what that is a leftover of... amended locally.
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Thanks heaps, pushed as a369b2c2..57d4d7d3 master -> master
Cheers,
Peter
>
> >
> > file = zalloc(sizeof(*file));
> > litest_assert(file);
> > file->path = strdup(dest);
> > litest_assert(file->path);
> >
> > - out = open(dest, O_CREAT|O_WRONLY, 0644);
> > + suffixlen = file->path + strlen(file->path) - rindex(file->path, '.');
> > + out = mkstemps(file->path, suffixlen);
> > if (out == -1)
> > litest_abort_msg("Failed to write to file %s (%s)\n",
> > - dest,
> > + file->path,
> > strerror(errno));
> > + litest_assert_int_ne(chmod(file->path, 0644), -1);
> >
> > if (header) {
> > length = strlen(header);
> > @@ -1228,6 +1231,7 @@ static char *
> > litest_init_device_udev_rules(struct litest_test_device *dev)
> > {
> > int rc;
> > + int fd;
> > FILE *f;
> > char *path = NULL;
> >
> > @@ -1235,7 +1239,7 @@ litest_init_device_udev_rules(struct litest_test_device *dev)
> > return NULL;
> >
> > rc = xasprintf(&path,
> > - "%s/%s%s.rules",
> > + "%s/%s%s-XXXXXX.rules",
> > UDEV_RULES_D,
> > UDEV_RULE_PREFIX,
> > dev->shortname);
> > @@ -1243,8 +1247,11 @@ litest_init_device_udev_rules(struct litest_test_device *dev)
> > (int)(
> > strlen(UDEV_RULES_D) +
> > strlen(UDEV_RULE_PREFIX) +
> > - strlen(dev->shortname) + 7));
> > - f = fopen(path, "w");
> > + strlen(dev->shortname) + 14));
> > +
> > + fd = mkstemps(path, 6);
> > + litest_assert_int_ne(fd, -1);
> > + f = fdopen(fd, "w");
> > litest_assert_notnull(f);
> > litest_assert_int_ge(fputs(dev->udev_rule, f), 0);
> > fclose(f);
> > --
> > 2.13.0
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list