mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-05 15:48:02 +02:00
test: mkdir -p the udev rules and hwdb directories
Especially /run/udev/rules.d may not exist, causing a test suite failure. https://bugs.freedesktop.org/show_bug.cgi?id=103527 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4d7592066a
commit
8a2177b3ba
1 changed files with 24 additions and 11 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
@ -1071,20 +1072,32 @@ litest_install_model_quirks(struct list *created_files_list)
|
||||||
list_insert(created_files_list, &file->link);
|
list_insert(created_files_list, &file->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
mkdir_p(const char *dir)
|
||||||
|
{
|
||||||
|
char *path = strdup(dir),
|
||||||
|
*parent = dirname(path);
|
||||||
|
|
||||||
|
if (streq(parent, "/")) {
|
||||||
|
int rc = mkdir(dir, 0755);
|
||||||
|
|
||||||
|
if (rc == -1 && errno != EEXIST) {
|
||||||
|
litest_abort_msg("Failed to create directory %s (%s)\n",
|
||||||
|
dir,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mkdir_p(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
litest_init_udev_rules(struct list *created_files)
|
litest_init_udev_rules(struct list *created_files)
|
||||||
{
|
{
|
||||||
int rc;
|
mkdir_p(UDEV_RULES_D);
|
||||||
|
mkdir_p(UDEV_HWDB_D);
|
||||||
rc = mkdir(UDEV_RULES_D, 0755);
|
|
||||||
if (rc == -1 && errno != EEXIST)
|
|
||||||
litest_abort_msg("Failed to create udev rules directory (%s)\n",
|
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
rc = mkdir(UDEV_HWDB_D, 0755);
|
|
||||||
if (rc == -1 && errno != EEXIST)
|
|
||||||
litest_abort_msg("Failed to create udev hwdb directory (%s)\n",
|
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
litest_install_model_quirks(created_files);
|
litest_install_model_quirks(created_files);
|
||||||
litest_init_all_device_udev_rules(created_files);
|
litest_init_all_device_udev_rules(created_files);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue