aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/rvtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rvtest.c')
-rw-r--r--src/tools/rvtest.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/rvtest.c b/src/tools/rvtest.c
index d108672d2..3432ab9b4 100644
--- a/src/tools/rvtest.c
+++ b/src/tools/rvtest.c
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
64 // open test file 64 // open test file
65 char *fname = argv[1]; 65 char *fname = argv[1];
66 FILE *fp = fopen(fname, "r"); 66 FILE *fp = fopen(fname, "r");
67 67
68 // read test file 68 // read test file
69 char buf[MAXBUF]; 69 char buf[MAXBUF];
70 int line = 0; 70 int line = 0;
@@ -80,22 +80,22 @@ int main(int argc, char **argv) {
80 *ptr ='\0'; 80 *ptr ='\0';
81 if (*start == '\0') 81 if (*start == '\0')
82 continue; 82 continue;
83 83
84 // skip comments 84 // skip comments
85 if (*start == '#') 85 if (*start == '#')
86 continue; 86 continue;
87 ptr = strchr(start, '#'); 87 ptr = strchr(start, '#');
88 if (ptr) 88 if (ptr)
89 *ptr = '\0'; 89 *ptr = '\0';
90 90
91 // extract exit status 91 // extract exit status
92 int status; 92 int status;
93 int rv = sscanf(start, "%d\n", &status); 93 int rv = sscanf(start, "%d\n", &status);
94 if (rv != 1) { 94 if (rv != 1) {
95 fprintf(stderr, "Error: invalid line %d in %s\n", line, fname); 95 fprintf(stderr, "Error: invalid line %d in %s\n", line, fname);
96 exit(1); 96 exit(1);
97 } 97 }
98 98
99 // extract command 99 // extract command
100 char *cmd = strchr(start, ' '); 100 char *cmd = strchr(start, ' ');
101 if (!cmd) { 101 if (!cmd) {
@@ -124,21 +124,21 @@ int main(int argc, char **argv) {
124 // parent 124 // parent
125 else { 125 else {
126 int exit_status; 126 int exit_status;
127 127
128 alarm(TIMEOUT); 128 alarm(TIMEOUT);
129 pid = waitpid(pid, &exit_status, 0); 129 pid = waitpid(pid, &exit_status, 0);
130 if (pid == -1) { 130 if (pid == -1) {
131 perror("waitpid"); 131 perror("waitpid");
132 exit(1); 132 exit(1);
133 } 133 }
134 134
135 if (WEXITSTATUS(exit_status) != status) 135 if (WEXITSTATUS(exit_status) != status)
136 printf("ERROR TESTING: %s\n", cmd); 136 printf("ERROR TESTING: %s\n", cmd);
137 } 137 }
138 138
139 fflush(0); 139 fflush(0);
140 } 140 }
141 fclose(fp); 141 fclose(fp);
142 142
143 return 0; 143 return 0;
144} \ No newline at end of file 144}