[libcxx-commits] [libcxx] 17608d3 - [libcxx][pretty printers] Correct locale for u16/u32 string tests

David Spickett via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 7 01:26:31 PDT 2021


Author: David Spickett
Date: 2021-10-07T09:26:26+01:00
New Revision: 17608d345f69af8e2c7aefcf7952aba2ffc38c0e

URL: https://github.com/llvm/llvm-project/commit/17608d345f69af8e2c7aefcf7952aba2ffc38c0e
DIFF: https://github.com/llvm/llvm-project/commit/17608d345f69af8e2c7aefcf7952aba2ffc38c0e.diff

LOG: [libcxx][pretty printers] Correct locale for u16/u32 string tests

When the locale is not some UTF-8 these tests fail.
(different results for python2 linked gdbs vs. python3
but same issue)

Setting the locale just for the test works around this.
By default Ubuntu comes with just C.UTF-8. I've chosen
to use en_US.UTF-8 instead given that my Mac doesn't have
the former and there's a slim chance this test might run there.

This also enables the u16string tests which are now passing.

Reviewed By: #libc, ldionne, saugustine

Differential Revision: https://reviews.llvm.org/D111138

Added: 
    

Modified: 
    libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
index 3a7af1d90c663..39c218e81e026 100644
--- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
+++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
@@ -7,12 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: host-has-gdb-with-python
+// REQUIRES: locale.en_US.UTF-8
 // UNSUPPORTED: libcpp-has-no-localization
 // UNSUPPORTED: c++03
 
 // RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} -g %{link_flags}
 // Ensure locale-independence for unicode tests.
-// RUN: %{gdb} -nx -batch -iex "set autoload off" -ex "source %S/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %S/gdb_pretty_printer_test.py" %t.exe
+// RUN: env LANG=en_US.UTF-8 %{gdb} -nx -batch -iex "set autoload off" -ex "source %S/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %S/gdb_pretty_printer_test.py" %t.exe
 
 #include <bitset>
 #include <deque>
@@ -658,6 +659,7 @@ int main(int, char**) {
   string_test();
   a_namespace::string_view_test();
 
+  u16string_test();
   u32string_test();
   tuple_test();
   unique_ptr_test();


        


More information about the libcxx-commits mailing list