Skip to content

Commit

Permalink
Updated tool to use freebsd specifics
Browse files Browse the repository at this point in the history
  • Loading branch information
r-dailey authored and LiliDeng committed Mar 27, 2024
1 parent d9e39b8 commit c3ec08e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lisa/tools/hwclock.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from datetime import datetime
from typing import cast
from typing import Optional, Type, cast

from dateutil.parser import parser
from retry import retry
Expand All @@ -12,6 +12,10 @@


class Hwclock(Tool):
@classmethod
def _freebsd_tool(cls) -> Optional[Type[Tool]]:
return HwclockFreebsd

@property
def command(self) -> str:
return "hwclock"
Expand Down Expand Up @@ -62,3 +66,19 @@ def get(self, no_error_log: bool = True) -> datetime:
f" error: {command_result.stderr}"
)
return parser().parse(command_result.stdout)


class HwclockFreebsd(Hwclock):
@property
def command(self) -> str:
return ""

@property
def can_install(self) -> bool:
return False

def _check_exists(self) -> bool:
return True

def set_rtc_clock_to_system_time(self) -> None:
self.node.execute(cmd="adjkerntz -i", expected_exit_code=0)

0 comments on commit c3ec08e

Please sign in to comment.