public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yuri Gribov <tetra2005@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>
Subject: [PATCH] Ignore random output from Asan tests in dg-cmp-results
Date: Sun, 09 Jul 2017 19:06:00 -0000	[thread overview]
Message-ID: <CAJOtW+5ixkYJzN7ieaEDfkwQex0j+k0qjhYOA_-GwPked-iY-w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

Hi,

Currently dg-cmp-results fails to compare fails in Asan tests because
their output includes failing process id:
NA->FAIL: c-c++-common/asan/bitfield-1.c   -O0  output pattern test,
is ==18161==ERROR
FAIL->NA: c-c++-common/asan/bitfield-1.c   -O0  output pattern test,
is ==26667==ERROR

This patch fixes this. I also did some fairly standard refactoring to
improve stability and get rid of code dup.

Ok for trunk?

-Y

[-- Attachment #2: dg-cmp-results-asan-fix-1.patch --]
[-- Type: application/octet-stream, Size: 2428 bytes --]

2017-07-09  Yury Gribov  <tetra2005@gmail.com>

contrib/
        * dg-cmp-results.sh: Ignore random output from Asan tests.

diff -rupN gcc/contrib/dg-cmp-results.sh gcc-compare-checks/contrib/dg-cmp-results.sh
--- gcc/contrib/dg-cmp-results.sh	2017-07-09 07:41:13.000000000 +0200
+++ gcc-compare-checks/contrib/dg-cmp-results.sh	2017-07-09 18:58:52.000000000 +0200
@@ -1,5 +1,5 @@
-#!/bin/bash
-# Copyright (C) 2006, 2008 Free Software Foundation
+#!/bin/bash -eu
+# Copyright (C) 2006, 2008, 2017 Free Software Foundation
 #
 # Analyze changes in GCC DejaGNU test logs for binutils, gcc, gdb, etc.
 # Original version written in 2005 by James Lemke <jwlemke@wasabisystems.com>.
@@ -89,25 +89,29 @@ sed $E -e '/^[[:space:]]+===/,$d' $OFILE
 echo "Newer log file: $NFILE"
 sed $E -e '/^[[:space:]]+===/,$d' $NFILE
 
-# Create a temporary file from the old file's interesting section.
-sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
-  -e '/^[A-Z]+:/!d' \
-  -e '/^(WARNING|ERROR):/d' \
-  -e 's/\r$//' \
-  -e 's/^/O:/' \
-  $OFILE |
-  sort -s -t : -k 3b - \
-  >/tmp/o$$-$OBASE
-
-# Create a temporary file from the new file's interesting section.
-sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
-  -e '/^[A-Z]+:/!d' \
-  -e '/^(WARNING|ERROR):/d' \
-  -e 's/\r$//' \
-  -e 's/^/N:/' \
-  $NFILE |
-  sort -s -t : -k 3b - \
-  >/tmp/n$$-$NBASE
+O=/tmp/o$$-$OBASE
+N=/tmp/n$$-$NBASE
+
+trap "rm -f compare-$$.awk /tmp/o$$-$OBASE /tmp/n$$-$NBASE" EXIT
+
+# Create a temporary file from file's interesting section.
+get_interesting_lines() {
+  sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
+      -e '/^[A-Z]+:/!d' \
+      -e '/^(WARNING|ERROR):/d' \
+      -e 's/\r$//' \
+      -e 's/^/'$1':/' \
+      | sort -s -t : -k 3b -
+}
+
+# Preprocess lines to avoid spurious differences
+canonize_lines() {
+  # For now just strip pid numbers from Asan messages
+  sed $E -e 's/(\/asan\/.* is ==)[0-9]+==/\1PID==/'
+}
+
+get_interesting_lines O < $OFILE | canonize_lines > $O
+get_interesting_lines N < $NFILE | canonize_lines > $N
 
 # Merge the two files, then compare adjacent lines.
 # Comparison is complicated by tests that may be run multiple times.
@@ -202,8 +206,3 @@ END {
 EOF
 sort -m -s -t : -k 3b /tmp/o$$-$OBASE /tmp/n$$-$NBASE |
  awk -v verbose=$verbose -f compare-$$.awk /dev/stdin
-
-# Delete the temporary files.
-rm -f compare-$$.awk /tmp/o$$-$OBASE /tmp/n$$-$NBASE
-
-exit 0

             reply	other threads:[~2017-07-09 19:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09 19:06 Yuri Gribov [this message]
2017-07-10  9:32 ` Thomas Preudhomme
2017-07-10  9:44   ` Yuri Gribov
2017-07-10 21:21     ` Mike Stump
2017-07-10 21:53       ` Mike Stump
2017-07-11  6:51         ` Yuri Gribov
2017-07-10 12:13 ` Thomas Preudhomme
2017-07-10 12:32   ` Yuri Gribov
2017-07-10 18:27 ` Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJOtW+5ixkYJzN7ieaEDfkwQex0j+k0qjhYOA_-GwPked-iY-w@mail.gmail.com \
    --to=tetra2005@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas.preudhomme@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).