Devtools parser: reassemble fragmented messages (#36033)

* Devtools parser: reassemble fragmented messages

Co-authored-by: Aria Edmonds <8436007+ar1a@users.noreply.github.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Enable devtools parser tests on Linux only for now

Signed-off-by: Delan Azabani <dazabani@igalia.com>

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Aria Edmonds <8436007+ar1a@users.noreply.github.com>
This commit is contained in:
Delan Azabani 2025-03-29 13:44:43 +08:00 committed by GitHub
parent 5d1c64dba9
commit 2c94110952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 147 additions and 25 deletions

View file

@ -13,6 +13,7 @@ import re
import sys
import os
import os.path as path
import platform
import shutil
import subprocess
import textwrap
@ -291,6 +292,25 @@ class MachCommands(CommandBase):
print("Running WPT tests...")
passed = wpt.run_tests() and passed
print("Running devtools parser tests...")
# TODO: Enable these tests on other platforms once mach bootstrap installs tshark(1) for them
if platform.system() == "Linux":
try:
result = subprocess.run(
["etc/devtools_parser.py", "--json", "--use", "etc/devtools_parser_test.pcap"],
check=True, capture_output=True)
expected = open("etc/devtools_parser_test.json", "rb").read()
actual = result.stdout
assert actual == expected, f"Incorrect output!\nExpected: {repr(expected)}\nActual: {repr(actual)}"
print("OK")
except subprocess.CalledProcessError as e:
print(f"Process failed with exit status {e.returncode}: {e.cmd}", file=sys.stderr)
print(f"stdout: {repr(e.stdout)}", file=sys.stderr)
print(f"stderr: {repr(e.stderr)}", file=sys.stderr)
raise e
else:
print("SKIP")
if all or tests:
print("Running WebIDL tests...")