Now the regression tests could go online again
[fw/sdcc] / support / regression / fwk / lib / testfwk.c
index 0bfcbc0b679dec996ea8932dde8c75bfa5fdc37b..766954a697bc171d4641df4e649fd41deb704569 100644 (file)
@@ -3,12 +3,17 @@
 #include <testfwk.h>
 #include <stdarg.h>
 
+#ifdef __ds390
+#include <tinibios.h> /* main() must see the ISR declarations */
+#endif
+
 /** Define this if the port's div or mod functions are broken.
     A slow loop based method will be substituded.
 */
-#define BROKEN_DIV_MOD         1
+//#define BROKEN_DIV_MOD               1
 
 void _putchar(char c);
+void _exitEmu(void);
 
 #if BROKEN_DIV_MOD
 int __div(int num, int denom)
@@ -56,7 +61,7 @@ static void _printn(int n)
     _putchar('0' + rem);
 }
 
-void __printf(const char *szFormat, ...)
+void __printf(const char *szFormat, ...) REENTRANT
 {
     va_list ap;
     va_start(ap, szFormat);
@@ -65,7 +70,7 @@ void __printf(const char *szFormat, ...)
         if (*szFormat == '%') {
             switch (*++szFormat) {
             case 's': {
-                const char *sz = va_arg(ap, const char *);
+                char *sz = va_arg(ap, char *);
                 while (*sz) {
                     _putchar(*sz++);
                 }
@@ -104,12 +109,12 @@ __fail(const char *szMsg, const char *szCond, const char *szFile, int line)
 int 
 main(void)
 {
-    TESTFUN **cases;
+    TESTFUN*cases;
     int numCases = 0;
 
     __printf("--- Running: %s\n", getSuiteName());
 
-    cases = (TESTFUN **)suite();
+    cases = suite();
 
     while (*cases) {
         __printf("Running %u\n", numCases);
@@ -123,5 +128,7 @@ main(void)
            __numFailures, __numTests, numCases
            );
 
-    return __numFailures;
+    _exitEmu();
+
+    return 0;
 }