From patchwork Fri Jul 21 03:47:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 791884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xDGxp6WzQz9sNw for ; Fri, 21 Jul 2017 13:50:22 +1000 (AEST) Received: from localhost ([::1]:40873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYOxI-0005Pc-J8 for incoming@patchwork.ozlabs.org; Thu, 20 Jul 2017 23:50:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYOvG-00047I-VG for qemu-devel@nongnu.org; Thu, 20 Jul 2017 23:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYOvG-0002ZM-7f for qemu-devel@nongnu.org; Thu, 20 Jul 2017 23:48:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42816) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYOvB-0002Wl-He; Thu, 20 Jul 2017 23:48:09 -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 6F4B8C0587F6; Fri, 21 Jul 2017 03:48:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6F4B8C0587F6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=crosa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6F4B8C0587F6 Received: from localhost.localdomain.com (ovpn-120-26.rdu2.redhat.com [10.10.120.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9813260178; Fri, 21 Jul 2017 03:48:07 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 23:47:29 -0400 Message-Id: <20170721034730.25612-3-crosa@redhat.com> In-Reply-To: <20170721034730.25612-1-crosa@redhat.com> References: <20170721034730.25612-1-crosa@redhat.com> 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.32]); Fri, 21 Jul 2017 03:48:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/3] qemu-iotests: add _require_feature() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Jing Liu , Max Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" With the previously introduced buildconf.py script, it's possible to determine if a feature needed by a test is present or not. This adds a thin layer on top of scripts/buildconf.py, and allows tests to be skipped when a feature is required. The naming of the function, while different in tense from the _supported_* family of functions, was chosen to match the style of _require_command(), which seems pretty similar. Signed-off-by: Cleber Rosa --- tests/qemu-iotests/check | 2 ++ tests/qemu-iotests/common.rc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 2a55ec9..c0f4004 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -60,6 +60,8 @@ fi build_root="$build_iotests/../.." +export BUILDCONF="$build_root/scripts/buildconf.py" + if [ -x "$build_iotests/socket_scm_helper" ] then export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper" diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 2548e58..19b3111 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -470,6 +470,13 @@ _require_command() [ -x "$c" ] || _notrun "$1 utility required, skipped this test" } +# tests whether a given configure time feature is enabled +# +_require_feature() +{ + $BUILDCONF -c -n $1 || _notrun "feature not enabled: $1" +} + _full_imgfmt_details() { if [ -n "$IMGOPTS" ]; then