libredirect: add subprocess test
This commit is contained in:
parent
4961547d05
commit
fc5196c2f0
@ -10,6 +10,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#define TESTPATH "/foo/bar/test"
|
#define TESTPATH "/foo/bar/test"
|
||||||
|
#define SUBTEST "./test sub"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -36,7 +37,11 @@ void test_system(void) {
|
|||||||
assert(system(TESTPATH) == 0);
|
assert(system(TESTPATH) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
void test_subprocess(void) {
|
||||||
|
assert(system(SUBTEST) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *testfp;
|
FILE *testfp;
|
||||||
int testfd;
|
int testfd;
|
||||||
@ -56,6 +61,14 @@ int main(void)
|
|||||||
|
|
||||||
test_spawn();
|
test_spawn();
|
||||||
test_system();
|
test_system();
|
||||||
|
|
||||||
|
// Only run subprocess if no arguments are given
|
||||||
|
// as the subprocess will be called without argument
|
||||||
|
// otherwise we will have infinite recursion
|
||||||
|
if (argc == 1) {
|
||||||
|
test_subprocess();
|
||||||
|
}
|
||||||
|
|
||||||
test_execv();
|
test_execv();
|
||||||
|
|
||||||
/* If all goes well, this is never reached because test_execv() replaces
|
/* If all goes well, this is never reached because test_execv() replaces
|
||||||
|
Loading…
Reference in New Issue
Block a user