test api: allow to get commit hash from DUT

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-05-27 07:38:30 -04:00
parent c99631bc73
commit e34477690c

View File

@ -9,10 +9,12 @@ from core.test_run import TestRun
from connection.local_executor import LocalExecutor from connection.local_executor import LocalExecutor
def get_current_commit_hash(): def get_current_commit_hash(from_dut: bool = False):
local_executor = LocalExecutor() executor = TestRun.executor if from_dut else LocalExecutor()
return local_executor.run( repo_path = TestRun.usr.working_dir if from_dut else TestRun.usr.repo_dir
f"cd {TestRun.usr.repo_dir} &&"
return executor.run(
f"cd {repo_path} &&"
f'git show HEAD -s --pretty=format:"%H"').stdout f'git show HEAD -s --pretty=format:"%H"').stdout