Skip to content

Commit

Permalink
Skip O_TMPFILE test on Linux versions which don't support that
Browse files Browse the repository at this point in the history
There it fails with EISDIR (Linux < 3.11) or potentially EINVAL.
  • Loading branch information
martinpitt committed Sep 22, 2014
1 parent 4d502d2 commit ce09625
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.8.8 (UNRELEASED)
------------------
- Skip O_TMPFILE test on Linux versions which don't support that.

0.8.7 (2014-09-19)
------------------
- /umockdev-run/integration/input-evtest-evemu test: Be more liberal in parsing
Expand Down
22 changes: 15 additions & 7 deletions tests/test-umockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,13 +1067,21 @@ t_testbed_dev_access(UMockdevTestbedFixture * fixture, gconstpointer data)
close(fd);
}

/* open() with O_TMPFILE */
errno = 0;
fd = g_open("/dev", O_TMPFILE|O_RDWR, 0644);
g_assert_cmpint(errno, ==, 0);
g_assert_cmpint(fd, >, 0);
g_assert_cmpint(write(fd, "hello", 5), ==, 5);
close(fd);
/* open() with O_TMPFILE; this hasn't been supported in Linux for very long
* (>= 3.11), so check that it works in the testbed only if it also works
* in the "normal" file system. */
fd = g_open("/tmp", O_TMPFILE|O_RDWR, 0644);
if (fd >= 0) {
close(fd);
errno = 0;
fd = g_open("/dev", O_TMPFILE|O_RDWR, 0644);
g_assert_cmpint(errno, ==, 0);
g_assert_cmpint(fd, >, 0);
g_assert_cmpint(write(fd, "hello", 5), ==, 5);
close(fd);
} else {
g_printf("(Skipping O_TMPFILE test, not supported on this kernel: %m) ");
}

g_free(devdir);
}
Expand Down

0 comments on commit ce09625

Please sign in to comment.