[patch] Enable plugin tests only when the build and the host systems are the same

Le-Chun Wu lcwu@google.com
Wed May 6 23:05:00 GMT 2009


In the plugin test cases, the plugins are compiled with the host
compiler (HOSTCC). However, HOSTCC set in site.exp appears to actually
be the build->host compiler, so using the host compiler will guarantee
to work only when the build and the host system are the same. In this
patch, we check and enable the plugin tests only when the build and
host systems are the same. The patch was bootstrapped and tested on
x86_64-linux-gnu. OK for mainline?

Thanks,

Le-chun


2009-05-06  Le-Chun Wu  <lcwu@google.com>

        * gcc/testsuite/gcc.dg/plugin/plugin.exp: Enable plugin tests only
        when the build and the host systems are the same.
        * gcc/testsuite/g++.dg/plugin/plugin.exp: Likewise.


Index: gcc/testsuite/gcc.dg/plugin/plugin.exp
===================================================================
--- gcc/testsuite/gcc.dg/plugin/plugin.exp      (revision 147209)
+++ gcc/testsuite/gcc.dg/plugin/plugin.exp      (working copy)
@@ -21,10 +21,17 @@ load_lib gcc-dg.exp

 global TESTING_IN_BUILD_TREE
 global ENABLE_PLUGIN
+global host_triplet, build_triplet

-# The plugin testcases currently only work when the build tree is available.
-# Also check whether the host supports plugins.
-if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
+# The plugin testcases currently only work when
+#   1. the build tree is available,
+#   2. the host supports plugins,
+#   3. the build system and the host system are the same (because we use
+#      HOSTCC to build plugins in the tests while gcc was built with the build
+#      CC).
+if { ![info exists TESTING_IN_BUILD_TREE]
+     || ![info exists ENABLE_PLUGIN]
+     || "$host_triplet" != "$build_triplet" } {
     return
 }

Index: gcc/testsuite/g++.dg/plugin/plugin.exp
===================================================================
--- gcc/testsuite/g++.dg/plugin/plugin.exp      (revision 147209)
+++ gcc/testsuite/g++.dg/plugin/plugin.exp      (working copy)
@@ -21,10 +21,17 @@ load_lib g++-dg.exp

 global TESTING_IN_BUILD_TREE
 global ENABLE_PLUGIN
+global host_triplet, build_triplet

-# The plugin testcases currently only work when the build tree is available.
-# Also check whether the host supports plugins.
-if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
+# The plugin testcases currently only work when
+#   1. the build tree is available,
+#   2. the host supports plugins,
+#   3. the build system and the host system are the same (because we use
+#      HOSTCC to build plugins in the tests while gcc was built with the build
+#      CC).
+if { ![info exists TESTING_IN_BUILD_TREE]
+     || ![info exists ENABLE_PLUGIN]
+     || "$host_triplet" != "$build_triplet" } {
     return
 }



More information about the Gcc-patches mailing list