[testsuite] (checked in) add optional debug output to dfp tests

Janis Johnson janis187@us.ibm.com
Tue Mar 27 23:36:00 GMT 2007


Add optional debugging output to two decimal float tests.  Tested on
powerpc64-linux, checked in on mainline.

2007-03-27  Janis Johnson  <janis187@us.ibm.com>

	* gcc.dg/dfp/func-vararg-mixed.c: Add optional debugging output.
	* gcc.dg/dfp/func-vararg-dfp.c: Ditto.

Index: gcc/testsuite/gcc.dg/dfp/func-vararg-mixed.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/func-vararg-mixed.c	(revision 123081)
+++ gcc/testsuite/gcc.dg/dfp/func-vararg-mixed.c	(working copy)
@@ -7,6 +7,16 @@
 #include <stdarg.h>
 
 extern void abort (void);
+static int failcnt = 0;
+                                                                                
+/* Support compiling the test to report individual failures; default is
+   to abort as soon as a check fails.  */
+#ifdef DBG
+#include <stdio.h>
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
+#else
+#define FAILURE abort ();
+#endif
 
 /* Supposing the list of varying number of arguments is:
    unsigned int, _Decimal128, double, _Decimal32, _Decimal64.  */
@@ -95,11 +105,13 @@
 int
 main ()
 {
-  if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) abort ();
-  if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) abort ();
-  if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) abort ();
-  if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) abort ();
-  if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) abort ();
+  if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+  if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+  if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+  if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+  if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
 
+  if (failcnt != 0)
+    abort ();
   return 0;
 }
Index: gcc/testsuite/gcc.dg/dfp/func-vararg-dfp.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/func-vararg-dfp.c	(revision 123081)
+++ gcc/testsuite/gcc.dg/dfp/func-vararg-dfp.c	(working copy)
@@ -6,6 +6,16 @@
 #include <stdarg.h>
 
 extern void abort (void);
+static int failcnt = 0;
+                                                                                
+/* Support compiling the test to report individual failures; default is
+   to abort as soon as a check fails.  */
+#ifdef DBG
+#include <stdio.h>
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
+#else
+#define FAILURE abort ();
+#endif
 
 static _Decimal32
 vararg32 (unsigned arg, ...)
@@ -54,45 +64,46 @@
 {
   /* _Decimal32 variants.  */
   if (vararg32 (0, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
-    abort ();
+    FAILURE
   if (vararg32 (1, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
-    abort ();
+    FAILURE
   if (vararg32 (2, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
-    abort ();
+    FAILURE
   if (vararg32 (3, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
-    abort ();
+    FAILURE
   if (vararg32 (4, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
-    abort ();
+    FAILURE
   if (vararg32 (5, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
-    abort ();
+    FAILURE
 
   /* _Decimal64 variants.  */
   if (vararg64 (0, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
-    abort ();
+    FAILURE
   if (vararg64 (1, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
-    abort ();
+    FAILURE
   if (vararg64 (2, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
-    abort ();
+    FAILURE
   if (vararg64 (3, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
-    abort ();
+    FAILURE
   if (vararg64 (4, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
-    abort ();
+    FAILURE
   if (vararg64 (5, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
-    abort ();
+    FAILURE
 
   /* _Decimal128 variants.  */
   if (vararg128 (0, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
-    abort ();
+    FAILURE
   if (vararg128 (1, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
-    abort ();
+    FAILURE
   if (vararg128 (2, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
-    abort ();
+    FAILURE
   if (vararg128 (3, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
-    abort ();
+    FAILURE
   if (vararg128 (4, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
-    abort ();
+    FAILURE
   if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
+    FAILURE
+
+  if (failcnt != 0)
     abort ();
-
-  return 0;
 }



More information about the Gcc-patches mailing list