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]

[PATCH] Run guality.exp tests only if a simple guality test works


Hi!

I've already posted this yesterday, but hidden in a large thread about VTA.
This patch should avoid guality testing if either popen etc. aren't
available, or gdb doesn't exist for the target, or the GDB* env vars. are
wrong, or gdb isn't able to print even a volatile global var.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2009-09-03  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/guality/guality.exp: Only run guality tests if a trivial
	testcase using guality.h compiles and links and if a global variable
	can be verified by gdb.

--- gcc/testsuite/gcc.dg/guality/guality.exp.jj	2009-09-02 08:29:54.000000000 +0200
+++ gcc/testsuite/gcc.dg/guality/guality.exp	2009-09-02 19:37:49.000000000 +0200
@@ -2,6 +2,30 @@
 
 load_lib gcc-dg.exp
 
+proc check_guality {args} {
+    set result [eval check_compile guality_check executable $args "-g -O0"]
+    set lines [lindex $result 0]
+    set output [lindex $result 1]
+    set ret 0
+    if {[string match "" $lines]} {
+      set execout [gcc_load "./$output"]
+      set ret [string match "*1 PASS, 0 FAIL, 0 UNRESOLVED*" $execout]
+    }
+    remote_file build delete $output
+    return $ret
+}
+
 dg-init
-gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] ""
+
+if {[check_guality "
+  #include \"$srcdir/$subdir/guality.h\"
+  volatile long int varl = 6;
+  int main (int argc, char *argv\[\])
+  {
+    GUALCHKVAL (varl);
+    return 0;
+  }
+"]} {
+  gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] ""
+}
 dg-finish

	Jakub


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