Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Notifier to check the DMesg Logs for OOPS Exceptions #3617

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addressing the mypy build errors
  • Loading branch information
umfranci committed Jan 27, 2025
commit 3c8932ca1cef49fcbbdcca627fcc7667852242fa
10 changes: 5 additions & 5 deletions lisa/notifiers/dmesg_oops.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import re
from dataclasses import dataclass
from pathlib import Path
from typing import Any, List, Pattern, Type, cast
from typing import Any, Dict, List, Pattern, Type, cast

from dataclasses_json import dataclass_json

@@ -44,7 +44,7 @@ class DmsgOops(notifier.Notifier):
"""
A sample notifier to check for Panics/OOPs Errors in the DMesg Logs.
"""

dmesg_errors: Dict[str, Dict[str, List[str]]]
@classmethod
def type_name(cls) -> str:
return "dmsg_oops_notifier"
@@ -59,9 +59,9 @@ def save_results(self) -> None:
file_path = constants.RUN_LOCAL_LOG_PATH / file_path
self._log.info(f"Writing output to file {file_path}")
with open(file_path, "w") as f:
f.write(str(self.dmesg_errors)) # type: ignore
f.write(str(self.dmesg_errors))

def check_kernel_oops(self, dmesg_logs: str, context_lines: int = 4) -> list[str]:
def check_kernel_oops(self, dmesg_logs: str, context_lines: int = 4) -> List[str]:
oops_list = []
lines = dmesg_logs.splitlines()
for i, line in enumerate(lines):
@@ -80,7 +80,7 @@ def dmesg_error_check(self, test_name: str, dmesg_logs: str) -> None:
self._log.info("DMesg logs check completed")

def process_serial_logs(
self, test_name: str, file_path: str, pattern_start: str, pattern_end: str
self, test_name: str, file_path: Path, pattern_start: str, pattern_end: str
) -> None:
with open(file_path, "r") as file:
buffer = file.read()
Loading
Oops, something went wrong.