@@ -1991,11 +1991,78 @@ def test_check_dpia_pg_dmcub_usb4_found(
19911991 "USB4 routers found, no need to check DMCUB version"
19921992 )
19931993
1994+ @patch ("amd_debug.prerequisites.clear_temporary_message" )
1995+ def test_run_failure_records_kernel_log (self , _mock_clear ):
1996+ """Test that the whole kernel log is recorded when prerequisites fail"""
1997+ # Mock all check and info methods to avoid system access
1998+ check_methods = [
1999+ "check_aspm" ,
2000+ "check_i2c_hid" ,
2001+ "check_pinctrl_amd" ,
2002+ "check_amd_hsmp" ,
2003+ "check_amd_xdna" ,
2004+ "check_amd_pmc" ,
2005+ "check_amd_cpu_hpet_wa" ,
2006+ "check_port_pm_override" ,
2007+ "check_usb3" ,
2008+ "check_usb4" ,
2009+ "check_sleep_mode" ,
2010+ "check_storage" ,
2011+ "check_wcn6855_bug" ,
2012+ "check_amdgpu" ,
2013+ "check_amdgpu_parameters" ,
2014+ "check_cpu" ,
2015+ "check_msr" ,
2016+ "check_smt" ,
2017+ "check_iommu" ,
2018+ "check_asus_rog_ally" ,
2019+ "check_dpia_pg_dmcub" ,
2020+ "check_isp4" ,
2021+ "check_fadt" ,
2022+ "check_logger" ,
2023+ "check_lps0" ,
2024+ "check_permissions" ,
2025+ "check_wlan" ,
2026+ "check_taint" ,
2027+ "capture_acpi" ,
2028+ "map_acpi_path" ,
2029+ "check_device_firmware" ,
2030+ "check_network" ,
2031+ "capture_disabled_pins" ,
2032+ ]
2033+ for method in check_methods :
2034+ setattr (self .validator , method , MagicMock (return_value = True ))
2035+
2036+ # Mock one check to fail
2037+ self .validator .check_permissions .return_value = False
2038+
2039+ # Mock get_cpu_vendor
2040+ self .validator .get_cpu_vendor = MagicMock (return_value = "AuthenticAMD" )
2041+
2042+ # Set a mock kernel log
2043+ mock_log_content = "Mocked full kernel log content"
2044+ self .mock_kernel_log .get_full_log .return_value = mock_log_content
2045+
2046+ # Run the validator
2047+ with patch (
2048+ "amd_debug.prerequisites.print_temporary_message" , return_value = "msg"
2049+ ):
2050+ result = self .validator .run ()
2051+
2052+ self .assertFalse (result )
2053+ # Verify Headers.BrokenPrerequisites was recorded
2054+ from amd_debug .prerequisites import Headers
2055+
2056+ self .mock_db .record_prereq .assert_any_call (Headers .BrokenPrerequisites , "🚫" )
2057+ # Verify the whole kernel log was recorded to debug
2058+ self .mock_db .record_debug .assert_called_with (mock_log_content )
2059+
19942060 @patch ("amd_debug.prerequisites.find_ip_version" , return_value = True )
19952061 @patch ("amd_debug.prerequisites.os.path.exists" , return_value = True )
19962062 @patch ("amd_debug.prerequisites.read_file" , return_value = "0x90001B01" )
2063+ @patch ("amd_debug.prerequisites.version.parse" )
19972064 def test_check_dpia_pg_dmcub_dmcub_fw_version_new_enough (
1998- self , mock_read_file , mock_path_exists , mock_find_ip_version
2065+ self , mock_version_parse , mock_read_file , mock_path_exists , mock_find_ip_version
19992066 ):
20002067 """Test check_dpia_pg_dmcub when DMCUB firmware version is new enough"""
20012068 self .mock_pyudev .list_devices .side_effect = [
0 commit comments