@@ -10,6 +10,7 @@
1010#include <sys/wait.h>
1111
1212#define TESTPATH "/foo/bar/test"
13+#define SUBTEST "./test sub"
1314
1415extern char **environ;
1516
@@ -36,7 +37,11 @@ void test_system(void) {
3637 assert(system(TESTPATH) == 0);
3738}
3839
39−int main(void)
40+void test_subprocess(void) {
41+ assert(system(SUBTEST) == 0);
42+}
43+
44+int main(int argc, char *argv[])
4045{
4146 FILE *testfp;
4247 int testfd;
@@ -56,6 +61,14 @@ int main(void)
5661
5762 test_spawn();
5863 test_system();
64+
65+ // Only run subprocess if no arguments are given
66+ // as the subprocess will be called without argument
67+ // otherwise we will have infinite recursion
68+ if (argc == 1) {
69+ test_subprocess();
70+ }
71+
5972 test_execv();
6073
6174 /* If all goes well, this is never reached because test_execv() replaces