Skip to content

Commit 2c6efd0

Browse files
committed
Skip O_TMPFILE test on Linux versions < 3.11
There it fails with EISDIR.
1 parent 4d502d2 commit 2c6efd0

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.8.8 (UNRELEASED)
2+
------------------
3+
- Skip O_TMPFILE test on Linux versions < 3.11.
4+
15
0.8.7 (2014-09-19)
26
------------------
37
- /umockdev-run/integration/input-evtest-evemu test: Be more liberal in parsing

tests/test-umockdev.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <sys/ioctl.h>
3131
#include <sys/socket.h>
3232
#include <sys/un.h>
33+
#include <sys/utsname.h>
3334
#include <linux/usbdevice_fs.h>
3435
#include <linux/input.h>
3536

@@ -1000,6 +1001,7 @@ t_testbed_dev_access(UMockdevTestbedFixture * fixture, gconstpointer data)
10001001
gchar *devdir, *devpath;
10011002
int fd;
10021003
char buf[100];
1004+
struct utsname uts;
10031005

10041006
/* no mocked devices */
10051007
g_assert_cmpint(g_open("/dev/wishyouwerehere", O_RDONLY, 0), ==, -1);
@@ -1067,13 +1069,19 @@ t_testbed_dev_access(UMockdevTestbedFixture * fixture, gconstpointer data)
10671069
close(fd);
10681070
}
10691071

1070-
/* open() with O_TMPFILE */
1072+
/* open() with O_TMPFILE (Linux >= 3.11) */
10711073
errno = 0;
1072-
fd = g_open("/dev", O_TMPFILE|O_RDWR, 0644);
1073-
g_assert_cmpint(errno, ==, 0);
1074-
g_assert_cmpint(fd, >, 0);
1075-
g_assert_cmpint(write(fd, "hello", 5), ==, 5);
1076-
close(fd);
1074+
g_assert_cmpint(uname(&uts), ==, 0);
1075+
1076+
if (strncmp(uts.release, "3.11", 4) >= 0) {
1077+
fd = g_open("/dev", O_TMPFILE|O_RDWR, 0644);
1078+
g_assert_cmpint(errno, ==, 0);
1079+
g_assert_cmpint(fd, >, 0);
1080+
g_assert_cmpint(write(fd, "hello", 5), ==, 5);
1081+
close(fd);
1082+
} else {
1083+
g_printf("(Skipping O_TMPFILE test, Linux version %s too old) ", uts.release);
1084+
}
10771085

10781086
g_free(devdir);
10791087
}

0 commit comments

Comments
 (0)