Skip to content

Commit

Permalink
Add file check to enable fixture/testcases on platforms with no therm…
Browse files Browse the repository at this point in the history
…al_policy file support (#4262)
  • Loading branch information
tjchadaga authored Sep 19, 2021
1 parent bea84e1 commit 79e5e78
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/platform_tests/thermal_control_test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ def __enter__(self):
thermal control daemon to make it effect.
:return:
"""
self.dut.command('mv -f {} {}'.format(self.thermal_policy_file_path, self.thermal_policy_file_backup_path))
if os.path.exists(self.thermal_policy_file_path):
self.dut.command('mv -f {} {}'.format(self.thermal_policy_file_path, self.thermal_policy_file_backup_path))
else:
logging.warning("Thermal Policy file {} not found".format(self.thermal_policy_file_path))
self.dut.copy(src=os.path.join(FILES_DIR, self.src), dest=self.thermal_policy_file_path)
restart_thermal_control_daemon(self.dut)

Expand All @@ -315,8 +318,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
:param exc_tb: Not used.
:return:
"""
self.dut.command('mv -f {} {}'.format(self.thermal_policy_file_backup_path, self.thermal_policy_file_path))
restart_thermal_control_daemon(self.dut)

if os.path.exists(self.thermal_policy_file_backup_path):
self.dut.command('mv -f {} {}'.format(self.thermal_policy_file_backup_path, self.thermal_policy_file_path))
restart_thermal_control_daemon(self.dut)


@pytest.fixture
Expand Down

0 comments on commit 79e5e78

Please sign in to comment.