Skip to content

Commit ce09625

Browse files
committed
Skip O_TMPFILE test on Linux versions which don't support that
There it fails with EISDIR (Linux < 3.11) or potentially EINVAL.
1 parent 4d502d2 commit ce09625

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
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 which don't support that.
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: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,13 +1067,21 @@ t_testbed_dev_access(UMockdevTestbedFixture * fixture, gconstpointer data)
10671067
close(fd);
10681068
}
10691069

1070-
/* open() with O_TMPFILE */
1071-
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);
1070+
/* open() with O_TMPFILE; this hasn't been supported in Linux for very long
1071+
* (>= 3.11), so check that it works in the testbed only if it also works
1072+
* in the "normal" file system. */
1073+
fd = g_open("/tmp", O_TMPFILE|O_RDWR, 0644);
1074+
if (fd >= 0) {
1075+
close(fd);
1076+
errno = 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, not supported on this kernel: %m) ");
1084+
}
10771085

10781086
g_free(devdir);
10791087
}

0 commit comments

Comments
 (0)