lib/xfstests_ai_analysis.pm

analyze_by_knowledgebase

Analyze a failed test using the pre-generated knowledge base. Must call init_kb() first to load the knowledge base. Returns a hash ref with analysis results, or undef if test not found.

Features: - Matches output patterns (from both test output and full log) with per-pattern classification - Applies platform-specific factors (s390x, ppc64le, aarch64) from test context - Priority resolution: tool_version_mismatch overrides kernel_bug when patterns match

Arguments: test - test name (e.g. "xfs/001") fstype - filesystem type output - test output content (for pattern and context matching) fullog - .full log content (for tool version mismatch detection)

_download_kb

Download a knowledge base YAML file from URL. Uses Mojo::UserAgent with caching to avoid re-downloading. Returns parsed YAML data structure, or undef on failure.

init_kb

Load knowledge bases from URLs specified by XFSTESTS_AI_KB and XFSTESTS_QE_KB variables. Downloads via HTTP (following the LTP::WhiteList pattern), parses YAML, then merges QE-maintained KB on top (higher priority). QE entries override scalar fields and prepend to list fields. Returns true if at least one knowledge base was loaded successfully.

_merge_knowledge_bases

Merge QE knowledge base into the main cache. For each test entry: - Scalar fields (description, subsystem, bug_probability, classification): QE value overrides AI value - List fields (common_causes, investigation_steps, output_patterns): QE entries are prepended (shown first = higher priority) - platform_factors: merged per-architecture, QE overrides AI per-arch

_match_output_patterns

Match test output against known patterns from the knowledge base. Returns list of matched pattern hashes with bug_probability and classification.

_apply_pattern_overrides

Apply per-pattern bug_probability and classification overrides. Priority: tool_version_mismatch > test_bug > config_problem > kernel_bug. If multiple patterns match, the highest-priority classification wins.

_parse_test_context

Parse test output header to extract platform context (arch, kernel, mount options, mkfs options). xfstests output typically starts with lines like: PLATFORM -- Linux/x86_64 hostname 6.x.y-default #1 SMP ... MOUNT_OPTIONS -- rw,relatime,attr2,inode64,... MKFS_OPTIONS -- -f /dev/vdb1

_apply_platform_factors

Apply platform-specific adjustments from knowledge base. Merges extra_causes, extra_steps, and overrides bug_probability if defined.

format_analysis_result

Format knowledge base analysis result into readable text for record_info.

Arguments: kb_result - hash ref from analyze_by_knowledgebase