tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 441715a778a7bc96e74d2e66cdaa07e58f039805
parent f6138fcf7f98ce56dde68e70dd966d92f3f0bd59
Author: iulian moraru <imoraru@mozilla.com>
Date:   Sat, 20 Dec 2025 22:09:03 +0200

Revert "Bug 2000240 - avoid printing 'undefined assertion name' for assertions outsides of test tasks, r=ahal." for "Too few arguments" logged.

This reverts commit 2217a43137a59b7dfd5c7f5de04bfd81eeb14706.

Diffstat:
Mtesting/mochitest/runtests.py | 8++++----
Mtesting/modules/StructuredLog.sys.mjs | 5+++++
Mtesting/mozbase/mozcrash/mozcrash/mozcrash.py | 3---
Mtesting/mozbase/mozlog/mozlog/formatters/machformatter.py | 3+--
Mtesting/mozbase/mozlog/mozlog/formatters/tbplformatter.py | 11++++-------
Mtesting/mozbase/mozlog/mozlog/logtypes.py | 2--
6 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py @@ -208,7 +208,7 @@ class MessageLogger: def _fix_subtest_name(self, message): """Make sure subtest name is a string""" - if message.get("subtest") is not None: + if "subtest" in message and not isinstance(message["subtest"], str): message["subtest"] = str(message["subtest"]) def _fix_test_name(self, message): @@ -4255,8 +4255,9 @@ toolbar#nav-bar { ): key = message["test"].split("/")[-1].strip() if key not in self.harness.expectedError: - error_msg = message.get("message") or message.get("subtest") or "" - self.harness.expectedError[key] = error_msg.strip() + self.harness.expectedError[key] = message.get( + "message", message["subtest"] + ).strip() return message def countline(self, message): @@ -4302,7 +4303,6 @@ toolbar#nav-bar { and self.dump_screen_on_timeout and message["action"] == "test_status" and "expected" in message - and message["subtest"] is not None and "Test timed out" in message["subtest"] ): self.harness.dumpScreen(self.utilityPath) diff --git a/testing/modules/StructuredLog.sys.mjs b/testing/modules/StructuredLog.sys.mjs @@ -40,6 +40,11 @@ export class StructuredLogger { stack = null, extra = null ) { + if (subtest === null || subtest === undefined) { + // Fix for assertions that don't pass in a name + subtest = "undefined assertion name"; + } + var data = { test: this.#testId(test), subtest, diff --git a/testing/mozbase/mozcrash/mozcrash/mozcrash.py b/testing/mozbase/mozcrash/mozcrash/mozcrash.py @@ -465,9 +465,6 @@ class CrashInfo: if os.path.exists(extra) and not self.keep: mozfile.remove(extra) - if signature is None: - signature = "[Unknown]" - return StackInfo( path, signature, diff --git a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py @@ -184,8 +184,7 @@ class MachFormatter(base.BaseFormatter): return color(status) def _format_status(self, test, data): - subtest = data.get("subtest") - name = subtest if subtest is not None else test + name = data.get("subtest", test) rv = "%s %s" % ( self._format_expected( data["status"], diff --git a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py @@ -223,19 +223,16 @@ class TbplFormatter(BaseFormatter): status = data["status"] - subtest = data["subtest"] - subtest_str = (" | %s" % subtest) if subtest else "" - if "expected" in data: if status in data.get("known_intermittent", []): status = "KNOWN-INTERMITTENT-%s" % status else: if not message: message = "- expected %s" % data["expected"] - failure_line = "TEST-UNEXPECTED-%s | %s%s %s\n" % ( + failure_line = "TEST-UNEXPECTED-%s | %s | %s %s\n" % ( status, data["test"], - subtest_str, + data["subtest"], message, ) if data["expected"] != "PASS": @@ -243,10 +240,10 @@ class TbplFormatter(BaseFormatter): return failure_line + info_line return failure_line - return "TEST-%s | %s%s %s\n" % ( + return "TEST-%s | %s | %s %s\n" % ( status, data["test"], - subtest_str, + data["subtest"], message, ) diff --git a/testing/mozbase/mozlog/mozlog/logtypes.py b/testing/mozbase/mozlog/mozlog/logtypes.py @@ -164,8 +164,6 @@ class ContainerType(DataType): class Unicode(DataType): def convert(self, data): - if data is None: - return None if isinstance(data, str): return data if isinstance(data, str):