From nobody Tue Apr 30 13:19:34 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=1563028462; cv=none; d=zoho.com; s=zohoarc; b=fflAAAWDJ6iAR8DjVzYNaIpfjcF0ZPLeQDmyc5Q/5c91ByZu+1z6sfrmHMybn9upKU1cEqXO+hP6sClP34ebCRM9MReKdlu0qu6P95kzIc+V/YUicOdBUsMO6w33JXeUihi6kLJp7dmyOMDkerc+Cfav7fQSPtpJZZuIFJNDVWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028462; 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=P3JV4+t/wp934NrPKjH1MvwSMBsuJOa7EsOK5xiVPL0=; b=C8gkl69tEpkRRFxf7qpmP2tmR5m1W87o8lDCmAUAt0tcFdTdrCxsaub+bH4YDCnCjeO9G8hcmXf34+uB0H7hJQtA1n0goMwGorAi3LRhZtFb3DOV0NZP17HtA20TdHs+IRlsbgMfWm8aSC1raXutu/z9vS1rr/A2fEA/b/DK3s4= 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 1563028462262918.8740404659097; Sat, 13 Jul 2019 07:34:22 -0700 (PDT) Received: from localhost ([::1]:56576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6Q-0000VP-Pf for importer@patchew.org; Sat, 13 Jul 2019 10:34:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46537) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ65-0008AT-Tb for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:33:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ64-0006xm-Ri for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:33:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ64-0006bK-Lo for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:33:56 -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 5DD5E85376; Sat, 13 Jul 2019 14:33:36 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB82E19699; Sat, 13 Jul 2019 14:33:28 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:06 +0400 Message-Id: <20190713143311.17620-2-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-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.25]); Sat, 13 Jul 2019 14:33:36 +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] [PATCH v3 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 , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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: Alex Benn=C3=A9e Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=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 aaf5396b85..f4226b79d0 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.22.0.428.g6d5b264208 From nobody Tue Apr 30 13:19:34 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=1563028465; cv=none; d=zoho.com; s=zohoarc; b=Swzjx4CeBUXICwR5iFr0yJIZMa1k2akuCKTbSpNjDa0M7grlrP81wM4Ro/jHHhQpbdhsl/jyB6imaGTMWMF6nxBkT2/iMlRh+5y9U9s6eH60H6wiMc8GcpdiQdTKPptuVxWtVWvNSCdTW9tmQIDbuJBX/ewHimWNCutONhpRIuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028465; 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=eiiXwkNd4K240gQPar1QZgN6/5dUY97Z9Q9JN96Vzkc=; b=QgCwUSKKRYszjqhCyyyA9fPPUyP1eut+owG/WWg/9njPjNLEAB9n6nPz+VF+sjgG2fdHhXPdtVtq7CoaD6OOsaEzQMxNkVaXD84ovgzqIqaeaKbA0FT3Eg8o1BwsiIuo8XhOfhPf7VTtO8ioKNcrRyzh+R1DK6bNZGkZW2Gj9xc= 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 1563028465438409.8495957143698; Sat, 13 Jul 2019 07:34:25 -0700 (PDT) Received: from localhost ([::1]:56578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6R-0000d0-UN for importer@patchew.org; Sat, 13 Jul 2019 10:34:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46551) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ66-0008AW-MU for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ64-0006xs-SZ for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:33:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37888) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ64-0006mG-KV for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:33:56 -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 E46CA3086227; Sat, 13 Jul 2019 14:33:49 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB9F96012C; Sat, 13 Jul 2019 14:33:41 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:07 +0400 Message-Id: <20190713143311.17620-3-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-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.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 13 Jul 2019 14:33:49 +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] [PATCH v3 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 , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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.22.0.428.g6d5b264208 From nobody Tue Apr 30 13:19:34 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=1563028508; cv=none; d=zoho.com; s=zohoarc; b=maP8IwoPK7HDECGwLOzmyQMCnYBEd8cmHA7XwtPPSVVfqiZ8NVN/9pPS6zXICKdzcm0V8H6rgoW/IfGTr6tzImdG+MHWbMniWJ722CVPWfh8r506GHGX/WdABgnRl6mYRFJyj2/W1c0a3ppguj0Bj146vhEg09G2S/beuldQnt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028508; 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=o8s+2axecYUTZMHX6usAkgQtF9ROnTGmt9BF1gr5VOk=; b=PgL1xDWpcx03c3qBqFjokcAjRwf9MwOU6LsZFgEXipy+CPl4/fNecIWt4sTSCA+la70dxM1xbqPEUt5gZ2ryDysCgFBKTqQWYGChLlD+8HpNDHdNYFNgGHXVL9IxJRdPLhaDc6WxpmSS5GOAh7PKXa+GxgbGN6XbhFJ4YZm93X4= 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 1563028508952559.417186414551; Sat, 13 Jul 2019 07:35:08 -0700 (PDT) Received: from localhost ([::1]:56594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ7D-0003Dz-MU for importer@patchew.org; Sat, 13 Jul 2019 10:35:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46625) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6B-0008NZ-9h for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ69-000770-U6 for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ69-000762-Mq for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:01 -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 01A323001808; Sat, 13 Jul 2019 14:34:01 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8C375D721; Sat, 13 Jul 2019 14:33:53 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:08 +0400 Message-Id: <20190713143311.17620-4-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-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.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 13 Jul 2019 14:34:01 +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] [PATCH v3 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 , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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 1fcbaed62c..7863bb0cf5 100644 --- a/Makefile +++ b/Makefile @@ -1153,7 +1153,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 f4226b79d0..3c1aec862a 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.22.0.428.g6d5b264208 From nobody Tue Apr 30 13:19:34 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=1563028526; cv=none; d=zoho.com; s=zohoarc; b=BsNYmlerL0LFz+jlrM3xsookxMo68qeYvV7TCFm+OjTPIieNn2brop528zr8lm0rL59a399ibiAiCAWmvgeTuWFjT0DFKRNxW8H+Uc5G+Gcq8V0S4c2TaEJc4dh/8QKNBQfn3S52jS4t+j6kg8Hoo8QgUqLyulkIxQcezLsrQ+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028526; 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=uXS3BR9Rn6Yvw1AbJgI1hfNrsbVUkT8UYf6+bS2kb18=; b=mc8UUgPxhvDJ4RA188WmRMc+rj/uXYWjgesiXpvPeDfXyAmo21DctFN7RRRZ0rypBXo9jmSirMUz0V7joWUFH5+CaBVIcFLT8MhYnpC9IOrmQt3Fjd0Mt3PZHNP8LJcPZXq588qs3DB3Bwjbh2dfaSpqcCVAzBRTI2DMrFZS+es= 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 156302852607422.737221382923508; Sat, 13 Jul 2019 07:35:26 -0700 (PDT) Received: from localhost ([::1]:56608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ7V-0004ix-52 for importer@patchew.org; Sat, 13 Jul 2019 10:35:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46722) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6N-0000gt-L4 for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ6M-0007QV-If for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ6M-0007Px-Ay for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A00A03091782; Sat, 13 Jul 2019 14:34:13 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 905B460C67; Sat, 13 Jul 2019 14:34:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:09 +0400 Message-Id: <20190713143311.17620-5-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sat, 13 Jul 2019 14:34:13 +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] [PATCH v3 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: Fam Zheng , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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.22.0.428.g6d5b264208 From nobody Tue Apr 30 13:19:34 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=1563028489; cv=none; d=zoho.com; s=zohoarc; b=SqSPqekfxk9bicpofIRj5WZz9vUdl8lsYHGkymR8I/+o/SCaWE0zUqYBewxpMrC9rXo9ylT2FdyHPBDadyF+GXtfdiL3n49qcyXB2pV54voay4RzE1Fo7XrIW3h+d5WHcbLozgnJEktQD7mr++01Lz+shhaen0l6bKN2LMS+xus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028489; 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=fSbDDE7m21CbH0OyBHO4rU76OmP6KemddYGsZF9SU8A=; b=lrqTeF8sorGuOaCfAK2p/syQA+AiQAhxFJv2uUpJQoHEZqW3+90Hgy4ViS98QZIOPEbxEJHE9m20XMJfKKGgtrX6TDsEPlmbIEim7ABlAWBAx7i+jloPSj1+/v/iDQejvBVwtZKPyuwQqA73aQi1/ky7lRgj/97DKwiav7mI1og= 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 1563028489603872.0683727336046; Sat, 13 Jul 2019 07:34:49 -0700 (PDT) Received: from localhost ([::1]:56588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6u-00026K-6b for importer@patchew.org; Sat, 13 Jul 2019 10:34:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46779) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6b-0001Tk-28 for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ6Z-0007cJ-Lq for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ6Z-0007aW-Dz for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:27 -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 819F5C057F4F; Sat, 13 Jul 2019 14:34:26 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4603A5D968; Sat, 13 Jul 2019 14:34:17 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:10 +0400 Message-Id: <20190713143311.17620-6-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-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.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 13 Jul 2019 14:34:26 +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] [PATCH v3 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: Fam Zheng , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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 a983dd32da..2bddebaf4b 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -523,7 +523,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.22.0.428.g6d5b264208 From nobody Tue Apr 30 13:19:34 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=1563028511; cv=none; d=zoho.com; s=zohoarc; b=MBHvs60Nowv9zsYboEWxBRQ9lx9m+Y9GXI55xO8P7V7eo8GOU96cUZawalSfyU+I0P7BXI/Mdr5iwUYP3uHCC1e9JgKPeZ6SWXSZn3NKPwmeVOzB88kgm13BJu2yX4JGvJMNEhsEPUsIQipbTih09opibrTwfjehkwALoRDQ1iM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563028511; 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=LD+ntom+xfOT7IexYPj81WC0aMowEWDYMoM6hRv7nUQ=; b=h7Q0Omkn0oBaOz2xVj7y/WwEXY+XVmYPa15CXlbEB21ZXn2aosjDNGL1sDxeeGREHw81NzHTLGhBWoHqJZ58RxEYY8kErslZOfq+GyHoHAB714LETgGGy6HZzbMl/XwNxMqkYAIv597hAQoYY0Fpa49I7h1NmJ6F5wqNNA1lNV4= 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 1563028511834682.4197389375098; Sat, 13 Jul 2019 07:35:11 -0700 (PDT) Received: from localhost ([::1]:56600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ7G-0003Ua-BC for importer@patchew.org; Sat, 13 Jul 2019 10:35:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46830) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmJ6m-000277-RR for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmJ6l-0007nK-Qf for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33996) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmJ6l-0007mE-HO for qemu-devel@nongnu.org; Sat, 13 Jul 2019 10:34:39 -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 DC80F3082E57; Sat, 13 Jul 2019 14:34:38 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CF83196E5; Sat, 13 Jul 2019 14:34:30 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Sat, 13 Jul 2019 18:33:11 +0400 Message-Id: <20190713143311.17620-7-marcandre.lureau@redhat.com> In-Reply-To: <20190713143311.17620-1-marcandre.lureau@redhat.com> References: <20190713143311.17620-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.46]); Sat, 13 Jul 2019 14:34:38 +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] [PATCH v3 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: Fam Zheng , berrange@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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 --- 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.22.0.428.g6d5b264208