summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2014-04-12 16:07:45 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-12 17:23:13 -0400
commiteb66db55fc4b342e4253065886e0cc0419c45a07 (patch)
treeba9a5862de90e86b3ebeb662a7746cc740618eeb /src/test
parentb189101727e80a09864c5e5880663ef565467f19 (diff)
fsck: Search for fsck.type in PATH
Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-path-util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index bec2a83611..a2cf0af75f 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -158,9 +158,20 @@ static void test_prefixes(void) {
}
}
+static void test_fsck_exists(void) {
+ /* Ensure we use a sane default for PATH. */
+ unsetenv("PATH");
+
+ /* fsck.minix is provided by util-linux and will probably exist. */
+ assert_se(fsck_exists("minix") == 0);
+
+ assert_se(fsck_exists("AbCdE") == -ENOENT);
+}
+
int main(void) {
test_path();
test_find_binary();
test_prefixes();
+ test_fsck_exists();
return 0;
}