From 52f2a1c70aef92ce6ecc5a04408032f26f4c7b4d Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 24 May 2019 09:04:51 -0700 Subject: [PATCH 1/3] bpo-37023: Fix test_gdb under PGO --- Lib/test/test_gdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 4d1ce4ed96c06d2..cd9b0fc2b76959a 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -272,7 +272,7 @@ def get_gdb_repr(self, source, # gdb can insert additional '\n' and space characters in various places # in its output, depending on the width of the terminal it's connected # to (using its "wrap_here" function) - m = re.match(r'.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*', + m = re.match(r'.*#0\s+builtin_id\s+\((self\=.*,\s+v=\s*(.*?))?\)\s+at\s+\S*Python/bltinmodule.c.*', gdb_output, re.DOTALL) if not m: self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output)) From df70cb0842115d5c3db1f53336dfd2b87a7b1e31 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 24 May 2019 10:50:32 -0700 Subject: [PATCH 2/3] Skip test rather than trying to fix the regex --- Lib/test/test_gdb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index cd9b0fc2b76959a..7f39299074c3f64 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -52,6 +52,10 @@ def get_gdb_version(): raise unittest.SkipTest("test_gdb doesn't work correctly when python is" " built with LLVM clang") +if ((sysconfig.get_config_var('PGO_PROF_USE_FLAG') or 'xxx') in + sysconfig.get_config_var('PY_CORE_CFLAGS') or ''): + raise unittest.SkipTest("test_gdb is not reliable on PGO builds") + # Location of custom hooks file in a repository checkout. checkout_hook_path = os.path.join(os.path.dirname(sys.executable), 'python-gdb.py') @@ -272,7 +276,7 @@ def get_gdb_repr(self, source, # gdb can insert additional '\n' and space characters in various places # in its output, depending on the width of the terminal it's connected # to (using its "wrap_here" function) - m = re.match(r'.*#0\s+builtin_id\s+\((self\=.*,\s+v=\s*(.*?))?\)\s+at\s+\S*Python/bltinmodule.c.*', + m = re.match(r'.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)?\)\s+at\s+\S*Python/bltinmodule.c.*', gdb_output, re.DOTALL) if not m: self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output)) From 166915382d5fc77a9779f147751fb491c2fa8607 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 24 May 2019 11:15:33 -0700 Subject: [PATCH 3/3] Add parens to keep Windows happy --- Lib/test/test_gdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 7f39299074c3f64..dbcb5983e9ba1d7 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -53,7 +53,7 @@ def get_gdb_version(): " built with LLVM clang") if ((sysconfig.get_config_var('PGO_PROF_USE_FLAG') or 'xxx') in - sysconfig.get_config_var('PY_CORE_CFLAGS') or ''): + (sysconfig.get_config_var('PY_CORE_CFLAGS') or '')): raise unittest.SkipTest("test_gdb is not reliable on PGO builds") # Location of custom hooks file in a repository checkout.