|
|
a46658 |
From b6989e3a4acda2d75612f3f3847dbea4245ff536 Mon Sep 17 00:00:00 2001
|
|
|
a46658 |
From: David Malcolm <dmalcolm@redhat.com>
|
|
|
a46658 |
Date: Wed, 1 Sep 2021 15:39:45 -0400
|
|
|
a46658 |
Subject: [PATCH 11/17] Add dts.exp and use it to fix
|
|
|
a46658 |
22_locale/messages/13631.cc
|
|
|
a46658 |
|
|
|
a46658 |
This test was added upstream 2014-12-03:
|
|
|
a46658 |
"re PR libstdc++/13631 (Problems in messages)"
|
|
|
a46658 |
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d31008d7a0d53b431f176aad8dda5498de823122
|
|
|
a46658 |
|
|
|
a46658 |
as part of a fix that is present in the system libstdc++.so in
|
|
|
a46658 |
GCC 5 onwards.
|
|
|
a46658 |
|
|
|
a46658 |
When run in DTS against such a system library, this test will fail.
|
|
|
a46658 |
This patch introduces a dts.exp which detects the version of the
|
|
|
a46658 |
underlying system libstdc++.so and exposes it to tests via
|
|
|
a46658 |
-D__CXXSTDLIB_SO_VERSION__=, so that we can ifdef specific tests
|
|
|
a46658 |
away, conditionally on the base GCC.
|
|
|
a46658 |
---
|
|
|
a46658 |
.../testsuite/22_locale/messages/13631.cc | 7 +++++
|
|
|
a46658 |
libstdc++-v3/testsuite/lib/dts.exp | 31 +++++++++++++++++++
|
|
|
a46658 |
libstdc++-v3/testsuite/lib/libstdc++.exp | 6 ++++
|
|
|
a46658 |
3 files changed, 44 insertions(+)
|
|
|
a46658 |
create mode 100644 libstdc++-v3/testsuite/lib/dts.exp
|
|
|
a46658 |
|
|
|
a46658 |
diff --git a/libstdc++-v3/testsuite/22_locale/messages/13631.cc b/libstdc++-v3/testsuite/22_locale/messages/13631.cc
|
|
|
a46658 |
index b8ae3d4f1..5b20df382 100644
|
|
|
a46658 |
--- a/libstdc++-v3/testsuite/22_locale/messages/13631.cc
|
|
|
a46658 |
+++ b/libstdc++-v3/testsuite/22_locale/messages/13631.cc
|
|
|
a46658 |
@@ -50,7 +50,10 @@ void test01()
|
|
|
a46658 |
msgs_facet.close(fake_msgs);
|
|
|
a46658 |
msgs_facet.close(msgs);
|
|
|
a46658 |
|
|
|
a46658 |
+ // Fixed upstream in GCC 5
|
|
|
a46658 |
+#if __CXXSTDLIB_SO_VERSION__ >= 501000
|
|
|
a46658 |
VERIFY( translation1 == translation2 );
|
|
|
a46658 |
+#endif
|
|
|
a46658 |
}
|
|
|
a46658 |
|
|
|
a46658 |
void test02()
|
|
|
a46658 |
@@ -72,8 +75,12 @@ void test02()
|
|
|
a46658 |
std::wstring translation1 = msgs_facet.get(msgs, 0, 0, msgid);
|
|
|
a46658 |
|
|
|
a46658 |
// Without a real translation this test doesn't mean anything:
|
|
|
a46658 |
+
|
|
|
a46658 |
+ // Fixed upstream in GCC 5
|
|
|
a46658 |
+#if __CXXSTDLIB_SO_VERSION__ >= 501000
|
|
|
a46658 |
VERIFY( !translation1.empty() );
|
|
|
a46658 |
VERIFY( translation1 != msgid );
|
|
|
a46658 |
+#endif
|
|
|
a46658 |
|
|
|
a46658 |
// Opening another catalog was enough to show the problem, even a fake
|
|
|
a46658 |
// catalog.
|
|
|
a46658 |
diff --git a/libstdc++-v3/testsuite/lib/dts.exp b/libstdc++-v3/testsuite/lib/dts.exp
|
|
|
a46658 |
new file mode 100644
|
|
|
a46658 |
index 000000000..76ece66d3
|
|
|
a46658 |
--- /dev/null
|
|
|
a46658 |
+++ b/libstdc++-v3/testsuite/lib/dts.exp
|
|
|
a46658 |
@@ -0,0 +1,31 @@
|
|
|
a46658 |
+# For DTS testing, generate a number expressing the
|
|
|
a46658 |
+# system version of libstdc++.so
|
|
|
a46658 |
+#
|
|
|
a46658 |
+# Generate a version number equivalent to
|
|
|
a46658 |
+# #define GCC_VERSION (__GNUC__ * 10000 \
|
|
|
a46658 |
+# + __GNUC_MINOR__ * 100 \
|
|
|
a46658 |
+# + __GNUC_PATCHLEVEL__)
|
|
|
a46658 |
+#
|
|
|
a46658 |
+# For example, given an underlying version of gcc 4.8.5
|
|
|
a46658 |
+# this function will return 408050.
|
|
|
a46658 |
+
|
|
|
a46658 |
+proc get_dts_base_version { } {
|
|
|
a46658 |
+
|
|
|
a46658 |
+ # Invoke gcc in the PATH to get at the underlying GCC version
|
|
|
a46658 |
+ # in dotted form (e.g. "4.8.5").
|
|
|
a46658 |
+ set dotted_version [exec gcc -dumpversion]
|
|
|
a46658 |
+ verbose "dotted_version: '$dotted_version'" 2
|
|
|
a46658 |
+
|
|
|
a46658 |
+ # Extract major, minor, patchlevel
|
|
|
a46658 |
+ regexp {([0-9]+)\.([0-9]+)\.([0-9]+)} \
|
|
|
a46658 |
+ $dotted_version \
|
|
|
a46658 |
+ _ major minor patchlevel
|
|
|
a46658 |
+ verbose "major: '$major'" 2
|
|
|
a46658 |
+ verbose "minor: '$minor'" 2
|
|
|
a46658 |
+ verbose "patchlevel: '$patchlevel'" 2
|
|
|
a46658 |
+
|
|
|
a46658 |
+ set base_gcc_version [expr (($major * 10000) + ($minor * 100) + $patchlevel)]
|
|
|
a46658 |
+ verbose "base_gcc_version: '$base_gcc_version'" 2
|
|
|
a46658 |
+
|
|
|
a46658 |
+ return $base_gcc_version
|
|
|
a46658 |
+}
|
|
|
a46658 |
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
|
|
|
a46658 |
index 7f9580db8..5e4b32f76 100644
|
|
|
a46658 |
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
|
|
|
a46658 |
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
|
|
|
a46658 |
@@ -58,6 +58,7 @@ load_gcc_lib timeout.exp
|
|
|
a46658 |
load_gcc_lib timeout-dg.exp
|
|
|
a46658 |
load_gcc_lib wrapper.exp
|
|
|
a46658 |
load_gcc_lib target-utils.exp
|
|
|
a46658 |
+load_lib dts.exp
|
|
|
a46658 |
|
|
|
a46658 |
# Useful for debugging. Pass the name of a variable and the verbosity
|
|
|
a46658 |
# threshold (number of -v's on the command line).
|
|
|
a46658 |
@@ -323,6 +324,11 @@ proc libstdc++_init { testfile } {
|
|
|
a46658 |
set ccflags "$cxxflags -DLOCALEDIR=\".\""
|
|
|
a46658 |
set cxxflags "$cxxflags -DLOCALEDIR=\".\""
|
|
|
a46658 |
|
|
|
a46658 |
+ # For DTS testing, expose the system version of libstdc++.so as
|
|
|
a46658 |
+ # a preprocessor define.
|
|
|
a46658 |
+ set base_gcc_version [get_dts_base_version]
|
|
|
a46658 |
+ set cxxflags "$cxxflags -D__CXXSTDLIB_SO_VERSION__=$base_gcc_version"
|
|
|
a46658 |
+
|
|
|
a46658 |
# If a PCH file is available, use it. We must delay performing
|
|
|
a46658 |
# this check until $cxx and such have been initialized because we
|
|
|
a46658 |
# perform a test compilation. (Ideally, gcc --print-file-name would
|
|
|
a46658 |
--
|
|
|
a46658 |
2.31.1
|
|
|
a46658 |
|