add strace test cases and test result

This commit is contained in:
Tomoki Shirasawa
2017-11-25 17:37:10 +09:00
parent 5cc738d6bd
commit 3b6056fb1a
7 changed files with 174 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
int
main(int argc, char **argv)
{
pid_t pid;
int rc;
int st;
if (argv[1] && !strcmp(argv[1], "exec")) {
exit(1);
}
pid = fork();
if (pid == 0) {
sleep(1);
execl("test2", "test2", "exec", NULL);
exit(99);
}
sleep(2);
rc = wait(&st);
if (rc != pid) {
printf("test2 NG\n");
exit(1);
}
exit(0);
}