diff --git a/psdk-test/psdk-test b/psdk-test/psdk-test index fa0554e63706094ef247ae4ad15ff9f09759cc89..0badf801bc0f8b8db4b66e984b3c0c52b23a5ccd 100755 --- a/psdk-test/psdk-test +++ b/psdk-test/psdk-test @@ -23,6 +23,7 @@ from psdk_commands import PsdkCommands from argparse import ArgumentParser +from pathlib import Path import os.path @@ -55,9 +56,8 @@ class PsdkTest(object): def __init__(self, test_type, image_release, image_path, debug): self.test_type = test_type self.release = image_release - self.image_path = image_path - self.pdisk_path = os.path.join(os.path.dirname(image_path), - "test-sdk-persistent-disk.vdi") + self.image_path = str(image_path) + self.pdisk_path = str(image_path.parent / "test-sdk-persistent-disk.vdi") self.old_sdk = "apertis-psdk-test-old-sdk" self.new_sdk = "apertis-psdk-test-new-sdk" self.user_test_file = "psdk_test_file" @@ -166,7 +166,8 @@ if __name__ == '__main__': args = parser.parse_args() - if not os.path.isfile(args.IMAGE_PATH): + image_path = Path(args.IMAGE_PATH) + if not image_path.exists(): print("File %s does not exist" % args.IMAGE_PATH) print("Please pass a valid SDK image path") exit(1) @@ -177,7 +178,7 @@ if __name__ == '__main__': print("Image: " + args.IMAGE_PATH) print() - psdk_test = PsdkTest(args.TEST_TYPE, args.IMAGE_RELEASE, args.IMAGE_PATH, + psdk_test = PsdkTest(args.TEST_TYPE, args.IMAGE_RELEASE, image_path, args.debug) try: while True: diff --git a/psdk-test/psdk_commands.py b/psdk-test/psdk_commands.py index f3d072c7142ced00a4adb1f520716892055b69e1..a65984124dcd9f2ca5cd6658b58a612a8d3a0158 100644 --- a/psdk-test/psdk_commands.py +++ b/psdk-test/psdk_commands.py @@ -51,7 +51,7 @@ class PsdkCommands(object): else: _run_command(cmd, ssh, output) - def _ssh(self, lst=[], copy_id=False, copy_file=False): + def _ssh(self, lst=[], copy_file=False): ssh_opts = [ "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "LogLevel=ERROR" ] @@ -59,8 +59,7 @@ class PsdkCommands(object): return [ "scp", "-i", self.ssh_id_file, "-P", self.local_port ] + ssh_opts + lst else: - cmd = "ssh-copy-id" if copy_id else "ssh" - return [ cmd, self.local_host, "-i", self.ssh_id_file, "-p", + return [ "ssh", self.local_host, "-i", self.ssh_id_file, "-p", self.local_port ] + ssh_opts + lst def create_vm(self, vm): @@ -133,7 +132,8 @@ class PsdkCommands(object): self._run([ self.vbox_manage, "unregistervm", vm, "--delete" ]) def copy_ssh_key(self): - self._run(self._ssh(copy_id=True), ssh=True) + kdir = (self.local_host + ":/home/user/.ssh/") + self._run(self._ssh(["-rp", "ssh/", kdir], copy_file=True), ssh=True) def clean(self): print("Cleaning environment ...") diff --git a/psdk-test/ssh/authorized_keys b/psdk-test/ssh/authorized_keys new file mode 100644 index 0000000000000000000000000000000000000000..6cb48e83df63424d5cfd6f730a16701a5ca788d4 --- /dev/null +++ b/psdk-test/ssh/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEJw7Nz6/jghVPCZa+8MFTajN4vUZh3aukPeonmlp6RYwIvnnDBWBxBQpRyhfRsNDAMsSvmmH4AL9eaEbCNUgMQbw2oYKup28Qe65gizyfnJE69fuxZ++XCHemvbE7s9II/V1LxGSH2wkjliM0/uKHXzZap2pJdwbWwDm/vQAVLUNR/kYiMUg50niRKZsfUSvLF5m6CzcsH8ElbVegv+g96Eo+5+tIWO9E2PtMixcjLIJRNStU2Z2+OD6o1FZtK4gEPCUODCcjxYpYBDdGh6OdXINCShZdQwOrsfPPVCSknN4wxVedHeU6M+N8y4q3SBPsznY4nHr0+ghro+EM2PvF user@apertis