1 /* Child process run by rox-child and rox-multichild tests.
2 Opens and tries to write to its own executable, verifying that
4 Then recursively executes itself to the depth indicated by the
5 first command-line argument. */
11 #include "tests/lib.h"
13 const char *test_name = "child-rox";
22 CHECK ((handle = open ("child-rox")) > 1, "open \"child-rox\"");
25 CHECK (write (handle, buffer, sizeof buffer) == 0,
26 "try to write \"child-rox\"");
32 main (int argc UNUSED, char *argv[])
37 if (!isdigit (*argv[1]))
38 fail ("bad command-line arguments");
39 if (atoi (argv[1]) > 1)
44 snprintf (cmd, sizeof cmd, "child-rox %d", atoi (argv[1]) - 1);
45 CHECK ((child = exec (cmd)) != -1, "exec \"%s\"", cmd);
47 CHECK (wait (child) == 12, "wait for \"child-rox\"");