From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566481907; cv=none; d=zoho.com; s=zohoarc; b=G8eQgZoNDQUFYVNXwviCcRk1oZQrhAn3JMR/YWQ+tnKxZShY17bEFFesSHN113no9OysNnwsrdfA512cKwB1Xt0HCUMfUxbiKl2Fu0RDMhG/YU7x4nh8WHpyU9XgFnsjNmil56buyf/uxzR6vxgAWvSWZRahYAw3bbyRCHkepAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566481907; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6YP/Mmmss+iHPzCvtEFM7dbrWJaTdts+5MjB0q+5nLM=; b=ZF3/pN8lWEu4TfO0KJ+PW4iSqjGMEYr3K+XZSzpEPGFhLXaqXmN9McExI5vauyPVKGfA2Ek7L7tPUE1D35Ljnmhwk8VkFD3utdseUqg6B3Pi6nKgRJMmgvJ1HD4uPwpFzSuE9/6Jl1vZBl3MT8dftvI3mgB9oxfkGdWZlNvI3sQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566481907951538.2397066399396; Thu, 22 Aug 2019 06:51:47 -0700 (PDT) Received: from localhost ([::1]:43304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nVB-00005T-OC for importer@patchew.org; Thu, 22 Aug 2019 09:51:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nRK-0006UL-O2 for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRJ-00061Z-Po for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:47:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRJ-000616-K1 for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:47:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E854611A06; Thu, 22 Aug 2019 13:47:44 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EAE060605; Thu, 22 Aug 2019 13:47:35 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:20 +0400 Message-Id: <20190822134725.32479-2-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 22 Aug 2019 13:47:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/6] docker.py: add --run-as-current-user X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , alex.bennee@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" (podman will need further tweaks) Suggested-by: Paolo Bonzini Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/docker/Makefile.include | 2 +- tests/docker/docker.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index dbd58e548c..582846a587 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -212,7 +212,7 @@ docker-run: docker-qemu-src " COPYING $(EXECUTABLE) to $(IMAGE)")) $(call quiet-command, \ $(DOCKER_SCRIPT) run \ - $(if $(NOUSER),,-u $(shell id -u)) \ + $(if $(NOUSER),,--run-as-current-user) \ --security-opt seccomp=3Dunconfined \ $(if $V,,--rm) \ $(if $(DEBUG),-ti,) \ diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 53a8c9c801..f15545aeea 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -333,8 +333,13 @@ class RunCommand(SubCommand): def args(self, parser): parser.add_argument("--keep", action=3D"store_true", help=3D"Don't remove image when command comple= tes") + parser.add_argument("--run-as-current-user", action=3D"store_true", + help=3D"Run container using the current user's= uid") =20 def run(self, args, argv): + if args.run_as_current_user: + uid =3D os.getuid() + argv =3D [ "-u", str(uid) ] + argv return Docker().run(argv, args.keep, quiet=3Dargs.quiet) =20 =20 --=20 2.23.0 From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566482060; cv=none; d=zoho.com; s=zohoarc; b=EN/gkrUIsskg79iqBtm4CQkG42JjfNVbiKRmPgRzOlmcpMZuZu8sEEfeXoP3kYmLtuM/QjfkHK5c1AZxDgymWILF/usQo7btdzFZE+3eHsE4b1PD4hC6PI2JPVuOsWDIoFF6EhWE6rUbh6xbWFOqWIoReHFs1yYelIJGEXlX1DU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566482060; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EWq/V5qfb5riYBShDxUO0GukWPY7Tb0nBstMSl2Qlw0=; b=loZ7CBfu6BZuStR9CX+QCr4IZQmOA9m9d37g2dwjxrbOM29uoHQrAhHbkDan1CG+pQ8R5SHbc0MtTMI6siG5Ix76Qkga3YXJK3rYfV/C94k0faq7SETcR749moffiTG/XTuZCA9rOxQEr8DG19XYq4xkbUWKOTiGHsxnr/3IRdc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566482060123961.7775225926088; Thu, 22 Aug 2019 06:54:20 -0700 (PDT) Received: from localhost ([::1]:43332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nXe-0004eu-HH for importer@patchew.org; Thu, 22 Aug 2019 09:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44992) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nRi-0006cR-0Q for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRg-0006Er-Ii for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60858) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRc-00068K-Ik for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E57107F767; Thu, 22 Aug 2019 13:47:55 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF6AC5D772; Thu, 22 Aug 2019 13:47:47 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:21 +0400 Message-Id: <20190822134725.32479-3-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 22 Aug 2019 13:47:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/6] docker.py: add podman support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , alex.bennee@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add a --engine option to select either docker, podman or auto. Among other advantages, podman allows to run rootless & daemonless containers, fortunately sharing compatible CLI with docker. With current podman, we have to use a uidmap trick in order to be able to rw-share the ccache directory with the container user. With a user 1000, the default mapping is: = = 1000 (host) -> = 0 (container). So write access to /var/tmp/ccache ends will end with permission denied error. With "--uidmap 1000:0:1 --uidmap 0:1:1000", the mapping is: 1000 (host) -> 0 (container, 1st namespace) -> 1000 (container, 2nd namespa= ce). (the rest is mumbo jumbo to avoid holes in the range of UIDs) A future podman version may have an option such as --userns-keep-uid. Thanks to Debarshi Ray for the help! Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Alex Benn=C3=A9e Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/docker/docker.py | 48 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index f15545aeea..ac5baab4ca 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -20,6 +20,7 @@ import hashlib import atexit import uuid import argparse +import enum import tempfile import re import signal @@ -38,6 +39,26 @@ FILTERED_ENV_NAMES =3D ['ftp_proxy', 'http_proxy', 'http= s_proxy'] =20 DEVNULL =3D open(os.devnull, 'wb') =20 +class EngineEnum(enum.IntEnum): + AUTO =3D 1 + DOCKER =3D 2 + PODMAN =3D 3 + + def __str__(self): + return self.name.lower() + + def __repr__(self): + return str(self) + + @staticmethod + def argparse(s): + try: + return EngineEnum[s.upper()] + except KeyError: + return s + + +USE_ENGINE =3D EngineEnum.AUTO =20 def _text_checksum(text): """Calculate a digest string unique to the text content""" @@ -48,9 +69,14 @@ def _file_checksum(filename): return _text_checksum(open(filename, 'rb').read()) =20 =20 -def _guess_docker_command(): - """ Guess a working docker command or raise exception if not found""" - commands =3D [["docker"], ["sudo", "-n", "docker"]] +def _guess_engine_command(): + """ Guess a working engine command or raise exception if not found""" + commands =3D [] + + if USE_ENGINE in [EngineEnum.AUTO, EngineEnum.PODMAN]: + commands +=3D [["podman"]] + if USE_ENGINE in [EngineEnum.AUTO, EngineEnum.DOCKER]: + commands +=3D [["docker"], ["sudo", "-n", "docker"]] for cmd in commands: try: # docker version will return the client details in stdout @@ -61,7 +87,7 @@ def _guess_docker_command(): except OSError: pass commands_txt =3D "\n".join([" " + " ".join(x) for x in commands]) - raise Exception("Cannot find working docker command. Tried:\n%s" % + raise Exception("Cannot find working engine command. Tried:\n%s" % commands_txt) =20 =20 @@ -190,7 +216,7 @@ def _dockerfile_preprocess(df): class Docker(object): """ Running Docker commands """ def __init__(self): - self._command =3D _guess_docker_command() + self._command =3D _guess_engine_command() self._instances =3D [] atexit.register(self._kill_instances) signal.signal(signal.SIGTERM, self._kill_instances) @@ -340,6 +366,11 @@ class RunCommand(SubCommand): if args.run_as_current_user: uid =3D os.getuid() argv =3D [ "-u", str(uid) ] + argv + docker =3D Docker() + if docker._command[0] =3D=3D "podman": + argv =3D [ "--uidmap", "%d:0:1" % uid, + "--uidmap", "0:1:%d" % uid, + "--uidmap", "%d:%d:64536" % (uid + 1, uid + 1)] += argv return Docker().run(argv, args.keep, quiet=3Dargs.quiet) =20 =20 @@ -507,6 +538,8 @@ class ProbeCommand(SubCommand): print("yes") elif docker._command[0] =3D=3D "sudo": print("sudo") + elif docker._command[0] =3D=3D "podman": + print("podman") except Exception: print("no") =20 @@ -602,9 +635,13 @@ class CheckCommand(SubCommand): =20 =20 def main(): + global USE_ENGINE + parser =3D argparse.ArgumentParser(description=3D"A Docker helper", usage=3D"%s ..." % os.path.basename(sys.argv[0])) + parser.add_argument("--engine", type=3DEngineEnum.argparse, choices=3D= list(EngineEnum), + help=3D"specify which container engine to use") subparsers =3D parser.add_subparsers(title=3D"subcommands", help=3DNon= e) for cls in SubCommand.__subclasses__(): cmd =3D cls() @@ -613,6 +650,7 @@ def main(): cmd.args(subp) subp.set_defaults(cmdobj=3Dcmd) args, argv =3D parser.parse_known_args() + USE_ENGINE =3D args.engine return args.cmdobj.run(args, argv) =20 =20 --=20 2.23.0 From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566481908; cv=none; d=zoho.com; s=zohoarc; b=ODQkc0F7qzuWMpNuEFq4hiJe5g2gsGqGrq0x65ItWr4JLCetq9ZUQQ+59Wx3qqAuN67Ith6+jtVYiCjFeEn7dvcQIw8B2gOIb2eS4Z6LHEQ+oMDEojC32PNQBvT2j93yu2aCqYYgkZrNufC6aQhhFY2l2PRp/7k858y7GOiUUGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566481908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YJe9ufy7fTqj+DMobnDiLQegbO7+WYlZfAzV88N/ZQ4=; b=ooJKNugNiQcmKZWps9zZoizRlKBIu2JM9ABrF9aUncetnVjfV70mfsGrMUX0UlIENhSOGQvS7vp3zmHCqdSVxlryP7GRMv7oKzuM2MC1L7V97SXom37oRBs4IsrVNNWydLexiIbyqkkWXWzpTjNFblhh+0V+e77UQb0V17j2odY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566481908992673.5332590808713; Thu, 22 Aug 2019 06:51:48 -0700 (PDT) Received: from localhost ([::1]:43306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nVB-00008A-9R for importer@patchew.org; Thu, 22 Aug 2019 09:51:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44998) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nRi-0006cY-5c for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRg-0006F4-Qv for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRg-0006D6-FG for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:08 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04AD11918642; Thu, 22 Aug 2019 13:48:05 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE3CF5D9E5; Thu, 22 Aug 2019 13:47:58 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:22 +0400 Message-Id: <20190822134725.32479-4-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Thu, 22 Aug 2019 13:48:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/6] tests/docker: add podman support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , alex.bennee@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Allow to specify the container engine to run with ENGINE variable. By default, ENGINE=3Dauto and will select either podman or docker. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Daniel P. Berrang=C3=A9 --- Makefile | 2 +- tests/docker/Makefile.include | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 574fedea6b..ae17a83067 100644 --- a/Makefile +++ b/Makefile @@ -1157,7 +1157,7 @@ endif @echo '' @echo 'Test targets:' @echo ' check - Run all tests (check-help for details)' - @echo ' docker - Help about targets running tests inside Docke= r containers' + @echo ' docker - Help about targets running tests inside conta= iners' @echo ' vm-help - Help about targets running tests inside VM' @echo '' @echo 'Documentation targets:' diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 582846a587..cf535cbd19 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -17,7 +17,9 @@ DOCKER_TESTS :=3D $(notdir $(shell \ =20 DOCKER_TOOLS :=3D travis =20 -DOCKER_SCRIPT=3D$(SRC_PATH)/tests/docker/docker.py +ENGINE :=3D auto + +DOCKER_SCRIPT=3D$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE) =20 TESTS ?=3D % IMAGES ?=3D % @@ -146,7 +148,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOC= KER_IMAGES) $(DOCKER_DEPR ) =20 docker: - @echo 'Build QEMU and run tests inside Docker containers' + @echo 'Build QEMU and run tests inside Docker or Podman containers' @echo @echo 'Available targets:' @echo @@ -193,6 +195,8 @@ endif @echo ' EXECUTABLE=3D Include executable in image.' @echo ' EXTRA_FILES=3D" [... ]"' @echo ' Include extra files in image.' + @echo ' ENGINE=3Dauto/docker/podman' + @echo ' Specify which container engine to run.' =20 # This rule if for directly running against an arbitrary docker target. # It is called by the expanded docker targets (e.g. make --=20 2.23.0 From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566481915; cv=none; d=zoho.com; s=zohoarc; b=Hydhp06MWI/mwWyKCZroHEN9uwILyxD3zxwuFkmr8MHU/Uyj6CXnsQH4jUVfxbjPgyFvgZcp5nWII2H+ZErHRtBwGc5TFTssyVqPyrAWRuVpC0PbzmCbvtzluCIXzZXhalAbcr2iqQBVW6fAaaYIeMr3X9Uv2SUoPluMzSNV37c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566481915; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=543yCvpMDe/tIWdIjoTt6eS7eUPhfyMmp+qsusNRa9Y=; b=SWgcvsUSHQ61uOlm37rcqI5jjqK8CaZg1n9HSb5nXYjDBsfVlUDSC5fbeVeAOUCXOvAAF70ieQJcS/3zWkXGwcUlJkjVRH/Wxm7m/eXDKyYNQrsjeN7zcQgr+OFeO4MTNZaYDPYUvbWDx2Ost8Ig1f32S+gvIc6/skAXCxW2cFA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566481915492250.74565221653427; Thu, 22 Aug 2019 06:51:55 -0700 (PDT) Received: from localhost ([::1]:43308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nVI-0000fU-EH for importer@patchew.org; Thu, 22 Aug 2019 09:51:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45079) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nRo-0006dl-RE for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRn-0006JR-0r for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRm-0006HO-Pd for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E93C211768A5; Thu, 22 Aug 2019 13:48:10 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0A85600CD; Thu, 22 Aug 2019 13:48:07 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:23 +0400 Message-Id: <20190822134725.32479-5-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 22 Aug 2019 13:48:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/6] tests: specify the address family when checking bind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" getaddrinfo() may succeed with PF_UNSPEC, but fail when more specific. (this allows to skip some tests that would fail under podman) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/socket-helpers.c | 17 +++++++++++++---- tests/socket-helpers.h | 11 ----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/socket-helpers.c b/tests/socket-helpers.c index 8112763f5b..19a51e887e 100644 --- a/tests/socket-helpers.c +++ b/tests/socket-helpers.c @@ -30,7 +30,16 @@ # define EAI_ADDRFAMILY 0 #endif =20 -int socket_can_bind_connect(const char *hostname) +/* + * @hostname: a DNS name or numeric IP address + * + * Check whether it is possible to bind & connect to ports + * on the DNS name or IP address @hostname. If an IP address + * is used, it must not be a wildcard address. + * + * Returns 0 on success, -1 on error with errno set + */ +static int socket_can_bind_connect(const char *hostname, int family) { int lfd =3D -1, cfd =3D -1, afd =3D -1; struct addrinfo ai, *res =3D NULL; @@ -44,7 +53,7 @@ int socket_can_bind_connect(const char *hostname) =20 memset(&ai, 0, sizeof(ai)); ai.ai_flags =3D AI_CANONNAME | AI_ADDRCONFIG; - ai.ai_family =3D AF_UNSPEC; + ai.ai_family =3D family; ai.ai_socktype =3D SOCK_STREAM; =20 /* lookup */ @@ -129,7 +138,7 @@ int socket_check_protocol_support(bool *has_ipv4, bool = *has_ipv6) { *has_ipv4 =3D *has_ipv6 =3D false; =20 - if (socket_can_bind_connect("127.0.0.1") < 0) { + if (socket_can_bind_connect("127.0.0.1", PF_INET) < 0) { if (errno !=3D EADDRNOTAVAIL) { return -1; } @@ -137,7 +146,7 @@ int socket_check_protocol_support(bool *has_ipv4, bool = *has_ipv6) *has_ipv4 =3D true; } =20 - if (socket_can_bind_connect("::1") < 0) { + if (socket_can_bind_connect("::1", PF_INET6) < 0) { if (errno !=3D EADDRNOTAVAIL) { return -1; } diff --git a/tests/socket-helpers.h b/tests/socket-helpers.h index 9de0e6b151..512a004811 100644 --- a/tests/socket-helpers.h +++ b/tests/socket-helpers.h @@ -20,17 +20,6 @@ #ifndef TESTS_SOCKET_HELPERS_H #define TESTS_SOCKET_HELPERS_H =20 -/* - * @hostname: a DNS name or numeric IP address - * - * Check whether it is possible to bind & connect to ports - * on the DNS name or IP address @hostname. If an IP address - * is used, it must not be a wildcard address. - * - * Returns 0 on success, -1 on error with errno set - */ -int socket_can_bind_connect(const char *hostname); - /* * @has_ipv4: set to true on return if IPv4 is available * @has_ipv6: set to true on return if IPv6 is available --=20 2.23.0 From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566482063; cv=none; d=zoho.com; s=zohoarc; b=RqPuZgAS2hj1Xc2sX9/0qT3HOK6jR1ayxmiwhNbWNP1Rxr8mOqMt2qNTB/AsnC2mxtibARIExneOBLmasVTGRVgHSc7O6g1J2a7ildgkErH5kASB+of2b4b7KHzrN36AQ1lslbLIrL4X/WboInkHXOWj9WpP25U7GOGxr6pyneI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566482063; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0Ped2RmnOGFQiTr554cpkT9gaXgEtoIqkkwMoqVKNrw=; b=MrvXusPTWvg9ilWxi/5i/N50X2/uOh5PHBTR/8QdhfGV5gHhA4kGOd74S216mpZws4VBYBO5YLPxSo6oVqi1cSedo/ekm+I3v8NQO8VPvdXMxMLUkQBKkOJKqZVuH8WUCnemMvLvCRA7caOIIKixsSzTovJJM2hSFjVzV0i6egA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566482063185408.66140095992614; Thu, 22 Aug 2019 06:54:23 -0700 (PDT) Received: from localhost ([::1]:43336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nXh-0004o4-RS for importer@patchew.org; Thu, 22 Aug 2019 09:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45106) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nRw-0006f0-Hd for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRu-0006NT-HG for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58940) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRs-0006Kn-8n for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 228DB308FC4E; Thu, 22 Aug 2019 13:48:17 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1DE27E41; Thu, 22 Aug 2019 13:48:13 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:24 +0400 Message-Id: <20190822134725.32479-6-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 22 Aug 2019 13:48:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/6] test-char: skip tcp tests if ipv4 check failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/Makefile.include | 2 +- tests/test-char.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 39bed753b3..49684fd4f4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -525,7 +525,7 @@ tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-ut= il-obj-y) tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom= -obj-y) tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-o= bj-y) =20 -tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(qtest-obj= -y) $(test-io-obj-y) $(chardev-obj-y) +tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(qtest-obj= -y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y) tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y) tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-b= lock-obj-y) diff --git a/tests/test-char.c b/tests/test-char.c index f9440cdcfd..2dde620afc 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -15,6 +15,7 @@ #include "io/channel-socket.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-sockets.h" +#include "socket-helpers.h" =20 static bool quit; =20 @@ -1356,11 +1357,17 @@ static void char_hotswap_test(void) =20 int main(int argc, char **argv) { + bool has_ipv4, has_ipv6; + qemu_init_main_loop(&error_abort); socket_init(); =20 g_test_init(&argc, &argv, NULL); =20 + if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) { + return -1; + } + module_call_init(MODULE_INIT_QOM); qemu_add_opts(&qemu_chardev_opts); =20 @@ -1438,10 +1445,12 @@ int main(int argc, char **argv) g_test_add_data_func("/char/socket/client/wait-conn-fdpass/" # name, \ &client6 ##name, char_socket_client_test) =20 - SOCKET_SERVER_TEST(tcp, &tcpaddr); - SOCKET_CLIENT_TEST(tcp, &tcpaddr); - g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr, - char_socket_server_two_clients_test); + if (has_ipv4) { + SOCKET_SERVER_TEST(tcp, &tcpaddr); + SOCKET_CLIENT_TEST(tcp, &tcpaddr); + g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpad= dr, + char_socket_server_two_clients_test); + } #ifndef WIN32 SOCKET_SERVER_TEST(unix, &unixaddr); SOCKET_CLIENT_TEST(unix, &unixaddr); --=20 2.23.0 From nobody Thu May 2 11:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566482059; cv=none; d=zoho.com; s=zohoarc; b=JRAY8rmMnO1RX4dGNBn0HBJBhcMNz0xuZ8Kzulso3d/n51jmFFehCokEutLyC2rS1HtKjPJKhNMFnOA0aCicO2ystK33kYZXmZOGaC/8cDMCcTTxhg46p1pxCHExTDIkmtUXef9krBvj1dRqnMqNUVHsW3yRV2VKrzMCXvpfBTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566482059; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0CiUfHbVouE/bNlW2x9bRhuB14LEYETwSy9Gnu5nEsg=; b=Jfhx+qdA0gsJ6qvSuHSnoHBQ0ApTgaP/5w7BTenB2QPoD4SBgZ06hGaevzSIZi0Hl6zRaH9L7ljMNJcJbt8ndXiG8olRF25sVZ/Y4hUZQskedu6y9Le1z0+FyukopmgT6TVcqizwph/LeV8X/dvVx2cVMyVKC7A3pyKot+iFO/0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566482059612955.8575985833935; Thu, 22 Aug 2019 06:54:19 -0700 (PDT) Received: from localhost ([::1]:43334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nXe-0004gk-5N for importer@patchew.org; Thu, 22 Aug 2019 09:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45127) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0nS2-0006fX-Ky for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0nRy-0006PR-EN for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33086) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0nRw-0006Ns-FL for qemu-devel@nongnu.org; Thu, 22 Aug 2019 09:48:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08B6D7F75D; Thu, 22 Aug 2019 13:48:23 +0000 (UTC) Received: from localhost (ovpn-116-85.phx2.redhat.com [10.3.116.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8E865DAAD; Thu, 22 Aug 2019 13:48:19 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 22 Aug 2019 17:47:25 +0400 Message-Id: <20190822134725.32479-7-marcandre.lureau@redhat.com> In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com> References: <20190822134725.32479-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 22 Aug 2019 13:48:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/6] test: skip tests if socket_check_protocol_support() failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Skip the tests if socket_check_protocol_support() failed, but do run g_test_run() to keep TAP harness happy. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/test-char.c | 4 +++- tests/test-io-channel-socket.c | 4 +++- tests/test-util-sockets.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test-char.c b/tests/test-char.c index 2dde620afc..b56e43c1eb 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -1365,7 +1365,8 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) { - return -1; + g_printerr("socket_check_protocol_support() failed\n"); + goto end; } =20 module_call_init(MODULE_INIT_QOM); @@ -1465,5 +1466,6 @@ int main(int argc, char **argv) g_test_add_func("/char/hotswap", char_hotswap_test); g_test_add_func("/char/websocket", char_websock_test); =20 +end: return g_test_run(); } diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index d2053c464c..d172f3070f 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -566,7 +566,8 @@ int main(int argc, char **argv) * with either IPv4 or IPv6 disabled. */ if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) { - return 1; + g_printerr("socket_check_protocol_support() failed\n"); + goto end; } =20 if (has_ipv4) { @@ -595,5 +596,6 @@ int main(int argc, char **argv) test_io_channel_unix_listen_cleanup); #endif /* _WIN32 */ =20 +end: return g_test_run(); } diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c index f1ebffee5a..e2a3a8a093 100644 --- a/tests/test-util-sockets.c +++ b/tests/test-util-sockets.c @@ -242,7 +242,8 @@ int main(int argc, char **argv) * with either IPv4 or IPv6 disabled. */ if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) { - return 1; + g_printerr("socket_check_protocol_support() failed\n"); + goto end; } =20 if (has_ipv4) { @@ -264,5 +265,6 @@ int main(int argc, char **argv) test_socket_fd_pass_num_nocli); } =20 +end: return g_test_run(); } --=20 2.23.0