Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: net/data/parse_certificate_unittest/rebase-errors.py

Issue 2918913002: Add path validation error expectations for PKITS tests. (Closed)
Patch Set: Address Matt's comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/data/parse_certificate_unittest/rebase-errors.py
diff --git a/net/data/parse_certificate_unittest/rebase-errors.py b/net/data/parse_certificate_unittest/rebase-errors.py
index ebb8722e1d0cc4d5013bf1bf42c239996a421d4d..d2869bd17711e81384139c8d035c6ab22e5c594b 100755
--- a/net/data/parse_certificate_unittest/rebase-errors.py
+++ b/net/data/parse_certificate_unittest/rebase-errors.py
@@ -14,9 +14,9 @@ To use this run the affected tests, and then pass the input to this script
$ ./out/Release/net_unittests --gtest_filter="*ParseCertificate*" | \
net/data/parse_certificate_unittest/rebase-errors.py
-The script works by scanning the stdout looking for gtest failures when
-comparing "errors.ToDebugString()". The C++ test side should have been
-instrumented to dump out the test file's path on mismatch.
+The script works by scanning the stdout looking for gtest failures having a
+particular format. The C++ test side should have been instrumented to dump
+out the test file's path on mismatch.
This script will then update the corresponding .pem file
"""
@@ -32,14 +32,19 @@ import re
# Regular expression to find the failed errors in test stdout.
-# * Group 1 of the match is the actual error text (backslash-escaped)
-# * Group 2 of the match is file path (relative to //src) where the expected
-# errors were read from.
+# * Group 1 of the match is file path (relative to //src) where the
+# expected errors were read from.
+# * Group 2 of the match is the actual error text
failed_test_regex = re.compile(r"""
-Value of: errors.ToDebugString\(\)
- Actual: "(.*)"
-(?:.|\n)+?
-Test file: (.*[.]pem)
+Cert errors don't match expectations \((.+?)\)
+
+EXPECTED:
+
+(?:.|\n)*?
+ACTUAL:
+
+((?:.|\n)*?)
+===> Use net/data/parse_certificate_unittest/rebase-errors.py to rebaseline.
""", re.MULTILINE)
@@ -129,10 +134,11 @@ def main():
test_stdout = sys.stdin.read()
for m in failed_test_regex.finditer(test_stdout):
- actual_errors = m.group(1)
- actual_errors = actual_errors.decode('string-escape')
- relative_test_path = m.group(2)
- fixup_pem_file(get_abs_path(relative_test_path), actual_errors)
+ src_relative_errors_path = m.group(1)
+ errors_path = get_abs_path(src_relative_errors_path)
+ actual_errors = m.group(2)
+
+ fixup_pem_file(errors_path, actual_errors)
if __name__ == "__main__":
« no previous file with comments | « net/cert/internal/verify_certificate_chain_unittest.cc ('k') | net/data/verify_certificate_chain_unittest/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698