mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-03 22:00:14 +01:00
test: reliably sort the udev rules
This guarantees the device rules have a static order between test runs. Previously and in some cases, the temporary file name could affect the order of the udev rules - let's not do that. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ce80e40006
commit
1e9925735a
1 changed files with 4 additions and 2 deletions
|
|
@ -1224,20 +1224,22 @@ litest_init_device_udev_rules(struct litest_test_device *dev)
|
|||
int fd;
|
||||
FILE *f;
|
||||
char *path = NULL;
|
||||
static int count;
|
||||
|
||||
if (!dev->udev_rule)
|
||||
return NULL;
|
||||
|
||||
rc = xasprintf(&path,
|
||||
"%s/%s%s-XXXXXX.rules",
|
||||
"%s/%s%03d-%s-XXXXXX.rules",
|
||||
UDEV_RULES_D,
|
||||
UDEV_RULE_PREFIX,
|
||||
++count,
|
||||
dev->shortname);
|
||||
litest_assert_int_eq(rc,
|
||||
(int)(
|
||||
strlen(UDEV_RULES_D) +
|
||||
strlen(UDEV_RULE_PREFIX) +
|
||||
strlen(dev->shortname) + 14));
|
||||
strlen(dev->shortname) + 18));
|
||||
|
||||
fd = mkstemps(path, 6);
|
||||
litest_assert_int_ne(fd, -1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue