2 Copyright (C) 2013, The AROS Development Team. All rights reserved.
6 /******************************************************************************
22 Executes all commands given by an input script. Reports memory loss
23 and summarizes the return codes. The commands shouldn't do any
24 output on success to avoid increasing of the shell's buffer.
25 The result is printed to the debugging console.
29 scriptname -- script with the programs to be executed. Defaults to
46 ******************************************************************************/
48 #include <aros/debug.h>
49 #include <proto/dos.h>
50 #include <proto/exec.h>
53 CONST_STRPTR scriptname
;
63 static ULONG
checkmem(void)
65 FreeVec(AllocVec((ULONG
)(~0ul/2), MEMF_ANY
)); // trigger expunges
66 return AvailMem(MEMF_ANY
);
69 int main(int argc
, char **argv
)
75 scriptname
= "testscript";
83 PutStr("Usage runtest [scriptfile]\n");
86 scripthandle
= Open(scriptname
, MODE_OLDFILE
);
89 PutStr("Can't open file\n");
93 PutStr("Reading commands from file ");
95 PutStr("\nOutput will be sent to the debugging console\n\n");
97 while (FGets(scripthandle
, command
, sizeof command
))
99 if (command
[0] != '#' && command
[0] != '\n')
101 bug("====================================\n");
102 bug("Running command: %s", command
);
104 mem_old
= checkmem();
105 error
= SystemTagList(command
, NULL
);
108 bug("returns: %d\n", error
);
112 bug("Memory loss %ul Bytes\n", mem_old
- mem
);
117 else if (error
> 100 || error
< 0)
119 else if (error
>= RETURN_FAIL
)
121 else if (error
>= RETURN_ERROR
)
123 else if (error
>= RETURN_WARN
)
129 bug("====================================\n");
130 bug("Summary: ok %d, warn %d, error %d, fail %d, no Shell %d, rubbish %d\n",
131 okcnt
, warncnt
, errorcnt
, failcnt
, noshellcnt
, rubbishcnt
);