25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: do_tests.c,v 1.8 2005/03/05 12:05:31 debug Exp $ |
* $Id: do_tests.c,v 1.12 2005/06/26 11:36:30 debug Exp $ |
29 |
* |
* |
30 |
* This program assembles, links, and runs all regression tests. |
* This program assembles, links, and runs all regression tests. |
31 |
*/ |
*/ |
41 |
static char *progname; |
static char *progname; |
42 |
static char *invoke_cc, *invoke_as, *invoke_ld, *invoke_gxemul; |
static char *invoke_cc, *invoke_as, *invoke_ld, *invoke_gxemul; |
43 |
|
|
44 |
#define MAX_WAYS 2 |
#define MAX_WAYS 1 |
45 |
static char *way_args[MAX_WAYS] = { "-E testmips", "-E testmips -b" }; |
static char *way_args[MAX_WAYS] = { "-E testmips" }; |
46 |
|
|
47 |
|
|
48 |
/* |
/* |
96 |
|
|
97 |
snprintf(fname, sizeof(fname), dp->d_name); |
snprintf(fname, sizeof(fname), dp->d_name); |
98 |
|
|
99 |
strcpy(oname, fname); oname[strlen(oname)-1] = '\0'; |
strlcpy(oname, fname, sizeof(oname)); |
100 |
strcpy(ename, oname); |
strlcpy(ename, oname, sizeof(ename)); |
101 |
strcpy(gname, oname); |
strlcpy(gname, oname, sizeof(gname)); |
102 |
|
|
103 |
strcat(oname, "o"); |
/* Remove the 'S': */ |
104 |
strcat(ename, "out"); /* MIPS executable */ |
oname[strlen(oname)-1] = '\0'; |
105 |
strcat(gname, "good"); |
ename[strlen(ename)-1] = '\0'; |
106 |
|
gname[strlen(gname)-1] = '\0'; |
107 |
|
|
108 |
|
strlcat(oname, "o", sizeof(oname)); |
109 |
|
strlcat(ename, "out", sizeof(ename)); |
110 |
|
/* ename = MIPS executable */ |
111 |
|
strlcat(gname, "good", sizeof(gname)); |
112 |
} |
} |
113 |
|
|
114 |
args = way_args[way]; |
args = way_args[way]; |
118 |
if (res == 0) { |
if (res == 0) { |
119 |
char s[10000]; |
char s[10000]; |
120 |
/* File exists, let's assemble it: */ |
/* File exists, let's assemble it: */ |
121 |
sprintf(s, "%s %s -o %s", invoke_as, fname, oname); |
snprintf(s, sizeof(s), "%s %s -o %s", invoke_as, |
122 |
|
fname, oname); |
123 |
res = system(s); |
res = system(s); |
124 |
if (res != 0) { |
if (res != 0) { |
125 |
printf("%05i: ERROR when invoking assembler, " |
printf("%05i: ERROR when invoking assembler, " |
126 |
"error code %i\n", test_nr, res); |
"error code %i\n", test_nr, res); |
127 |
tests_failed ++; |
tests_failed ++; |
128 |
} else { |
} else { |
129 |
sprintf(s, "%s test_common.o %s -o %s", |
snprintf(s, sizeof(s), |
130 |
|
"%s test_common.o %s -o %s", |
131 |
invoke_ld, oname, ename); |
invoke_ld, oname, ename); |
132 |
res = system(s); |
res = system(s); |
133 |
if (res != 0) { |
if (res != 0) { |
138 |
} else { |
} else { |
139 |
char *t = tmpnam(NULL); |
char *t = tmpnam(NULL); |
140 |
/* printf("t = %s\n", t); */ |
/* printf("t = %s\n", t); */ |
141 |
sprintf(s, "%s -q %s %s > %s", |
snprintf(s, sizeof(s), |
142 |
|
"%s -q %s %s > %s", |
143 |
invoke_gxemul, args, ename, t); |
invoke_gxemul, args, ename, t); |
144 |
res = system(s); |
res = system(s); |
145 |
if (res != 0) { |
if (res != 0) { |
150 |
} else { |
} else { |
151 |
/* Compare the output to a |
/* Compare the output to a |
152 |
known good test result: */ |
known good test result: */ |
153 |
sprintf(s, "cmp -s %s %s", |
snprintf(s, sizeof(s), |
154 |
gname, t); |
"cmp -s %s %s", gname, t); |
155 |
res = system(s); |
res = system(s); |
156 |
if (res != 0) { |
if (res != 0) { |
157 |
printf("%05i: ERROR " |
printf("%05i: ERROR " |
159 |
"rent output to kno" |
"rent output to kno" |
160 |
"wn good output\n", |
"wn good output\n", |
161 |
test_nr); |
test_nr); |
162 |
sprintf(s, "cat %s\n", |
snprintf(s, sizeof(s), |
163 |
gname); |
"cat %s\n", gname); |
164 |
printf("%s\n", s); |
printf("%s\n", s); |
165 |
system(s); |
system(s); |
166 |
sprintf(s, "cat %s\n", |
snprintf(s, sizeof(s), |
167 |
t); |
"cat %s\n", t); |
168 |
printf("%s\n", s); |
printf("%s\n", s); |
169 |
system(s); |
system(s); |
170 |
tests_failed ++; |
tests_failed ++; |