[committed] libstdc++: Fix failing filesystem::path tests (PR 93244)

Message ID 20200306113530.GA3207235@redhat.com
State New
Headers show
Series
  • [committed] libstdc++: Fix failing filesystem::path tests (PR 93244)
Related show

Commit Message

Jonathan Wakely March 6, 2020, 11:35 a.m.
The checks for PR 93244 don't actually pass on Windows (which is the
target where the bug is present) because of a different bug, PR 94063.

This adjusts the tests to not be affected by 94063 so that they verify
that 93244 was fixed.

	PR libstdc++/93244
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust
	test to not fail due to PR 94063.
	* testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.

Tested x86_64-w64-mingw, committed to master.
commit 180eeeaeb200a07f7f24e1f203cd026880ff861c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Mar 6 11:27:34 2020 +0000

    libstdc++: Fix failing filesystem::path tests (PR 93244)
    
    The checks for PR 93244 don't actually pass on Windows (which is the
    target where the bug is present) because of a different bug, PR 94063.
    
    This adjusts the tests to not be affected by 94063 so that they verify
    that 93244 was fixed.
    
            PR libstdc++/93244
            * testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust
            test to not fail due to PR 94063.
            * testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
            * testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.

Patch

diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
index 677f5f5d1c4..5caf079ed9b 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
@@ -49,11 +49,12 @@  test01()
 void
 test02()
 {
-  // PR libstdc++/93244
-  path p("C:");
-  p += path::preferred_separator;
-  p += "foo/bar";
-  VERIFY( p.generic_string() == "C:/foo/bar" );
+  if constexpr (path::preferred_separator == L'\\')
+  {
+    // PR libstdc++/93244
+    VERIFY( path("C:\\foo\\bar").generic_string() == "C:/foo/bar" );
+    VERIFY( path("C://foo//bar").generic_string() == "C:/foo/bar" );
+  }
 }
 
 int
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/utf.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/utf.cc
index 9a2f579ebab..52afdb4497b 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/utf.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/utf.cc
@@ -49,11 +49,12 @@  test01()
 void
 test02()
 {
-  // PR libstdc++/93244
-  path p("C:");
-  p += path::preferred_separator;
-  p += "foo/bar";
-  VERIFY( p.generic_u32string() == U"C:/foo/bar" );
+  if constexpr (path::preferred_separator == L'\\')
+  {
+    // PR libstdc++/93244
+    VERIFY( path("C:\\foo\\bar").generic_u32string() == U"C:/foo/bar" );
+    VERIFY( path("C://foo//bar").generic_u32string() == U"C:/foo/bar" );
+  }
 }
 
 int
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/wchar_t.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/wchar_t.cc
index 5dacedc7de4..7bb2f643043 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/wchar_t.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/wchar_t.cc
@@ -49,11 +49,12 @@  test01()
 void
 test02()
 {
-  // PR libstdc++/93244
-  path p("C:");
-  p += path::preferred_separator;
-  p += "foo/bar";
-  VERIFY( p.generic_wstring() == L"C:/foo/bar" );
+  if constexpr (path::preferred_separator == L'\\')
+  {
+    // PR libstdc++/93244
+    VERIFY( path("C:\\foo\\bar").generic_wstring() == L"C:/foo/bar" );
+    VERIFY( path("C://foo//bar").generic_wstring() == L"C:/foo/bar" );
+  }
 }
 
 int