summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@seketeli.org>2013-06-28 09:48:55 +0200
committerDodji Seketeli <dodji@seketeli.org>2013-06-28 15:04:39 +0200
commit86d9bcbe842c297a3f89dfc7e68cf676cc3f0cca (patch)
tree049a24e0caf70856aefca72b5249234d9bd4f238
parent0316671b6643924410bd00e2aee6ae6c6725a0ac (diff)
downloadgcc-86d9bcbe842c297a3f89dfc7e68cf676cc3f0cca.tar.gz
Initial regression testing support
gcc/testsuite/ * lib/abi-dump-dg.exp: New file * g++.dg/abi-dump/abi-dump.exp: Likewise. * g++.dg/abi-dump/simple-class-0.C: Likewise. * g++.dg/abi-dump/simple-class-0.C.bi: Likewise.
-rw-r--r--gcc/testsuite/g++.dg/abi-dump/abi-dump.exp27
-rw-r--r--gcc/testsuite/g++.dg/abi-dump/simple-class-0.C29
-rw-r--r--gcc/testsuite/g++.dg/abi-dump/simple-class-0.C.bi44
-rw-r--r--gcc/testsuite/lib/abi-dump-dg.exp66
4 files changed, 166 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi-dump/abi-dump.exp b/gcc/testsuite/g++.dg/abi-dump/abi-dump.exp
new file mode 100644
index 00000000000..e7e1413835c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi-dump/abi-dump.exp
@@ -0,0 +1,27 @@
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib g++-dg.exp
+load_lib abi-dump-dg.exp
+
+dg-init
+
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] ""
+
+dg-finish
diff --git a/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C b/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C
new file mode 100644
index 00000000000..bfe7fd7f450
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C
@@ -0,0 +1,29 @@
+// { dg-do compile { target { x86_64*-*-* } } }
+// { dg-options "-fdump-abi=2" }
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+
+struct S
+{
+ int m;
+
+ S();
+ S(const S&);
+};
+
+S::S()
+{
+ m = 0;
+}
+
+S::S(const S&o)
+{
+ m = o.m;
+}
+
+void
+foo(S& a)
+{
+ S s = a;
+}
+
+// { dg-final { compare-abi-dump-with "simple-class-0.C.bi" } }
diff --git a/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C.bi b/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C.bi
new file mode 100644
index 00000000000..5733ab30af4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi-dump/simple-class-0.C.bi
@@ -0,0 +1,44 @@
+<abi-instr version='1.0'>
+ <type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
+ <class-decl name='S' visibility='default' is-declaration-only='yes' id='type-id-2'/>
+ <pointer-type-def type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-3'/>
+ <type-decl name='void' alignment-in-bits='8' id='type-id-4'/>
+ <qualified-type-def type-id='type-id-2' const='yes' filepath='simple-class-0.C' line='5' column='8' id='type-id-5'/>
+ <reference-type-def kind='lvalue' type-id='type-id-5' size-in-bits='64' alignment-in-bits='64' id='type-id-6'/>
+ <class-decl name='S' size-in-bits='32' alignment-in-bits='32' visibility='default' filepath='simple-class-0.C' line='5' column='8' def-of-decl-id='type-id-2' id='type-id-7'>
+ <data-member access='public' layout-offset-in-bits='0'>
+ <var-decl name='m' type-id='type-id-1' visibility='default' filepath='simple-class-0.C' line='7' column='7'/>
+ </data-member>
+ <member-function access='public'>
+ <function-decl name='__base_ctor ' mangled-name='_ZN1SC2Ev' filepath='simple-class-0.C' line='13' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
+ <parameter type-id='type-id-3'/>
+ <return type-id='type-id-4'/>
+ </function-decl>
+ </member-function>
+ <member-function access='public'>
+ <function-decl name='__comp_ctor ' mangled-name='_ZN1SC1Ev' filepath='simple-class-0.C' line='13' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
+ <parameter type-id='type-id-3'/>
+ <return type-id='type-id-4'/>
+ </function-decl>
+ </member-function>
+ <member-function access='public'>
+ <function-decl name='__base_ctor ' mangled-name='_ZN1SC2ERKS_' filepath='simple-class-0.C' line='18' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
+ <parameter type-id='type-id-3'/>
+ <parameter type-id='type-id-6'/>
+ <return type-id='type-id-4'/>
+ </function-decl>
+ </member-function>
+ <member-function access='public'>
+ <function-decl name='__comp_ctor ' mangled-name='_ZN1SC1ERKS_' filepath='simple-class-0.C' line='18' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
+ <parameter type-id='type-id-3'/>
+ <parameter type-id='type-id-6'/>
+ <return type-id='type-id-4'/>
+ </function-decl>
+ </member-function>
+ </class-decl>
+ <reference-type-def kind='lvalue' type-id='type-id-7' size-in-bits='64' alignment-in-bits='64' id='type-id-8'/>
+ <function-decl name='foo' mangled-name='_Z3fooR1S' filepath='simple-class-0.C' line='24' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
+ <parameter type-id='type-id-8'/>
+ <return type-id='type-id-4'/>
+ </function-decl>
+</abi-instr>
diff --git a/gcc/testsuite/lib/abi-dump-dg.exp b/gcc/testsuite/lib/abi-dump-dg.exp
new file mode 100644
index 00000000000..e8b4da03c28
--- /dev/null
+++ b/gcc/testsuite/lib/abi-dump-dg.exp
@@ -0,0 +1,66 @@
+# Copyright (C) 2000-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Various utilities for comparing abi dump output, used by gcc-dg.exp and
+# g++-dg.exp.
+
+load_lib scandump.exp
+
+# Utility for comparing the abi dump of the current test against a
+# reference file
+proc compare-abi-dump-with { args } {
+ global srcdir subdir
+
+ set num_args_min 1
+ set num_args_max 1
+
+ if { [llength $args] < $num_args_min } {
+ error "compare-abi-dump-with: too few arguments"
+ return
+ }
+ if { [llength $args] > $num_args_max } {
+ error "compare-abi-dump-with: too many arguments"
+ }
+
+ set tnfs [testname-for-summary]
+ set reference_dump [lindex $args 0]
+ # prepend $srcdir/$subdir to tot he reference_dump
+ if ![string match "*/*" reference_dump] {
+ set reference_dump $srcdir/$subdir/$reference_dump
+ }
+ set reference_dump "[glob -nocomplain $reference_dump]"
+ if { $reference_dump == "" } {
+ verbose -log "$reference_dump: reference dump file does not exist"
+ fail "reference dump presence test"
+ }
+ verbose -log "using reference dump: $reference_dump"
+
+ set abi_dump [file tail [lindex $tnfs 0]]
+ set abi_dump "[glob -nocomplain $abi_dump.bi]"
+ if { $abi_dump == "" } {
+ verbose -log "$abi_dump: abi dump file does not exist"
+ fail "$abi_dump presence test"
+ }
+ verbose -log "using abi dump: $abi_dump"
+
+ set result [catch { exec -ignorestderr diff -u $reference_dump $abi_dump 2>@1} diff_output]
+ if { $result == 0 } {
+ pass "$reference_dump, $abi_dump comparison"
+ } else {
+ fail "$reference_dump, $abi_dump comparison"
+ verbose -log "Difference is $diff_output"
+ }
+}