Fixed spacing in debug message.
[AROS.git] / test / runtests.c
blobe4f1a6b16c3b08c51a36619843a3173ce3cacf55
1 #include <aros/debug.h>
2 #include <proto/dos.h>
4 BPTR scripthandle;
5 CONST_STRPTR scriptname;
6 UBYTE command[200];
7 LONG error;
8 LONG failcnt;
9 LONG errorcnt;
10 LONG warncnt;
11 LONG okcnt;
12 LONG noshellcnt;
13 LONG rubbishcnt;
15 int main(int argc, char **argv)
17 if (argc == 1)
19 scriptname = "testscript";
21 else if (argc == 2)
23 scriptname = argv[1];
25 else
27 PutStr("Usage runtest [scriptfile]\n");
30 scripthandle = Open(scriptname, MODE_OLDFILE);
31 if (!scripthandle)
33 PutStr("Can't open file\n");
34 return 0;
37 PutStr("Reading commands from file ");
38 PutStr(scriptname);
39 PutStr("\nOutput will be sent to the debugging console\n\n");
41 while (FGets(scripthandle, command, sizeof command))
43 if (command[0] != '#' && command[0] != '\n')
45 bug("====================================\n");
46 bug("Running command: %s", command);
47 error = SystemTagList(command, NULL);
48 bug("returns: %d\n", error);
50 if (error == -1)
51 noshellcnt++;
52 else if (error > 100 || error < 0)
53 rubbishcnt++;
54 else if (error >= RETURN_FAIL)
55 failcnt++;
56 else if (error >= RETURN_ERROR)
57 errorcnt++;
58 else if (error >= RETURN_WARN)
59 warncnt++;
60 else
61 okcnt++;
64 bug("====================================\n");
65 bug("Summary: ok %d, warn %d, error %d, fail %d, no Shell %d, rubbish %d\n",
66 okcnt, warncnt, errorcnt, failcnt, noshellcnt, rubbishcnt);
68 Close(scripthandle);
70 return 0;