This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Pretty printer test fixes and improvements


On 09/01/19 10:14 +0000, Jonathan Wakely wrote:
On 09/01/19 11:09 +0100, Christophe Lyon wrote:
On Wed, 9 Jan 2019 at 00:16, Jonathan Wakely <jwakely@redhat.com> wrote:

Test that StdUniquePtrPrinter correctly prints std::unique_ptr objects
using the old layout, prior to the PR libstdc++/77990 changes.

The printer test for a valueless std::variant started to fail because
the PR libstdc++/87431 fix meant it no longer became valueless. Change
the test to use a type that is not trivially copyable, so that the
exception causes it to become valueless.

       * testsuite/libstdc++-prettyprinters/compat.cc: Test printer support
       for old std::unique_ptr layout.
       * testsuite/libstdc++-prettyprinters/cxx17.cc: Fix std::variant test
       to become valueless. Add filesystem::path tests.

Tested x86_64-linux, committed to trunk.


Hi Jonathan,

After this patch, I've noticed a new failure on aarch64:
FAIL: libstdc++-prettyprinters/cxx17.cc print p2

The log contains:
PASS: libstdc++-prettyprinters/cxx17.cc print p1
$27 = filesystem::path "/dir/." = {[root-directory] = "/", [1] =
"dir", [2] = "."}
got: $27 = filesystem::path "/dir/." = {[root-directory] = "/", [1] =
"dir", [2] = "."}
FAIL: libstdc++-prettyprinters/cxx17.cc print p2

Hmm, that's the expected output. I wonder why it fails.

Oh, it's not the expected output at all. I'm being dumb.

I am seeing that failure too, but didn't notice it along with all the
existing ones caused by PR 88170 (which was also the problem with the
std::variant failure fixed in r267743).

The attached patch fixes it, committed to trunk.



commit 622a802a907585da9a9266a8d4eb3401cc24f9fe
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jan 9 10:45:00 2019 +0000

    Fix failing prettyprinter test
    
    The failure for "p2" went unnoticed due to the pre-existing failures for
    variables with similar names, like "p" and "q". This fixes the failure,
    and gives the filesystem::path variables better names.
    
            * testsuite/libstdc++-prettyprinters/cxx17.cc: Fix expected output
            for filesystem::path. Give variables more distinctive names.

diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc
index c550cbd61bd..4ed4d47240f 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc
@@ -124,12 +124,12 @@ main()
 // { dg-final { regexp-test q {std::shared_ptr.int \[2\]. \(use count 2, weak count 1\) = {get\(\) = 0x.*}} } }
 // { dg-final { regexp-test wq {std::weak_ptr.int \[2\]. \(use count 2, weak count 1\) = {get\(\) = 0x.*}} } }
 
-  std::filesystem::path p0;
-// { dg-final { note-test p0 {filesystem::path ""} } }
-  std::filesystem::path p1("filename");
-// { dg-final { note-test p1 {filesystem::path "filename"} } }
-  std::filesystem::path p2("/dir/.");
-// { dg-final { note-test p2 {filesystem::path "/dir/file" = {[root-directory] = "/", [1] = "dir", [2] = "."}} } }
+  std::filesystem::path path0;
+// { dg-final { note-test path0 {filesystem::path ""} } }
+  std::filesystem::path path1("filename");
+// { dg-final { note-test path1 {filesystem::path "filename"} } }
+  std::filesystem::path path2("/dir/.");
+// { dg-final { note-test path2 {filesystem::path "/dir/." = {[root-directory] = "/", [1] = "dir", [2] = "."}} } }
 
   std::cout << "\n";
   return 0;			// Mark SPOT

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]