2 * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 /* Control program to run all the other test cases */
35 #include <sys/param.h>
42 static char *av[MAXAV];
69 /* cleanup after the syscall test */
70 snprintf(buf, sizeof(buf),
71 "cd %s; find . -type d -mtime -1 -exec chmod 777 {} \\;", op->wd);
73 snprintf(buf, sizeof(buf),
74 "cd %s; find . -type f -mtime -1 -exec chmod 666 {} \\;", op->wd);
76 snprintf(buf, sizeof(buf),
77 "cd %s; chflags \"nouappnd nouchg nouunlnk\" .", op->wd);
79 snprintf(buf, sizeof(buf),
80 "cd %s; rm -rf syscall.[0-9]* fifo.[0-9]* creat.[0-9]* "
81 "p[0-9]*.d1 df lock", op->cd);
91 char fullpath[MAXPATHLEN+1];
96 r = (pid_t *)malloc(op->argc * sizeof(pid_t));
100 (void) strftime(ct, sizeof(ct), "%T", tm);
101 printf("%s Loop #%d\n", ct, loop++);
103 for (i = 0; i < op->argc; i++) {
104 if ((r[i] = fork()) == 0) {
105 snprintf(fullpath, sizeof(fullpath), "%s/%s", home,
107 if (execv(fullpath, mkargv(basename(op->argv[i]))) == -1)
108 err(1, "execl(%s), %s:%d", fullpath, __FILE__,
112 err(1, "fork(), %s:%d", __FILE__, __LINE__);
114 for (i = 0; i < op->argc; i++)
115 if (r[i] != 0 && waitpid(r[i], &s, 0) == -1)
116 err(1, "waitpid(%d), %s:%d", r[i], __FILE__, __LINE__);