This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA]: testsuite/gdb.base/call-ar-st.[exp|c]: Change to work better with small targets


Hi,

the following patch allows the call-ar-st test to run better on smaller
targets.  Currently nearly all variable space is allocated on the stack
and moreover especially the double array is somewhat big.  The patch
changes all auto variables in main() to be static to unburden the stack
and reduces the size of the double array to reduce the all over memory
requirements of the test.  Additionally it increases the timeout value
by 60 seconds considering that some small targets are also somewhat
slow.

Corinna

2001-10-25  Corinna Vinschen  <vinschen@redhat.com>

	* gdb.base/call-ar-st.c (print_double_array): Match for loop
	with new double_array size.
	(main): Change storage class of all local variables to static.
	Reduce size of double_array to 9.
	* gdb.base/call-ar-st.exp:  Increase timeout value.
	Change expected output for double array to match new size in
	call-ar-st.c.

Index: gdb.base/call-ar-st.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.c,v
retrieving revision 1.2
diff -u -p -r1.2 call-ar-st.c
--- call-ar-st.c	2000/03/30 23:32:30	1.2
+++ call-ar-st.c	2001/10/25 13:49:08
@@ -231,7 +231,7 @@ void print_double_array (array_d) 
 
   printf("array_d :\n");
   printf("=========\n\n");
-  for (index = 0; index < 100; index++) {
+  for (index = 0; index < 9; index++) {
       printf("%f  ", array_d[index]); 
       if ((index%8) == 0) printf("\n");
   }
@@ -1147,48 +1147,48 @@ int main ()  {
 
   /* variables for array and enumerated type testing
    */
-  char     char_array[121];
-  double   double_array[100];
-  float    float_array[15];
-  int      integer_array[50]; 
-  int      index;
-  id_int   student_id = 23;
-  colors   my_shirt = YELLOW;
+  static char     char_array[121];
+  static double   double_array[9];
+  static float    float_array[15];
+  static int      integer_array[50]; 
+  static int      index;
+  static id_int   student_id = 23;
+  static colors   my_shirt = YELLOW;
     
   /* variables for large structure testing
    */
-  int number = 10;
-  struct array_rep_info_t *list1;
-  struct array_rep_info_t *list2;
-  struct array_rep_info_t *list3;
-  struct array_rep_info_t *list4;
+  static int number = 10;
+  static struct array_rep_info_t *list1;
+  static struct array_rep_info_t *list2;
+  static struct array_rep_info_t *list3;
+  static struct array_rep_info_t *list4;
 
   /* variables for testing a very long argument list
    */
-   double                    a;
-   double                    b;
-   int                       c;
-   int                       d;
-   int                       e;
-   int                       f;
+   static double                    a;
+   static double                    b;
+   static int                       c;
+   static int                       d;
+   static int                       e;
+   static int                       f;
 
   /* variables for testing a small structures and a very long argument list
    */
-   struct small_rep_info_t  *struct1;
-   struct small_rep_info_t  *struct2;
-   struct small_rep_info_t  *struct3;
-   struct small_rep_info_t  *struct4;
-   struct bit_flags_t       *flags;
-   struct bit_flags_combo_t *flags_combo;
-   struct three_char_t      *three_char;
-   struct five_char_t       *five_char;
-   struct int_char_combo_t  *int_char_combo;
-   struct one_double_t      *d1;
-   struct one_double_t      *d2;
-   struct one_double_t      *d3;
-   struct two_floats_t      *f1;
-   struct two_floats_t      *f2;
-   struct two_floats_t      *f3;
+   static struct small_rep_info_t  *struct1;
+   static struct small_rep_info_t  *struct2;
+   static struct small_rep_info_t  *struct3;
+   static struct small_rep_info_t  *struct4;
+   static struct bit_flags_t       *flags;
+   static struct bit_flags_combo_t *flags_combo;
+   static struct three_char_t      *three_char;
+   static struct five_char_t       *five_char;
+   static struct int_char_combo_t  *int_char_combo;
+   static struct one_double_t      *d1;
+   static struct one_double_t      *d2;
+   static struct one_double_t      *d3;
+   static struct two_floats_t      *f1;
+   static struct two_floats_t      *f2;
+   static struct two_floats_t      *f3;
 
   /* Initialize arrays
    */
@@ -1198,7 +1198,7 @@ int main ()  {
   }
   char_array[120] = '\0';
 
-  for (index = 0; index < 100; index++) {
+  for (index = 0; index < 9; index++) {
       double_array[index] = index*23.4567;
   }
 
Index: gdb.base/call-ar-st.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.exp,v
retrieving revision 1.9
diff -u -p -r1.9 call-ar-st.exp
--- call-ar-st.exp	2001/07/16 18:44:23	1.9
+++ call-ar-st.exp	2001/10/25 13:49:08
@@ -56,6 +56,9 @@ if [target_info exists gdb,cannot_call_f
     continue
 }
 
+set oldtimeout $timeout
+set timeout [expr "$timeout + 60"]
+
 # Set the current language to C.  This counts as a test.  If it
 # fails, then we skip the other tests.
 
@@ -122,18 +125,7 @@ if {![gdb_skip_float_test "print print_d
 	"\[ \t\r\n\]+========="
 	"\[ \t\r\n\]+0.000000"
 	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
+	"\[ \t\r\n\]+"
   }
 }
 
@@ -202,18 +194,7 @@ if {![gdb_skip_float_test "continuing to
 	"\[ \t\r\n\]+========="
 	"\[ \t\r\n\]+0.000000"
 	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
+	"\[ \t\r\n\]+"
 	".*array_f :"
 	".*student id :\[\t \]+.*YELLOW"
 	".*array_i :"
@@ -259,18 +240,7 @@ if {![gdb_skip_float_test "print print_d
 	"\[ \t\r\n\]+========="
 	"\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
 	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
+	"\[ \t\r\n\]+"
     }
 }
 
@@ -289,18 +259,7 @@ if {![gdb_skip_float_test "continuing to
 	"\[ \t\r\n\]+========="
 	"\[ \t\r\n\]+0.000000"
 	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
+	"\[ \t\r\n\]+.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
     }
 } else {
     gdb_test "continue" "" ""
@@ -740,5 +699,6 @@ if ![gdb_skip_stdio_test "print print_on
     }
 }
 
+set timeout $oldtimeout
 return
 

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]