[libcxx-commits] [PATCH] D110936: [libcxx][pretty printers] Report not being able to trace test program

David Spickett via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 7 03:02:52 PDT 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG88f08899da96: [libcxx][pretty printers] Report not being able to trace test program (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110936/new/

https://reviews.llvm.org/D110936

Files:
  libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py


Index: libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
===================================================================
--- libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
+++ libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
@@ -20,6 +20,14 @@
 import sys
 
 test_failures = 0
+# Sometimes the inital run command can fail to trace the process.
+# (e.g. you don't have ptrace permissions)
+# In these cases gdb still sends us an exited event so we cannot
+# see what "run" printed to check for a warning message, since
+# we get taken to our exit handler before we can look.
+# Instead check that at least one test has been run by the time
+# we exit.
+has_run_tests = False
 
 
 class CheckResult(gdb.Command):
@@ -30,6 +38,8 @@
 
     def invoke(self, arg, from_tty):
         try:
+            has_run_tests = True
+
             # Stack frame is:
             # 0. StopForDebugger
             # 1. ComparePrettyPrintToChars or ComparePrettyPrintToRegex
@@ -89,7 +99,12 @@
 
 def exit_handler(event=None):
     global test_failures
-    if test_failures:
+    global has_run_tests
+
+    if not has_run_tests:
+        print("FAILED test program did not run correctly, check gdb warnings")
+        test_failures = -1
+    elif test_failures:
         print("FAILED %d cases" % test_failures)
     exit(test_failures)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110936.377788.patch
Type: text/x-patch
Size: 1331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211007/3e335bd2/attachment-0001.bin>


More information about the libcxx-commits mailing list