This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Testsuite PATCH: Avoid .x files for gcov.


This patch removes gcov .x files; they're not necessary if we take
advantage of dg.exp's functionality.

Tested by running the tests and staring at log files on
i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com

2003-03-27  Mark Mitchell  <mark at codesourcery dot com>

	* lib/gcov.exp (run-gcov): Add branches and calls options, rather
	than reading .x files.
	* g++.dg/gcov/gcov-1.C: Use run-gcov options, not .x files.
	* g77.dg/gcov/gcov-1.f: Likewise.
	* gcc.misc-tests/gcov-4b.c: Likewise.
	* gcc.misc-tests/gcov-5b.c: Likewise.
	* gcc.misc-tests/gcov-6.c: Likewise.
	* gcc.misc-tests/gcov-7.c: Likewise.
	* gcc.misc-tests/gcov-8.c: Likewise.
	* g++.dg/gcov/gcov-1.x: Remove.
	* g77.dg/gcov/gcov-1.x: Likewise.
	* gcc.misc-tests/gcov-4b.x: Likewise.
	* gcc.misc-tests/gcov-5b.x: Likewise.
	* gcc.misc-tests/gcov-6.x: Likewise.
	* gcc.misc-tests/gcov-7.x: Likewise.
	* gcc.misc-tests/gcov-8.x: Likewise.

Index: g++.dg/gcov/gcov-1.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/gcov/gcov-1.C,v
retrieving revision 1.1
diff -c -5 -p -r1.1 gcov-1.C
*** g++.dg/gcov/gcov-1.C	29 Mar 2002 21:55:38 -0000	1.1
--- g++.dg/gcov/gcov-1.C	27 Mar 2003 23:45:37 -0000
*************** main()
*** 308,313 ****
        || (unref_val != 4))
      abort ();
    return 0;
  }
  
! /* { dg-final { run-gcov -b gcov-1.C } } */
--- 308,313 ----
        || (unref_val != 4))
      abort ();
    return 0;
  }
  
! /* { dg-final { run-gcov branches { -b gcov-1.C } } } */
Index: g++.dg/gcov/gcov-1.x
===================================================================
RCS file: g++.dg/gcov/gcov-1.x
diff -N g++.dg/gcov/gcov-1.x
*** g++.dg/gcov/gcov-1.x	29 Mar 2002 21:55:38 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,2 ****
- set gcov_verify_branches 1
- return 0
--- 0 ----
Index: g77.dg/gcov/gcov-1.f
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g77.dg/gcov/gcov-1.f,v
retrieving revision 1.1
diff -c -5 -p -r1.1 gcov-1.f
*** g77.dg/gcov/gcov-1.f	14 Sep 2001 20:46:45 -0000	1.1
--- g77.dg/gcov/gcov-1.f	27 Mar 2003 23:45:38 -0000
*************** C Test nested IF statements and IF with 
*** 422,427 ****
  					! branch(end)
           ie3 = foo(64)			! count(3)
        end if
        end
  C
! C { dg-final { run-gcov -b gcov-1.f } }
--- 422,427 ----
  					! branch(end)
           ie3 = foo(64)			! count(3)
        end if
        end
  C
! C { dg-final { run-gcov branches calls { -b gcov-1.f } } }
Index: g77.dg/gcov/gcov-1.x
===================================================================
RCS file: g77.dg/gcov/gcov-1.x
diff -N g77.dg/gcov/gcov-1.x
*** g77.dg/gcov/gcov-1.x	14 Sep 2001 20:47:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,3 ****
- set gcov_verify_branches 1
- set gcov_verify_calls 1
- return 0
--- 0 ----
Index: gcc.misc-tests/gcov-4b.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.misc-tests/gcov-4b.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 gcov-4b.c
*** gcc.misc-tests/gcov-4b.c	6 Feb 2002 20:40:18 -0000	1.2
--- gcc.misc-tests/gcov-4b.c	27 Mar 2003 23:45:38 -0000
*************** main()
*** 256,261 ****
        || (switch_val != 55))
      abort ();
    return 0;
  }
  
! /* { dg-final { run-gcov -b gcov-4b.c } } */
--- 256,261 ----
        || (switch_val != 55))
      abort ();
    return 0;
  }
  
! /* { dg-final { run-gcov branches { -b gcov-4b.c } } } */
Index: gcc.misc-tests/gcov-4b.x
===================================================================
RCS file: gcc.misc-tests/gcov-4b.x
diff -N gcc.misc-tests/gcov-4b.x
*** gcc.misc-tests/gcov-4b.x	7 Sep 2001 16:41:11 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,2 ****
- set gcov_verify_branches 1
- return 0
--- 0 ----
Index: gcc.misc-tests/gcov-5b.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.misc-tests/gcov-5b.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 gcov-5b.c
*** gcc.misc-tests/gcov-5b.c	20 Aug 2001 17:40:26 -0000	1.1
--- gcc.misc-tests/gcov-5b.c	27 Mar 2003 23:45:38 -0000
*************** int main ()
*** 29,34 ****
        doit (i, j);
  
    return 0;
  }
  
! /* { dg-final { run-gcov -b gcov-5b.c } } */
--- 29,34 ----
        doit (i, j);
  
    return 0;
  }
  
! /* { dg-final { run-gcov branches { -b gcov-5b.c } } } */
Index: gcc.misc-tests/gcov-5b.x
===================================================================
RCS file: gcc.misc-tests/gcov-5b.x
diff -N gcc.misc-tests/gcov-5b.x
*** gcc.misc-tests/gcov-5b.x	7 Sep 2001 16:41:26 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,2 ****
- set gcov_verify_branches 1
- return 0
--- 0 ----
Index: gcc.misc-tests/gcov-6.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.misc-tests/gcov-6.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 gcov-6.c
*** gcc.misc-tests/gcov-6.c	6 Sep 2001 23:29:35 -0000	1.1
--- gcc.misc-tests/gcov-6.c	27 Mar 2003 23:45:38 -0000
*************** main()
*** 32,37 ****
      					/* returns(75) */
      foo (i);				/* count(4) */
    					/* returns(end) */
  }
  
! /* { dg-final { run-gcov -b gcov-6.c } } */
--- 32,37 ----
      					/* returns(75) */
      foo (i);				/* count(4) */
    					/* returns(end) */
  }
  
! /* { dg-final { run-gcov branches calls { -b gcov-6.c } } } */
Index: gcc.misc-tests/gcov-6.x
===================================================================
RCS file: gcc.misc-tests/gcov-6.x
diff -N gcc.misc-tests/gcov-6.x
*** gcc.misc-tests/gcov-6.x	7 Sep 2001 16:41:49 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,3 ****
- set gcov_verify_branches 1
- set gcov_verify_calls 1
- return 0
--- 0 ----
Index: gcc.misc-tests/gcov-7.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.misc-tests/gcov-7.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 gcov-7.c
*** gcc.misc-tests/gcov-7.c	7 Sep 2001 16:42:54 -0000	1.1
--- gcc.misc-tests/gcov-7.c	27 Mar 2003 23:45:38 -0000
*************** main()
*** 79,84 ****
  					/* returns(0) */
    leave (passed());			/* count(1) */
  					/* returns(end) */
  }
  
! /* { dg-final { run-gcov -b gcov-7.c } } */
--- 79,84 ----
  					/* returns(0) */
    leave (passed());			/* count(1) */
  					/* returns(end) */
  }
  
! /* { dg-final { run-gcov calls branches { -b gcov-7.c } } } */
Index: gcc.misc-tests/gcov-7.x
===================================================================
RCS file: gcc.misc-tests/gcov-7.x
diff -N gcc.misc-tests/gcov-7.x
*** gcc.misc-tests/gcov-7.x	7 Sep 2001 16:42:04 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,3 ****
- set gcov_verify_branches 1
- set gcov_verify_calls 1
- return 0
--- 0 ----
Index: gcc.misc-tests/gcov-8.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.misc-tests/gcov-8.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 gcov-8.c
*** gcc.misc-tests/gcov-8.c	16 Sep 2002 13:29:50 -0000	1.2
--- gcc.misc-tests/gcov-8.c	27 Mar 2003 23:45:38 -0000
*************** int main ()
*** 42,47 ****
      t += foo (ix) + baz (ix);
    
    return t == 0;
  }
  
! /* { dg-final { run-gcov -b gcov-8.c } } */
--- 42,47 ----
      t += foo (ix) + baz (ix);
    
    return t == 0;
  }
  
! /* { dg-final { run-gcov branches {-b gcov-8.c } } } */
Index: gcc.misc-tests/gcov-8.x
===================================================================
RCS file: gcc.misc-tests/gcov-8.x
diff -N gcc.misc-tests/gcov-8.x
*** gcc.misc-tests/gcov-8.x	5 Aug 2002 22:16:51 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,2 ****
- set gcov_verify_branches 1
- return 0
--- 0 ----
Index: lib/gcov.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/gcov.exp,v
retrieving revision 1.2
diff -c -5 -p -r1.2 gcov.exp
*** lib/gcov.exp	5 Aug 2002 22:16:51 -0000	1.2
--- lib/gcov.exp	27 Mar 2003 23:45:38 -0000
*************** proc verify-calls { testcase file } {
*** 215,255 ****
      return $failed
  }
  
  # Called by dg-final to run gcov and analyze the results.
  #
! # ARGS is the options to pass to gcov followed by the name of the
! # test source file.
  
  proc run-gcov { args } {
      global GCOV
      global srcdir subdir
  
!     # Extract the test name from the arguments.
!     set testcase [lindex $args end]
  
!     # Get special options for this test from the .x script, if present.
!     # This can include:
!     #   gcov_execute_xfail     string to pass to setup_xfail
!     #   gcov_verify_xfail      string to pass to setup_xfail
!     #   gcov_verify_branches   if defined, check branch percentages
!     #   gcov_verify_calls      if defined, check call return percentages
!     if [file exists [file rootname $srcdir/$subdir/$testcase].x] {
! 	set done_p 0
! 	catch "set done_p \[source [file rootname $srcdir/$subdir/$testcase].x\]"
! 	if { $done_p } {
! 	    return
  	}
      }
  
!     if [info exists gcov_execute_xfail] {
  	eval setup_xfail [split $gcov_execute_xfail]
      }
  
      verbose "Running $GCOV $testcase" 2
      set testcase [remote_download host $testcase];
!     set result [remote_exec host $GCOV $args];
      if { [lindex $result 0] != 0 } {
  	fail "$subdir/$testcase gcov failed: [lindex $result 1]"
  	clean-gcov $testcase
  	return
      }
--- 215,258 ----
      return $failed
  }
  
  # Called by dg-final to run gcov and analyze the results.
  #
! # ARGS consists of the optional strings "branches" and/or "calls",
! # (indicating that these things should be verified) followed by a 
! # list of arguments to provide to gcov, including the name of the
! # source file.
  
  proc run-gcov { args } {
      global GCOV
      global srcdir subdir
  
!     set gcov_args [lindex $args end]
  
!     set gcov_verify_calls 0
!     set gcov_verify_branches 0
!     set gcov_execute_xfail ""
!     set gcov_verify_xfail ""
! 
!     foreach a $args {
! 	if { $a == "calls" } {
! 	  set gcov_verify_calls 1
! 	} elseif { $a == "branches" } {
! 	  set gcov_verify_branches 1
  	}
      }
  
!     # Extract the test name from the arguments.
!     set testcase [lindex $gcov_args end]
! 
!     if { $gcov_execute_xfail != "" } {
  	eval setup_xfail [split $gcov_execute_xfail]
      }
  
      verbose "Running $GCOV $testcase" 2
      set testcase [remote_download host $testcase];
!     set result [remote_exec host $GCOV $gcov_args];
      if { [lindex $result 0] != 0 } {
  	fail "$subdir/$testcase gcov failed: [lindex $result 1]"
  	clean-gcov $testcase
  	return
      }
*************** proc run-gcov { args } {
*** 261,285 ****
          clean-gcov $testcase
          return;
      }
      remote_upload host $testcase.gcov $testcase.gcov;
  
!     if [info exists gcov_verify_xfail] {
  	eval setup_xfail [split $gcov_verify_xfail]
      }
  
      # Check that line execution counts are as expected.
      set lfailed [verify-lines $testcase $testcase.gcov]
  
      # If requested via the .x file, check that branch and call information
      # is correct.
!     if [info exists gcov_verify_branches] {
  	set bfailed [verify-branches $testcase $testcase.gcov]
      } else {
  	set bfailed 0
      }
!     if [info exists gcov_verify_calls] {
  	set cfailed [verify-calls $testcase $testcase.gcov]
      } else {
  	set cfailed 0
      }
  
--- 264,288 ----
          clean-gcov $testcase
          return;
      }
      remote_upload host $testcase.gcov $testcase.gcov;
  
!     if { $gcov_verify_xfail != "" } {
  	eval setup_xfail [split $gcov_verify_xfail]
      }
  
      # Check that line execution counts are as expected.
      set lfailed [verify-lines $testcase $testcase.gcov]
  
      # If requested via the .x file, check that branch and call information
      # is correct.
!     if { $gcov_verify_branches } {
  	set bfailed [verify-branches $testcase $testcase.gcov]
      } else {
  	set bfailed 0
      }
!     if { $gcov_verify_calls } {
  	set cfailed [verify-calls $testcase $testcase.gcov]
      } else {
  	set cfailed 0
      }
  


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