summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-03-27 15:38:01 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-03-27 15:38:01 -0400
commitcd929976f8beb208c0c3524ae11de6ceed941324 (patch)
tree43aed94089ac02b122249e546a1bdeda7221c6b2 /tests
parent943581a4d59b42a684666f146324d908b0dac428 (diff)
downloadbfs-cd929976f8beb208c0c3524ae11de6ceed941324.tar.xz
xspawn: Fix bfs_resolve_late() error reporting
Diffstat (limited to 'tests')
-rw-r--r--tests/xspawn.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/xspawn.c b/tests/xspawn.c
index 5f80e76..c1bac36 100644
--- a/tests/xspawn.c
+++ b/tests/xspawn.c
@@ -170,6 +170,27 @@ out:
return ret;
}
+static bool check_resolve(void) {
+ bool ret = true;
+ char *exe;
+
+ exe = bfs_spawn_resolve("sh");
+ ret &= bfs_pcheck(exe, "bfs_spawn_resolve('sh')");
+ free(exe);
+
+ exe = bfs_spawn_resolve("/bin/sh");
+ ret &= bfs_pcheck(exe && strcmp(exe, "/bin/sh") == 0);
+ free(exe);
+
+ exe = bfs_spawn_resolve("bin/tests/xspawnee");
+ ret &= bfs_pcheck(exe && strcmp(exe, "bin/tests/xspawnee") == 0);
+ free(exe);
+
+ ret &= bfs_pcheck(!bfs_spawn_resolve("eW6f5RM9Qi") && errno == ENOENT);
+
+ return ret;
+}
+
bool check_xspawn(void) {
bool ret = true;
@@ -179,5 +200,7 @@ bool check_xspawn(void) {
ret &= check_enoent(true);
ret &= check_enoent(false);
+ ret &= check_resolve();
+
return ret;
}