amd-debug-tools 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of amd-debug-tools might be problematic. Click here for more details.
- amd_debug/__init__.py +1 -1
- amd_debug/bios.py +4 -2
- amd_debug/failures.py +1 -1
- amd_debug/installer.py +4 -2
- amd_debug/kernel.py +8 -0
- amd_debug/prerequisites.py +17 -27
- amd_debug/pstate.py +5 -3
- amd_debug/s2idle.py +33 -30
- amd_debug/sleep_report.py +128 -85
- amd_debug/templates/html +4 -2
- amd_debug/validator.py +21 -15
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.4.dist-info}/METADATA +1 -1
- amd_debug_tools-0.2.4.dist-info/RECORD +45 -0
- launcher.py +0 -1
- test_bios.py +4 -4
- test_launcher.py +2 -1
- test_prerequisites.py +11 -19
- test_s2idle.py +41 -11
- test_sleep_report.py +29 -0
- test_validator.py +116 -7
- amd_debug_tools-0.2.2.dist-info/RECORD +0 -45
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.4.dist-info}/WHEEL +0 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.4.dist-info}/entry_points.txt +0 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.4.dist-info}/licenses/LICENSE +0 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.4.dist-info}/top_level.txt +0 -0
test_prerequisites.py
CHANGED
|
@@ -500,9 +500,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
500
500
|
result = self.validator.map_acpi_path()
|
|
501
501
|
self.assertTrue(result)
|
|
502
502
|
self.mock_db.record_debug.assert_called_with(
|
|
503
|
-
"ACPI name
|
|
504
|
-
"│ device1: mocked_path [driver]\n"
|
|
505
|
-
"└─device2: mocked_path [driver]\n"
|
|
503
|
+
"ACPI name | ACPI path | Kernel driver\ndevice1 | mocked_path | driver\ndevice2 | mocked_path | driver\n"
|
|
506
504
|
)
|
|
507
505
|
|
|
508
506
|
@patch("amd_debug.prerequisites.os.path.exists")
|
|
@@ -545,7 +543,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
545
543
|
result = self.validator.map_acpi_path()
|
|
546
544
|
self.assertTrue(result)
|
|
547
545
|
self.mock_db.record_debug.assert_called_with(
|
|
548
|
-
"ACPI name
|
|
546
|
+
"ACPI name | ACPI path | Kernel driver\ndevice1 | mocked_path | None\n"
|
|
549
547
|
)
|
|
550
548
|
|
|
551
549
|
@patch("amd_debug.prerequisites.read_file")
|
|
@@ -569,8 +567,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
569
567
|
|
|
570
568
|
self.validator.capture_pci_acpi()
|
|
571
569
|
self.mock_db.record_debug.assert_called_with(
|
|
572
|
-
"PCI
|
|
573
|
-
"└─0000:00:1f.0 : Intel Corporation ISA bridge [1234abcd] : mocked_acpi_path\n"
|
|
570
|
+
"PCI Slot | Vendor | Class | ID | ACPI path\n└─0000:00:1f.0 | Intel Corporation | ISA bridge | 1234abcd | mocked_acpi_path\n"
|
|
574
571
|
)
|
|
575
572
|
|
|
576
573
|
@patch("amd_debug.prerequisites.read_file")
|
|
@@ -593,8 +590,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
593
590
|
|
|
594
591
|
self.validator.capture_pci_acpi()
|
|
595
592
|
self.mock_db.record_debug.assert_called_with(
|
|
596
|
-
"PCI
|
|
597
|
-
"└─0000:01:00.0 : NVIDIA Corporation VGA compatible controller [5678efgh]\n"
|
|
593
|
+
"PCI Slot | Vendor | Class | ID | ACPI path\n└─0000:01:00.0 | NVIDIA Corporation | VGA compatible controller | 5678efgh | \n"
|
|
598
594
|
)
|
|
599
595
|
|
|
600
596
|
@patch("amd_debug.prerequisites.read_file")
|
|
@@ -628,9 +624,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
628
624
|
|
|
629
625
|
self.validator.capture_pci_acpi()
|
|
630
626
|
self.mock_db.record_debug.assert_called_with(
|
|
631
|
-
"PCI
|
|
632
|
-
"│ 0000:00:1f.0 : Intel Corporation ISA bridge [1234abcd] : mocked_acpi_path\n"
|
|
633
|
-
"└─0000:01:00.0 : NVIDIA Corporation VGA compatible controller [5678efgh] : mocked_acpi_path\n"
|
|
627
|
+
"PCI Slot | Vendor | Class | ID | ACPI path\n│ 0000:00:1f.0 | Intel Corporation | ISA bridge | 1234abcd | mocked_acpi_path\n└─0000:01:00.0 | NVIDIA Corporation | VGA compatible controller | 5678efgh | mocked_acpi_path\n"
|
|
634
628
|
)
|
|
635
629
|
|
|
636
630
|
def test_capture_pci_acpi_no_devices(self):
|
|
@@ -638,7 +632,9 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
638
632
|
self.mock_pyudev.list_devices.return_value = []
|
|
639
633
|
|
|
640
634
|
self.validator.capture_pci_acpi()
|
|
641
|
-
self.mock_db.record_debug.assert_called_with(
|
|
635
|
+
self.mock_db.record_debug.assert_called_with(
|
|
636
|
+
"PCI Slot | Vendor | Class | ID | ACPI path\n"
|
|
637
|
+
)
|
|
642
638
|
|
|
643
639
|
@patch("amd_debug.prerequisites.read_file")
|
|
644
640
|
def test_check_aspm_default_policy(self, mock_read_file):
|
|
@@ -802,8 +798,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
802
798
|
self.assertFalse(result)
|
|
803
799
|
self.assertTrue(any(isinstance(f, FadtWrong) for f in self.validator.failures))
|
|
804
800
|
|
|
805
|
-
|
|
806
|
-
def test_check_fadt_file_not_found(self, mock_path_exists):
|
|
801
|
+
def test_check_fadt_file_not_found(self):
|
|
807
802
|
"""Test check_fadt when FADT file is not found"""
|
|
808
803
|
self.mock_kernel_log.match_line.return_value = False
|
|
809
804
|
result = self.validator.check_fadt()
|
|
@@ -1006,7 +1001,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
1006
1001
|
"MockVendor MockProduct (MockFamily)", "💻"
|
|
1007
1002
|
)
|
|
1008
1003
|
self.mock_db.record_debug.assert_called_with(
|
|
1009
|
-
"DMI
|
|
1004
|
+
"DMI|value\nchassis_type| Desktop\n"
|
|
1010
1005
|
)
|
|
1011
1006
|
|
|
1012
1007
|
@patch("amd_debug.prerequisites.os.walk")
|
|
@@ -1034,7 +1029,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
1034
1029
|
self.mock_db.record_prereq.assert_called_with(
|
|
1035
1030
|
"MockVendor MockProduct (MockFamily)", "💻"
|
|
1036
1031
|
)
|
|
1037
|
-
self.mock_db.record_debug.assert_called_with("DMI
|
|
1032
|
+
self.mock_db.record_debug.assert_called_with("DMI|value\n")
|
|
1038
1033
|
|
|
1039
1034
|
@patch("amd_debug.prerequisites.os.walk")
|
|
1040
1035
|
@patch("amd_debug.prerequisites.read_file")
|
|
@@ -1710,9 +1705,6 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
1710
1705
|
]
|
|
1711
1706
|
result = self.validator.check_storage()
|
|
1712
1707
|
self.assertTrue(result)
|
|
1713
|
-
self.mock_db.record_debug.assert_called_with(
|
|
1714
|
-
"New enough kernel to avoid NVME check"
|
|
1715
|
-
)
|
|
1716
1708
|
|
|
1717
1709
|
def test_check_storage_no_kernel_log(self):
|
|
1718
1710
|
"""Test check_storage when kernel log is unavailable"""
|
test_s2idle.py
CHANGED
|
@@ -180,7 +180,7 @@ class TestMainFunction(unittest.TestCase):
|
|
|
180
180
|
mock_report.assert_called_once_with(
|
|
181
181
|
"2023-01-01", "2023-02-01", None, "html", False, False
|
|
182
182
|
)
|
|
183
|
-
self.
|
|
183
|
+
self.assertIsNone(result)
|
|
184
184
|
|
|
185
185
|
@patch("amd_debug.s2idle.relaunch_sudo")
|
|
186
186
|
@patch("amd_debug.s2idle.run_test_cycle")
|
|
@@ -207,7 +207,7 @@ class TestMainFunction(unittest.TestCase):
|
|
|
207
207
|
mock_test.assert_called_once_with(
|
|
208
208
|
None, None, "5", "txt", None, False, False, False, False, False
|
|
209
209
|
)
|
|
210
|
-
self.
|
|
210
|
+
self.assertIsNone(result)
|
|
211
211
|
|
|
212
212
|
@patch("amd_debug.s2idle.version")
|
|
213
213
|
def test_main_version(self, mock_version):
|
|
@@ -220,7 +220,7 @@ class TestMainFunction(unittest.TestCase):
|
|
|
220
220
|
result = main()
|
|
221
221
|
mock_version.assert_called_once()
|
|
222
222
|
mock_print.assert_called_once_with("1.0.0")
|
|
223
|
-
self.
|
|
223
|
+
self.assertIsNone(result)
|
|
224
224
|
|
|
225
225
|
def test_main_no_action(self):
|
|
226
226
|
"""Test main function with no action specified"""
|
|
@@ -455,12 +455,18 @@ class TestTestFunction(unittest.TestCase):
|
|
|
455
455
|
|
|
456
456
|
@patch("amd_debug.s2idle.Installer")
|
|
457
457
|
@patch("amd_debug.s2idle.PrerequisiteValidator")
|
|
458
|
-
@patch("amd_debug.
|
|
459
|
-
@patch("amd_debug.
|
|
458
|
+
@patch("amd_debug.s2idle.SleepValidator")
|
|
459
|
+
@patch("amd_debug.s2idle.SleepReport")
|
|
460
|
+
@patch("amd_debug.s2idle.prompt_test_arguments")
|
|
461
|
+
@patch("amd_debug.s2idle.prompt_report_arguments")
|
|
462
|
+
@patch("amd_debug.s2idle.display_report_file")
|
|
460
463
|
def test_test_prerequisite_failure(
|
|
461
464
|
self,
|
|
462
|
-
|
|
463
|
-
|
|
465
|
+
mock_display_report_file,
|
|
466
|
+
mock_prompt_report_arguments,
|
|
467
|
+
mock_prompt_test_arguments,
|
|
468
|
+
mock_sleep_report,
|
|
469
|
+
mock_sleep_validator,
|
|
464
470
|
mock_prerequisite_validator,
|
|
465
471
|
mock_installer,
|
|
466
472
|
):
|
|
@@ -471,6 +477,17 @@ class TestTestFunction(unittest.TestCase):
|
|
|
471
477
|
mock_prerequisite_instance = mock_prerequisite_validator.return_value
|
|
472
478
|
mock_prerequisite_instance.run.return_value = False
|
|
473
479
|
|
|
480
|
+
mock_prompt_test_arguments.return_value = (10, 5, 3)
|
|
481
|
+
mock_prompt_report_arguments.return_value = (
|
|
482
|
+
"2023-01-01",
|
|
483
|
+
"2023-02-01",
|
|
484
|
+
"report.html",
|
|
485
|
+
"html",
|
|
486
|
+
True,
|
|
487
|
+
)
|
|
488
|
+
mock_sleep_validator_instance = mock_sleep_validator.return_value
|
|
489
|
+
mock_sleep_report_instance = mock_sleep_report.return_value
|
|
490
|
+
|
|
474
491
|
result = run_test_cycle(
|
|
475
492
|
duration=None,
|
|
476
493
|
wait=None,
|
|
@@ -492,7 +509,20 @@ class TestTestFunction(unittest.TestCase):
|
|
|
492
509
|
mock_prerequisite_validator.assert_called_once_with(True)
|
|
493
510
|
mock_prerequisite_instance.run.assert_called_once()
|
|
494
511
|
mock_prerequisite_instance.report.assert_called_once()
|
|
495
|
-
|
|
512
|
+
mock_prompt_test_arguments.assert_called_once_with(None, None, None, False)
|
|
513
|
+
mock_prompt_report_arguments.assert_called_once()
|
|
514
|
+
mock_sleep_validator_instance.assert_not_called()
|
|
515
|
+
mock_sleep_report.assert_called_once_with(
|
|
516
|
+
since=None,
|
|
517
|
+
until=None,
|
|
518
|
+
fname="report.html",
|
|
519
|
+
fmt="html",
|
|
520
|
+
tool_debug=True,
|
|
521
|
+
report_debug=True,
|
|
522
|
+
)
|
|
523
|
+
mock_sleep_report_instance.run.assert_called_once()
|
|
524
|
+
mock_display_report_file.assert_called_once_with("report.html", "html")
|
|
525
|
+
self.assertTrue(result)
|
|
496
526
|
|
|
497
527
|
@patch("amd_debug.s2idle.Installer")
|
|
498
528
|
@patch("amd_debug.s2idle.PrerequisiteValidator")
|
|
@@ -533,9 +563,9 @@ class TestTestFunction(unittest.TestCase):
|
|
|
533
563
|
"iasl", "ethtool", "edid-decode"
|
|
534
564
|
)
|
|
535
565
|
mock_installer_instance.install_dependencies.assert_called_once()
|
|
536
|
-
mock_prerequisite_validator.
|
|
537
|
-
mock_prerequisite_instance.run.
|
|
538
|
-
mock_prerequisite_instance.report.
|
|
566
|
+
mock_prerequisite_validator.assert_not_called()
|
|
567
|
+
mock_prerequisite_instance.run.assert_not_called()
|
|
568
|
+
mock_prerequisite_instance.report.assert_not_called()
|
|
539
569
|
mock_prompt_test_arguments.assert_called_once_with(None, None, None, False)
|
|
540
570
|
|
|
541
571
|
|
test_sleep_report.py
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
This module contains unit tests for the s2idle tool in the amd-debug-tools package.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
import math
|
|
8
9
|
import unittest
|
|
9
10
|
from datetime import datetime
|
|
10
11
|
from unittest.mock import patch
|
|
@@ -165,3 +166,31 @@ class TestSleepReport(unittest.TestCase):
|
|
|
165
166
|
self.report.build_hw_sleep_chart()
|
|
166
167
|
self.assertIsNotNone(self.report.hwsleep_svg)
|
|
167
168
|
mock_savefig.assert_called_once()
|
|
169
|
+
|
|
170
|
+
def test_pre_process_dataframe_zero_duration(self):
|
|
171
|
+
"""Test the pre_process_dataframe method when t0 and t1 are the same."""
|
|
172
|
+
# Mock the dataframe with t0 and t1 being the same
|
|
173
|
+
self.report.df = pd.DataFrame(
|
|
174
|
+
{
|
|
175
|
+
"t0": [datetime(2023, 10, 10, 12, 0, 0).strftime("%Y%m%d%H%M%S")],
|
|
176
|
+
"t1": [datetime(2023, 10, 10, 12, 0, 0).strftime("%Y%m%d%H%M%S")],
|
|
177
|
+
"hw": [50],
|
|
178
|
+
"requested": [1],
|
|
179
|
+
"gpio": ["1, 2"],
|
|
180
|
+
"wake_irq": ["1"],
|
|
181
|
+
"b0": [90],
|
|
182
|
+
"b1": [85],
|
|
183
|
+
"full": [100],
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Call the method
|
|
188
|
+
self.report.pre_process_dataframe()
|
|
189
|
+
|
|
190
|
+
# Verify the dataframe was processed correctly
|
|
191
|
+
self.assertTrue(
|
|
192
|
+
self.report.df["Duration"].isna().iloc[0]
|
|
193
|
+
) # Duration should be NaN
|
|
194
|
+
self.assertTrue(
|
|
195
|
+
math.isnan(self.report.df["Hardware Sleep"].iloc[0])
|
|
196
|
+
) # Hardware Sleep should be NaN
|
test_validator.py
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
This module contains unit tests for the validator functions in the amd-debug-tools package.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from unittest.mock import patch, mock_open
|
|
8
|
+
from unittest.mock import patch, mock_open, Mock
|
|
9
9
|
|
|
10
|
+
import os
|
|
10
11
|
import logging
|
|
11
12
|
import unittest
|
|
12
13
|
import math
|
|
@@ -157,9 +158,8 @@ class TestValidator(unittest.TestCase):
|
|
|
157
158
|
self.validator.capture_wake_sources()
|
|
158
159
|
|
|
159
160
|
# Validate debug messages
|
|
160
|
-
mock_record_debug.assert_any_call("Possible wakeup sources:")
|
|
161
161
|
mock_record_debug.assert_any_call(
|
|
162
|
-
"
|
|
162
|
+
"Wakeup Source|Linux Device|Status\n|/sys/devices/pci0000:00/0000:00:14.0|enabled\n"
|
|
163
163
|
)
|
|
164
164
|
|
|
165
165
|
# Stop patches
|
|
@@ -694,7 +694,7 @@ class TestValidator(unittest.TestCase):
|
|
|
694
694
|
# Test case 3: Randomized test
|
|
695
695
|
mock_randint.side_effect = [7, 3] # Random duration and wait
|
|
696
696
|
self.validator.run(duration=10, count=1, wait=5, rand=True, logind=False)
|
|
697
|
-
mock_randint.assert_any_call(
|
|
697
|
+
mock_randint.assert_any_call(4, 10)
|
|
698
698
|
mock_randint.assert_any_call(1, 5)
|
|
699
699
|
mock_run_countdown.assert_any_call("Suspending system", math.ceil(3 / 2))
|
|
700
700
|
mock_run_countdown.assert_any_call("Collecting data", math.ceil(3 / 2))
|
|
@@ -705,19 +705,128 @@ class TestValidator(unittest.TestCase):
|
|
|
705
705
|
mock_report_cycle.assert_called()
|
|
706
706
|
mock_unlock_session.assert_called()
|
|
707
707
|
|
|
708
|
-
# Test case 4:
|
|
708
|
+
# Test case 4: Randomized test, but too short of a duration
|
|
709
|
+
result = self.validator.run(
|
|
710
|
+
duration=4, count=1, wait=5, rand=True, logind=False
|
|
711
|
+
)
|
|
712
|
+
self.assertFalse(result)
|
|
713
|
+
mock_report_cycle.assert_called()
|
|
714
|
+
|
|
715
|
+
# Test case 5: Multiple cycles
|
|
709
716
|
self.validator.run(duration=10, count=2, wait=5, rand=False, logind=False)
|
|
710
717
|
self.assertEqual(mock_prep.call_count, 4) # Includes previous calls
|
|
711
718
|
self.assertEqual(mock_program_wakealarm.call_count, 4)
|
|
712
719
|
self.assertEqual(mock_suspend_system.call_count, 4)
|
|
713
720
|
self.assertEqual(mock_post.call_count, 4)
|
|
714
|
-
self.assertEqual(mock_report_cycle.call_count,
|
|
721
|
+
self.assertEqual(mock_report_cycle.call_count, 5)
|
|
715
722
|
self.assertEqual(mock_unlock_session.call_count, 3)
|
|
716
723
|
|
|
717
|
-
# Test case
|
|
724
|
+
# Test case 6: suspend_system fails
|
|
718
725
|
mock_suspend_system.return_value = False
|
|
719
726
|
result = self.validator.run(
|
|
720
727
|
duration=10, count=1, wait=5, rand=False, logind=False
|
|
721
728
|
)
|
|
722
729
|
self.assertFalse(result)
|
|
723
730
|
mock_report_cycle.assert_called()
|
|
731
|
+
|
|
732
|
+
@patch("os.path.exists")
|
|
733
|
+
@patch("builtins.open", new_callable=mock_open, read_data="3")
|
|
734
|
+
@patch("os.write")
|
|
735
|
+
@patch("os.open")
|
|
736
|
+
@patch("os.close")
|
|
737
|
+
def test_suspend_system_sysfs_success(
|
|
738
|
+
self,
|
|
739
|
+
mock_os_close,
|
|
740
|
+
mock_os_open,
|
|
741
|
+
mock_os_write,
|
|
742
|
+
_mock_open_file,
|
|
743
|
+
mock_path_exists,
|
|
744
|
+
):
|
|
745
|
+
"""Test suspend_system method using sysfs interface with success"""
|
|
746
|
+
# Mock wakeup_count file existence
|
|
747
|
+
mock_path_exists.side_effect = lambda path: "wakeup_count" in path
|
|
748
|
+
|
|
749
|
+
# Mock os.open and os.write
|
|
750
|
+
mock_os_open.return_value = 3
|
|
751
|
+
mock_os_write.return_value = None
|
|
752
|
+
|
|
753
|
+
# Call the method
|
|
754
|
+
result = self.validator.suspend_system()
|
|
755
|
+
|
|
756
|
+
# Assert the method returned True
|
|
757
|
+
self.assertTrue(result)
|
|
758
|
+
|
|
759
|
+
# Assert os.open and os.write were called
|
|
760
|
+
mock_os_open.assert_called_once_with(
|
|
761
|
+
"/sys/power/state", os.O_WRONLY | os.O_SYNC
|
|
762
|
+
)
|
|
763
|
+
mock_os_write.assert_called_once_with(3, b"mem")
|
|
764
|
+
mock_os_close.assert_called_once_with(3)
|
|
765
|
+
|
|
766
|
+
@patch("os.path.exists")
|
|
767
|
+
@patch("builtins.open", new_callable=mock_open, read_data="3")
|
|
768
|
+
@patch("os.write")
|
|
769
|
+
@patch("os.open")
|
|
770
|
+
@patch("os.close")
|
|
771
|
+
def test_suspend_system_sysfs_failure(
|
|
772
|
+
self,
|
|
773
|
+
mock_os_close,
|
|
774
|
+
mock_os_open,
|
|
775
|
+
mock_os_write,
|
|
776
|
+
_mock_open_file,
|
|
777
|
+
mock_path_exists,
|
|
778
|
+
):
|
|
779
|
+
"""Test suspend_system method using sysfs interface with failure"""
|
|
780
|
+
# Mock wakeup_count file existence
|
|
781
|
+
mock_path_exists.side_effect = lambda path: "wakeup_count" in path
|
|
782
|
+
|
|
783
|
+
# Mock os.open to raise OSError
|
|
784
|
+
mock_os_open.return_value = 3
|
|
785
|
+
mock_os_write.side_effect = OSError("Failed to write to state")
|
|
786
|
+
|
|
787
|
+
# Call the method
|
|
788
|
+
result = self.validator.suspend_system()
|
|
789
|
+
|
|
790
|
+
# Assert the method returned False
|
|
791
|
+
self.assertFalse(result)
|
|
792
|
+
|
|
793
|
+
# Assert os.open and os.write were called
|
|
794
|
+
mock_os_open.assert_called_once_with(
|
|
795
|
+
"/sys/power/state", os.O_WRONLY | os.O_SYNC
|
|
796
|
+
)
|
|
797
|
+
mock_os_write.assert_called_once_with(3, b"mem")
|
|
798
|
+
mock_os_close.assert_called_once_with(3)
|
|
799
|
+
|
|
800
|
+
@patch("os.path.exists")
|
|
801
|
+
@patch("builtins.open", new_callable=mock_open)
|
|
802
|
+
@patch("os.write")
|
|
803
|
+
@patch("os.open")
|
|
804
|
+
@patch("os.close")
|
|
805
|
+
def test_suspend_system_sysfs_no_wakeup_count(
|
|
806
|
+
self,
|
|
807
|
+
mock_os_close,
|
|
808
|
+
mock_os_open,
|
|
809
|
+
mock_os_write,
|
|
810
|
+
_mock_open_file,
|
|
811
|
+
mock_path_exists,
|
|
812
|
+
):
|
|
813
|
+
"""Test suspend_system method using sysfs interface with no wakeup_count file"""
|
|
814
|
+
# Mock wakeup_count file does not exist
|
|
815
|
+
mock_path_exists.return_value = False
|
|
816
|
+
|
|
817
|
+
# Mock os.open and os.write
|
|
818
|
+
mock_os_open.return_value = 3
|
|
819
|
+
mock_os_write.return_value = None
|
|
820
|
+
|
|
821
|
+
# Call the method
|
|
822
|
+
result = self.validator.suspend_system()
|
|
823
|
+
|
|
824
|
+
# Assert the method returned True
|
|
825
|
+
self.assertTrue(result)
|
|
826
|
+
|
|
827
|
+
# Assert os.open and os.write were called
|
|
828
|
+
mock_os_open.assert_called_once_with(
|
|
829
|
+
"/sys/power/state", os.O_WRONLY | os.O_SYNC
|
|
830
|
+
)
|
|
831
|
+
mock_os_write.assert_called_once_with(3, b"mem")
|
|
832
|
+
mock_os_close.assert_called_once_with(3)
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
launcher.py,sha256=_Gs0W8tUB2wkTy5Nz4qEzG0VqQcnO7xuIQj0GwV_KbY,968
|
|
2
|
-
test_acpi.py,sha256=wtS43Rz95h7YEEJBeFa6Mswaeo4syBZrw4hY8i0YbJY,3117
|
|
3
|
-
test_batteries.py,sha256=nN5pfP5El7Whypq3HHEpW8bufdf5EWSTVGbayfNQYP4,3360
|
|
4
|
-
test_bios.py,sha256=GBAXE_rXd2G-JE0XJ8AvYcF9Me6LTyQQQ8h0Ib3cpxQ,8981
|
|
5
|
-
test_common.py,sha256=fb16Oilh5ga6VgF-UgBj6azoYzZnPrS7KpECQ3nCwlg,16335
|
|
6
|
-
test_database.py,sha256=q5ZjI5u20f7ki6iCY5o1iPi0YOvPz1_W0LTDraU8mN4,10040
|
|
7
|
-
test_display.py,sha256=hHggv-zBthF1BlwWWSjzAm7BBw1DWcElwil5xAuz87g,5822
|
|
8
|
-
test_failures.py,sha256=H1UxXeVjhJs9-j9yas4vwAha676GX1Es7Kz8RN2B590,6845
|
|
9
|
-
test_installer.py,sha256=oDMCvaKqqAWjTggltacnasQ-s1gyUvXPDcNrCUGnux4,10216
|
|
10
|
-
test_kernel.py,sha256=RW-eLbae02Bhwfu1cegqA1pTj6AS5IqD5lLe-6T0Rjo,7871
|
|
11
|
-
test_launcher.py,sha256=govYHL0Cpj9d5msteV5SfR7Covft31rJuzRkDeytHcY,1461
|
|
12
|
-
test_prerequisites.py,sha256=4Ltxx7vGU91b9MX1AtdPLS8iyWJBCNuEKCuO0nnEb_g,83381
|
|
13
|
-
test_pstate.py,sha256=a9oAJ9-LANX32XNQhplz6Y75VNYc__QqoSBKIrwvANg,6058
|
|
14
|
-
test_s2idle.py,sha256=-S3yymjprf3_LIgaPGWgzN9FmnyQG55dNc4xqWAF8Z8,32344
|
|
15
|
-
test_sleep_report.py,sha256=R3cUPPT9r9q4q93xk6NFvi4ySgT5laqidk2SASuTWIo,5878
|
|
16
|
-
test_validator.py,sha256=NeiX8kT5DiHiiB5lRSJkjIpV32UzaIrW5ljKLmFtBMk,30490
|
|
17
|
-
test_wake.py,sha256=6zi5GVFHQKU1sTWw3O5-aGriB9uu5713QLn4l2wjhpM,7152
|
|
18
|
-
amd_debug/__init__.py,sha256=aOtpIEKGLUStrh0e4qgilHW7HgF4Od-r9pOoZ87NwAM,1105
|
|
19
|
-
amd_debug/acpi.py,sha256=fkD3Sov8cRT5ryPlakRlT7Z9jiCLT9x_MPWxt3xU_tc,3161
|
|
20
|
-
amd_debug/battery.py,sha256=WN-6ys9PHCZIwg7PdwyBOa62GjBp8WKG0v1YZt5_W5s,3122
|
|
21
|
-
amd_debug/bios.py,sha256=wmPKDsTZeQqsHjWpv-YHdgRNlCtFdzHQ6jJf0H3hjN8,3971
|
|
22
|
-
amd_debug/common.py,sha256=H9tIRlRFOMwe0d3f2-vXQeK2rJl5Z1WJzkpQM9ivpOc,10347
|
|
23
|
-
amd_debug/database.py,sha256=GkRg3cmaNceyQ2_hy0MBAlMbnTDPHo2co2o4ObWpnQg,10621
|
|
24
|
-
amd_debug/display.py,sha256=5L9x9tI_UoulHpIvuxuVASRtdXta7UCW_JjTb5StEB0,953
|
|
25
|
-
amd_debug/failures.py,sha256=Otv3YDu7Je4ljSifVmvjObGoOY4OvLIY20pw-v4Dqkw,22911
|
|
26
|
-
amd_debug/installer.py,sha256=r6r_nVWv8qYdrqAvnAzQhRiS5unBDOkXsqUfHvFK8uM,14249
|
|
27
|
-
amd_debug/kernel.py,sha256=xzAy-sDY5-sd4jxyU7EaBokS7YsvEjoWRuexaTJNRBc,11851
|
|
28
|
-
amd_debug/prerequisites.py,sha256=bKJA9ztyapB8rxrNEgc-hxazw5Uh-sP5X0S7zplGA0c,50413
|
|
29
|
-
amd_debug/pstate.py,sha256=akGdJkIxBp0bx3AeGv6ictNxwv8m0j9vQ2IZB0Jx3dM,9518
|
|
30
|
-
amd_debug/s2idle-hook,sha256=LLiaqPtGd0qetu9n6EYxKHZaIdHpVQDONdOuSc0pfFg,1695
|
|
31
|
-
amd_debug/s2idle.py,sha256=lzxLYZBcQllyqEMZfxYEUvQO3ArgVzwL5FHymzvZvSs,13281
|
|
32
|
-
amd_debug/sleep_report.py,sha256=zgwcmSk7S8GAmPtPZJGP29Mr5bcWUBxwNL8HBubKs6Q,15516
|
|
33
|
-
amd_debug/validator.py,sha256=fgG3D0k6DS9ArgzK1SuPUds1FNGoKf2asPUwWoyCsXE,33205
|
|
34
|
-
amd_debug/wake.py,sha256=xT8WrFrN6voCmXWo5dsn4mQ7iR2QJxHrrYBd3EREG-Q,3936
|
|
35
|
-
amd_debug/bash/amd-s2idle,sha256=g_cle1ElCJpwE4wcLezL6y-BdasDKTnNMhrtzKLE9ks,1142
|
|
36
|
-
amd_debug/templates/html,sha256=tnpqHDZF5FfhC6YNRUfOG6Vn9ZtISFr10kEXSB476Mw,14518
|
|
37
|
-
amd_debug/templates/md,sha256=r8X2aehnH2gzj0WHYTZ5K9wAqC5y39i_3nkDORSC0uM,787
|
|
38
|
-
amd_debug/templates/stdout,sha256=hyoOJ96K2dJfnWRWhyCuariLKbEHXvs9mstV_g5aMdI,469
|
|
39
|
-
amd_debug/templates/txt,sha256=nNdsvbPFOhGdL7VA-_4k5aN3nB-6ouGQt6AsWst7T3w,649
|
|
40
|
-
amd_debug_tools-0.2.2.dist-info/licenses/LICENSE,sha256=RBlZI6r3MRGzymI2VDX2iW__D2APDbMhu_Xg5t6BWeo,1066
|
|
41
|
-
amd_debug_tools-0.2.2.dist-info/METADATA,sha256=oZ5H5dL216bbAqtOF8VmvtqkqctPIf5iPibPCjjc1tQ,6877
|
|
42
|
-
amd_debug_tools-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
-
amd_debug_tools-0.2.2.dist-info/entry_points.txt,sha256=HC11T2up0pPfroAn6Pg5M2jOZXhkWIipToJ1YPTKqu8,116
|
|
44
|
-
amd_debug_tools-0.2.2.dist-info/top_level.txt,sha256=XYjxExbUTEtiIlag_5iQvZSVOC1EIxhKM4NLklReQ0k,234
|
|
45
|
-
amd_debug_tools-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|