diff --git a/docker/opensuse-42.2/Dockerfile b/docker/opensuse-42.2/Dockerfile index ca084c5546..d06c32afad 100644 --- a/docker/opensuse-42.2/Dockerfile +++ b/docker/opensuse-42.2/Dockerfile @@ -10,7 +10,7 @@ RUN zypper --no-color --non-interactive ref -f && \ zypper --no-color --non-interactive install --no-recommends python gcc \ gcc-c++ git chrpath make wget python-xml diffstat makeinfo \ python-curses patch socat libSDL-devel tar which unzip \ - net-tools iproute2 vim netcat-openbsd \ + net-tools iproute2 vim \ python3-unittest-xml-reporting python3-six \ python3 python3-curses glibc-locale syslinux diff --git a/meta-refkit-core/lib/oeqa/selftest/cases/refkit_ostree.py b/meta-refkit-core/lib/oeqa/selftest/cases/refkit_ostree.py index 705bc8a27d..f82eca140d 100644 --- a/meta-refkit-core/lib/oeqa/selftest/cases/refkit_ostree.py +++ b/meta-refkit-core/lib/oeqa/selftest/cases/refkit_ostree.py @@ -1,6 +1,6 @@ from oeqa.selftest.systemupdate.systemupdatebase import SystemUpdateBase -from oeqa.utils.commands import runqemu, get_bb_var +from oeqa.utils.commands import runqemu, get_bb_vars, bitbake import errno import http.server @@ -26,6 +26,15 @@ class RefkitOSTreeUpdateBase(SystemUpdateBase): # slirp network. OSTREE_SERVER = '10.0.2.100:8080' + # Global variables are the same for all recipes, + # but RECIPE_SYSROOT_NATIVE is specific to socat-native. + BB_VARS = get_bb_vars([ + 'DEPLOY_DIR', + 'MACHINE', + 'RECIPE_SYSROOT_NATIVE', + ], + 'socat-native') + def track_for_cleanup(self, name): """ Run a single test with NO_CLEANUP= oe-selftest to not clean up after the test. @@ -47,7 +56,7 @@ def boot_image(self, overrides): self.track_for_cleanup(self.ostree_netcat.name) qemuboot_conf = os.path.join(self.image_dir_test, - '%s-%s.qemuboot.conf' % (self.IMAGE_PN, get_bb_var('MACHINE'))) + '%s-%s.qemuboot.conf' % (self.IMAGE_PN, self.BB_VARS['MACHINE'])) with open(qemuboot_conf) as f: conf = f.read() with open(qemuboot_conf, 'w') as f: @@ -66,7 +75,7 @@ def update_image(self, qemu): # image here, so we just assume that it is in the usual place. # For the sake of simplicity we change into that directory # because then we can use SimpleHTTPRequestHandler. - ostree_repo = os.path.join(get_bb_var('DEPLOY_DIR'), 'ostree-repo') + ostree_repo = os.path.join(self.BB_VARS['DEPLOY_DIR'], 'ostree-repo') old_cwd = os.getcwd() server = None try: @@ -93,11 +102,16 @@ def create_httpd(): self.logger.info('serving OSTree repo %s on port %d' % (ostree_repo, port)) helper = threading.Thread(name='OSTree HTTPD', target=server.serve_forever) helper.start() + # netcat can't be assumed to be present. Build and use socat instead. + # It's a bit more complicated but has the advantage that it is in OE-core. + socat = os.path.join(self.BB_VARS['RECIPE_SYSROOT_NATIVE'], 'usr', 'bin', 'socat') + if not os.path.exists(socat): + bitbake('socat-native:do_addto_recipe_sysroot', output_log=self.logger) + self.assertExists(socat, 'socat-native was not built as expected') with open(self.ostree_netcat.name, 'w') as f: f.write('''#!/bin/sh -exec netcat 2>>/tmp/ostree.log localhost 9999 -#exec socat 2>>/tmp/ostree.log -D -v -d -d -d -d STDIO TCP:localhost:%d -''' % port) +exec %s 2>>/tmp/ostree.log -D -v -d -d -d -d STDIO TCP:localhost:%d +''' % (socat, port)) cmd = '''ostree config set 'remote "updates".url' http://%s && refkit-ostree update''' % self.OSTREE_SERVER status, output = qemu.run_serial(cmd, timeout=600)