summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2017-11-07 17:34:13 +0100
committerPatrick Vacek <patrickvacek@gmail.com>2017-11-13 17:18:48 +0100
commit9d5ad230a7558ae9adea42ea69d633d489c6dec0 (patch)
treed9ea3ac3b86e98e826c833bb60aff84bcaa9d927 /lib
parent95e2f81a149142b67076a3132e1b00d9f64bd031 (diff)
downloadmeta-updater-9d5ad230a7558ae9adea42ea69d633d489c6dec0.tar.gz
Rough draft of a run-qemu-ota test.
Not very useful yet. Could be made into a function for the purpose of running arbitrary commands via SSH, for example. However, I had plenty of trouble even getting this far. Note that I created a softlink to qemucommand to get around the Python path issues in oe-selftest. I'm not sure if there's a better way to handle that, since manipulating the path is seemingly impossible.
Diffstat (limited to 'lib')
l---------lib/oeqa/selftest/qemucommand.py1
-rw-r--r--lib/oeqa/selftest/updater.py33
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/oeqa/selftest/qemucommand.py b/lib/oeqa/selftest/qemucommand.py
new file mode 120000
index 0000000..bc06dde
--- /dev/null
+++ b/lib/oeqa/selftest/qemucommand.py
@@ -0,0 +1 @@
../../../scripts/qemucommand.py \ No newline at end of file
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py
index e9048fd..4cdd1a2 100644
--- a/lib/oeqa/selftest/updater.py
+++ b/lib/oeqa/selftest/updater.py
@@ -4,6 +4,9 @@ import logging
4 4
5from oeqa.selftest.base import oeSelfTest 5from oeqa.selftest.base import oeSelfTest
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var 6from oeqa.utils.commands import runCmd, bitbake, get_bb_var
7import subprocess
8from oeqa.selftest.qemucommand import QemuCommand
9import time
7 10
8class UpdaterTests(oeSelfTest): 11class UpdaterTests(oeSelfTest):
9 12
@@ -39,3 +42,33 @@ class UpdaterTests(oeSelfTest):
39 def test_hsm(self): 42 def test_hsm(self):
40 self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') 43 self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"')
41 bitbake('core-image-minimal') 44 bitbake('core-image-minimal')
45
46 def test_qemu(self):
47 print('')
48 # Create empty object.
49 args = type('', (), {})()
50 args.imagename = 'core-image-minimal'
51 args.mac = None
52 args.dir = 'tmp/deploy/images'
53 args.efi = False
54 args.machine = None
55 args.no_kvm = False
56 args.no_gui = True
57 args.gdb = False
58 args.pcap = None
59 args.overlay = None
60 args.dry_run = False
61
62 qemu_command = QemuCommand(args)
63 cmdline = qemu_command.command_line()
64 print('Booting image with run-qemu-ota...')
65 s = subprocess.Popen(cmdline)
66 time.sleep(10)
67 print('Machine name (hostname) of device is:')
68 ssh_cmd = ['ssh', '-q', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@localhost', '-p', str(qemu_command.ssh_port), 'hostname']
69 s2 = subprocess.Popen(ssh_cmd)
70 time.sleep(5)
71 try:
72 s.terminate()
73 except KeyboardInterrupt:
74 pass