summaryrefslogtreecommitdiffstats
path: root/tests/xspawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/xspawn.c')
-rw-r--r--tests/xspawn.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/tests/xspawn.c b/tests/xspawn.c
index c1bac36..785ea48 100644
--- a/tests/xspawn.c
+++ b/tests/xspawn.c
@@ -1,12 +1,12 @@
// Copyright © Tavian Barnes <tavianator@tavianator.com>
// SPDX-License-Identifier: 0BSD
+#include "prelude.h"
#include "tests.h"
-#include "../src/alloc.h"
-#include "../src/bfstd.h"
-#include "../src/config.h"
-#include "../src/dstring.h"
-#include "../src/xspawn.h"
+#include "alloc.h"
+#include "bfstd.h"
+#include "dstring.h"
+#include "xspawn.h"
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
@@ -64,27 +64,20 @@ static bool check_use_path(bool use_posix) {
spawn.flags &= ~BFS_SPAWN_USE_POSIX;
}
- const char *builddir = getenv("BUILDDIR");
- dchar *bin = dstrprintf("%s/bin", builddir ? builddir : ".");
- ret &= bfs_pcheck(bin, "dstrprintf()");
- if (!ret) {
- goto destroy;
- }
-
- ret &= bfs_pcheck(bfs_spawn_addopen(&spawn, 10, bin, O_RDONLY | O_DIRECTORY, 0) == 0);
+ ret &= bfs_pcheck(bfs_spawn_addopen(&spawn, 10, "bin", O_RDONLY | O_DIRECTORY, 0) == 0);
ret &= bfs_pcheck(bfs_spawn_adddup2(&spawn, 10, 11) == 0);
ret &= bfs_pcheck(bfs_spawn_addclose(&spawn, 10) == 0);
ret &= bfs_pcheck(bfs_spawn_addfchdir(&spawn, 11) == 0);
ret &= bfs_pcheck(bfs_spawn_addclose(&spawn, 11) == 0);
if (!ret) {
- goto bin;
+ goto destroy;
}
// Check that $PATH is resolved in the parent's environment
char **envp;
ret &= bfs_pcheck(envp = envdup());
if (!ret) {
- goto bin;
+ goto destroy;
}
// Check that $PATH is resolved after the file actions
@@ -138,8 +131,6 @@ env:
free(*var);
}
free(envp);
-bin:
- dstrfree(bin);
destroy:
ret &= bfs_pcheck(bfs_spawn_destroy(&spawn) == 0);
out: