This is the mail archive of the gcc@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]

[PATCH] Fix for false reports from compare_tests


Recently, I reported that compare_tests has been emitting what could
only be described as wrong output, describing tests as having failed
even when a .sum file was compared with itself. I've now discovered
why; a patch is enclosed which fixes this misbehaviour here.

In compare_tests are a number of occurrences of this construction:

... | sed 's/^....:	//' | ...
        (where this ^ is a tab character)

This is apparently designed to strip the PASS: and FAIL: information
off the start of the summary reports for each test, so that the
remainder is sorted, as comm(1) requires.

In this case it's a bit of a pity that dejagnu-980528 emits a single
space after PASS: and FAIL:, not a tab. As a result, the input to
comm(1) is not sorted, so it is quite within its rights to emit
gibberish, and I'm lucky that I merely got odd-looking results :)

(Looking at the past test reports on the list, it's obvious that
everyone else's dejagnu emits a single space, too; so how did
compare_tests ever work, for anyone? Wrong results should emerge
whenever a single testcase has some positive and then some negative
results, as recently here:

PASS: g++.brendan/parse3.C (test for excess errors)
FAIL: g++.brendan/parse3.C - (test for bogus messages, line 21)
FAIL: g++.brendan/parse3.C - (test for bogus messages, line 22)

).

A patch follows; a very simple patch :)

*** egcs/contrib/compare_tests.orig	Thu Dec  3 19:34:41 1998
--- egcs/contrib/compare_tests	Thu Dec  3 19:33:15 1998
***************
*** 31,38 ****
  sort +0.4 "$now" > "$now_s"
  sort +0.4 "$before" > "$before_s"
  
! grep '^FAIL' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^PASS' "$before_s" | sed 's/^....:	//' | comm -12 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 31,38 ----
  sort +0.4 "$now" > "$now_s"
  sort +0.4 "$before" > "$before_s"
  
! grep '^FAIL' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^PASS' "$before_s" | sed 's/^....: //' | comm -12 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
***************
*** 42,49 ****
  	echo
  fi
  
! grep '^PASS' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^FAIL' "$before_s" | sed 's/^....:	//' | comm -12 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 42,49 ----
  	echo
  fi
  
! grep '^PASS' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^FAIL' "$before_s" | sed 's/^....: //' | comm -12 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
***************
*** 53,60 ****
  	echo
  fi
  
! grep '^FAIL' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^....:	//' | comm -23 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 53,60 ----
  	echo
  fi
  
! grep '^FAIL' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^....: //' | comm -23 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
***************
*** 64,71 ****
  	echo
  fi
  
! grep '^PASS' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^....:	//' | comm -23 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 64,71 ----
  	echo
  fi
  
! grep '^PASS' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^....: //' | comm -23 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
***************
*** 75,82 ****
  	echo
  fi
  
! grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^PASS' "$before_s" | sed 's/^....:	//' | comm -13 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 75,82 ----
  	echo
  fi
  
! grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^PASS' "$before_s" | sed 's/^....: //' | comm -13 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
***************
*** 86,93 ****
  	echo
  fi
  
! grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^....:	//' >$tmp1
! grep '^FAIL' "$before_s" | sed 's/^....:	//' | comm -13 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then
--- 86,93 ----
  	echo
  fi
  
! grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^....: //' >$tmp1
! grep '^FAIL' "$before_s" | sed 's/^....: //' | comm -13 $tmp1 - >$tmp2
  
  grep -s . $tmp2 >/dev/null
  if [ $? = 0 ]; then


-- 
`Anyone who says you can have a lot of widely dispersed people hack
 away on a complicated piece of code and avoid total anarchy has never
 managed a software project.' - Andy Tanenbaum in 1992 on comp.os.minix


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