mirror of
https://github.com/mvt-project/mvt.git
synced 2026-09-03 08:30:51 +02:00
Always parse paired tombstones
This commit is contained in:
@@ -43,15 +43,7 @@ class Tombstones(TombstoneCrashArtifact, BugReportModule):
|
||||
)
|
||||
return
|
||||
|
||||
parsed_tombstones = set()
|
||||
for tombstone_file in sorted(
|
||||
tombstone_files,
|
||||
key=lambda path: (path.removesuffix(".pb"), not path.endswith(".pb")),
|
||||
):
|
||||
tombstone_base = tombstone_file.removesuffix(".pb")
|
||||
if tombstone_base in parsed_tombstones:
|
||||
continue
|
||||
|
||||
for tombstone_file in sorted(tombstone_files):
|
||||
tombstone_filename = tombstone_file.split("/")[-1]
|
||||
modification_time = self._get_file_modification_time(tombstone_file)
|
||||
tombstone_data = self._get_file_content(tombstone_file)
|
||||
@@ -63,7 +55,6 @@ class Tombstones(TombstoneCrashArtifact, BugReportModule):
|
||||
)
|
||||
else:
|
||||
self.parse(tombstone_filename, modification_time, tombstone_data)
|
||||
parsed_tombstones.add(tombstone_base)
|
||||
except ValueError as e:
|
||||
# Catch any exceptions raised during parsing or validation.
|
||||
self.log.error(f"Error parsing tombstone file {tombstone_file}: {e}")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# https://license.mvt.re/1.1/
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from mvt.android.modules.bugreport.dumpsys_appops import DumpsysAppops
|
||||
@@ -91,23 +90,3 @@ class TestBugreportAnalysis:
|
||||
m = self.launch_bug_report_module(Tombstones)
|
||||
assert len(m.results) == 2
|
||||
assert m.results[1]["pid"] == 3559
|
||||
|
||||
def test_tombstones_prefers_protobuf_for_paired_files(self, tmp_path):
|
||||
tombstone_dir = tmp_path / "FS" / "data" / "tombstones"
|
||||
tombstone_dir.mkdir(parents=True)
|
||||
artifacts = Path(get_artifact_folder()) / "android_data"
|
||||
shutil.copy(artifacts / "tombstone_process.txt", tombstone_dir / "tombstone_00")
|
||||
shutil.copy(
|
||||
artifacts / "tombstone_process.pb", tombstone_dir / "tombstone_00.pb"
|
||||
)
|
||||
|
||||
module = Tombstones(target_path=str(tmp_path))
|
||||
files = [
|
||||
str(path.relative_to(tmp_path))
|
||||
for path in tombstone_dir.iterdir()
|
||||
if path.is_file()
|
||||
]
|
||||
module.from_dir(str(tmp_path), files)
|
||||
run_module(module)
|
||||
|
||||
assert len(module.results) == 1
|
||||
|
||||
Reference in New Issue
Block a user