Skip to content

Commit

Permalink
tests: Fix t_testbed_libc for NixOS
Browse files Browse the repository at this point in the history
The NixOS build sandbox does not have /run, nor /var, so use /bin as the
test directory. Add another assertion that the original directory open()
succeeds, to avoid a confusing `EBADF` on the `openat()`.
  • Loading branch information
martinpitt committed Jan 3, 2021
1 parent 5b9b776 commit 7719fef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test-umockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,12 @@ t_testbed_libc(UMockdevTestbedFixture * fixture, gconstpointer data)
close(dirfd);

/* sys/ in other dir should not be trapped */
dirfd = open("/bin", O_RDONLY | O_DIRECTORY);
g_assert_cmpint(dirfd, >=, 0);
errno = 0;
dirfd = open("/run", O_RDONLY | O_DIRECTORY);
g_assert_cmpint(openat(dirfd, "sys", O_RDONLY), <, 0);
g_assert_cmpint(errno, ==, ENOENT);

g_assert_cmpint(errno, ==, ENOENT);
g_assert_cmpint(openat64(dirfd, "sys", O_RDONLY), <, 0);
close(dirfd);
Expand Down

0 comments on commit 7719fef

Please sign in to comment.