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