Patch for libstdc++ locale testing

Joseph S. Myers joseph@codesourcery.com
Wed Mar 22 20:57:00 GMT 2006


This patch fixes bugs 20448 (libstdc++ locale tests fail with
--disable-nls) and 20451 (libstdc++ locale tests fail with multilib
build-tree testing), by always having the test harness build the .mo
files rather than relying on the Makefiles to do so.

Because of how these files are searched for, it's necessary to create
an appropriately named directory (on the target board) to contain the
files.  Because DejaGnu doesn't have a standard method for doing so on
a remote system, running "mkdir -p" is the best I have available for
remote testing; I don't know if there's a better solution.  If the
board cannot support downloading these files to named directories, the
tests would fail in any case.  I believe that in the problem cases
with the current patch (dg-require-namedlocale passes, and the target
is remote, and the target supports the required directory names, and
the target doesn't support running mkdir -p) the tests would fail
without the patch for lack of copying .mo files to the target board.

Tested x86_64-unknown-linux-gnu, both --enable-nls and --disable-nls;
the tests in question now pass, whereas before they didn't except for
--enable-nls 64-bit multilib.  OK to commit?

2006-03-22  Mark Mitchell  <mark@codesourcery.com>
            Joseph S. Myers  <joseph@codesourcery.com>

	PR libstdc++/20448
	PR libstdc++/20451
	* scripts/testsuite_flags.in (--cxxflags): Don't define LOCALEDIR.
	* testsuite/lib/libstdc++.exp (libstdc++_init): Always define
	LOCALEDIR to ".".
	(v3-build_support): Build MO files.

diff -rupN GCC.orig/libstdc++-v3/scripts/testsuite_flags.in GCC/libstdc++-v3/scripts/testsuite_flags.in
--- GCC.orig/libstdc++-v3/scripts/testsuite_flags.in	2006-01-14 21:47:09.000000000 +0000
+++ GCC/libstdc++-v3/scripts/testsuite_flags.in	2006-03-22 12:03:32.000000000 +0000
@@ -50,7 +50,7 @@ case ${query} in
     --cxxflags)
       CXXFLAGS_save="-g -O2 -D_GLIBCXX_ASSERT"
       CXXFLAGS_config='@SECTION_FLAGS@ -fmessage-length=0 
- 		      @EXTRA_CXX_FLAGS@ -DLOCALEDIR="@glibcxx_localedir@" '
+ 		      @EXTRA_CXX_FLAGS@ '
       echo ${CXXFLAGS_save} ${CXXFLAGS_config}
       ;;
     --cxxpchflags)
diff -rupN GCC.orig/libstdc++-v3/testsuite/lib/libstdc++.exp GCC/libstdc++-v3/testsuite/lib/libstdc++.exp
--- GCC.orig/libstdc++-v3/testsuite/lib/libstdc++.exp	2006-01-14 21:47:09.000000000 +0000
+++ GCC/libstdc++-v3/testsuite/lib/libstdc++.exp	2006-03-22 17:59:43.000000000 +0000
@@ -193,17 +193,12 @@ proc libstdc++_init { testfile } {
             set includes "-I${srcdir}"
             set cxxldflags ""
             set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" 
-	    # Guess at the location of the installed locale files.
-	    # (It would be nice if "gcc --print-file-name" could find
-	    # message files, but it cannot.)
-	    set absolute_cxx [which $cxx]
-	    if { $absolute_cxx != "" } {
-		set localedir "[file dirname $absolute_cxx]/../share/locale"
-	    }
-	    set cxxflags "$cxxflags -DLOCALEDIR=\"$localedir\""
         }
     }
 
+    # Always use MO files built by this test harness.
+    set cxxflags "$cxxflags -DLOCALEDIR=\".\""
+
     # If a PCH file is available, use it.  We must delay performing
     # this check until $cxx and such have been initialized because we
     # perform a test compilation.  (Ideally, gcc --print-file-name would
@@ -395,6 +390,20 @@ proc v3-build_support { } {
 	set v3-threads 1
     }
 
+    # Try to build the MO files that are used by some of the locale
+    # tests.  If we can't build them, that's OK; it just means that
+    # those tests will fail.
+    foreach lang [list "fr" "de"] {
+	catch {
+	    file mkdir "$lang/LC_MESSAGES"
+	    remote_exec "build" "msgfmt" "-o $lang/LC_MESSAGES/libstdc++.mo $srcdir/../po/$lang.po"
+	    if [is_remote host] {
+		remote_exec "host" "mkdir" "-p $lang/LC_MESSAGES"
+		remote_download "host" "$lang/LC_MESSAGES/libstdc++.mo" "$lang/LC_MESSAGES/libstdc++.mo"
+	    }
+	}
+    }
+
     # Build the support objects.
     set source_files \
 	[list testsuite_abi.cc testsuite_allocator.cc testsuite_character.cc testsuite_hooks.cc ]

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc-patches mailing list