summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Li <alex.li@mongodb.com>2022-06-21 19:02:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-21 19:56:52 +0000
commit765e3c89b711b071d3bfa3ec9a0b5b4daf8a97c4 (patch)
tree64237887d041075ac9a20feb232d9347154be35c
parent690c79c1b26e9477ec51531198b31c50a08fa61a (diff)
downloadmongo-765e3c89b711b071d3bfa3ec9a0b5b4daf8a97c4.tar.gz
SERVER-49153 Fix the policy used by errorcodes.py
-rwxr-xr-xbuildscripts/errorcodes.py11
-rw-r--r--buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp6
-rw-r--r--buildscripts/tests/test_errorcodes.py2
3 files changed, 12 insertions, 7 deletions
diff --git a/buildscripts/errorcodes.py b/buildscripts/errorcodes.py
index 8d9330b4240..3ff08ca8a1e 100755
--- a/buildscripts/errorcodes.py
+++ b/buildscripts/errorcodes.py
@@ -23,7 +23,6 @@ except ImportError:
print("*** Run 'pip3 install --user regex' to speed up error code checking")
import re # type: ignore
-ASSERT_NAMES = ["uassert", "massert", "fassert", "fassertFailed"]
MAXIMUM_CODE = 9999999 # JIRA Ticket + XX
# pylint: disable=invalid-name
@@ -306,7 +305,7 @@ def main():
parser.add_option("--list-files", dest="list_files", action="store_true", default=False,
help="Print the name of each file as it is scanned [default: %default]")
parser.add_option(
- "--ticket", dest="ticket", type="str", action="store", default=0,
+ "--ticket", dest="ticket", type="str", action="store", default=None,
help="Generate error codes for a given SERVER ticket number. Inputs can be of"
" the form: `--ticket=12345` or `--ticket=SERVER-12345`.")
options, extra = parser.parse_args()
@@ -322,11 +321,13 @@ def main():
if ok and options.quiet:
return
- next_code_gen = get_next_code(seen, coerce_to_number(options.ticket))
-
print("ok: %s" % ok)
- if not options.replace:
+
+ if options.ticket:
+ next_code_gen = get_next_code(seen, coerce_to_number(options.ticket))
print("next: %s" % next(next_code_gen))
+ else:
+ next_code_gen = get_next_code(seen, 0)
if ok:
sys.exit(0)
diff --git a/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp b/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp
index 834d2052a98..b45042b4b0f 100644
--- a/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp
+++ b/buildscripts/tests/data/errorcodes/regex_matching/regex_matching.cpp
@@ -27,4 +27,8 @@ LOGV2_ERROR(25,
"more words");
LOGV2_ERROR(26,
"words",
- "comma, more words words words words words words words words words words words words "
+ "comma, more words words words words words words words words words words words words ");
+iassert(27, "words");
+iasserted(28, "words");
+iassertNoTrace(29, "words");
+iassertedNoTrace(30, "words");
diff --git a/buildscripts/tests/test_errorcodes.py b/buildscripts/tests/test_errorcodes.py
index 2a9c9ce1e3f..d14aa505a92 100644
--- a/buildscripts/tests/test_errorcodes.py
+++ b/buildscripts/tests/test_errorcodes.py
@@ -26,7 +26,7 @@ class TestErrorcodes(unittest.TestCase):
captured_error_codes.append(code)
errorcodes.parse_source_files(accumulate_files, TESTDATA_DIR + 'regex_matching/')
- self.assertEqual(26, len(captured_error_codes))
+ self.assertEqual(30, len(captured_error_codes))
def test_dup_checking(self):
"""Test dup checking."""