From c9d954b27ee125c3c90a6d2951c62eec4abb160b Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 8 Sep 2013 07:51:39 -0400 Subject: run: allow non-absolute paths as command --- src/test/test-path-util.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/test/test-path-util.c') diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index f396b32ffe..b0aeb11a63 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -83,7 +83,31 @@ static void test_path(void) { } } +static void test_find_binary(void) { + char *p; + + assert(find_binary("/bin/sh", &p) == 0); + puts(p); + assert(streq(p, "/bin/sh")); + free(p); + + assert(find_binary("./test-path-util", &p) == 0); + puts(p); + assert(endswith(p, "/test-path-util")); + assert(path_is_absolute(p)); + free(p); + + assert(find_binary("sh", &p) == 0); + puts(p); + assert(endswith(p, "/sh")); + assert(path_is_absolute(p)); + free(p); + + assert(find_binary("xxxx-xxxx", &p) == -ENOENT); +} + int main(void) { test_path(); + test_find_binary(); return 0; } -- cgit v1.2.3-54-g00ecf