From nobody Fri Nov 7 00:45:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544630950625248.96828668057844; Wed, 12 Dec 2018 08:09:10 -0800 (PST) Received: from localhost ([::1]:45795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX74P-0004fS-Cg for importer@patchew.org; Wed, 12 Dec 2018 11:09:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NA-0001Nu-4n for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000gx-8B for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:53236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000bq-S4 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m1so5560018wml.2 for ; Wed, 12 Dec 2018 07:24:16 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/r3irPmeT/Dx8CtevopC7eCNjCmc0UwQ5+AMiup/K1g=; b=SzyvtyLpJm1BG69HZipP73CtPSIuh2d3gvCtNduxNyEUMOWlhn9yAuMVULXmb+1ElA Pcyl5+EFv+SCFjW7BG2tiPaKBH2pCkXXHwg8Sd4Tg4TiUkAYKxvR1JwIbFkoy0nq7qzt B4blAzzEBnC14DmE09ntPbsdkAEHFXD9oBCXzSd0YIhsgOx73PSy+2wfUPtLlUWtpOLY eYAW9NGEx865qI6ydeRzX87GteZ7qy0OLZyPG9IbsN3sr6VtfzgPHmfprocvWEjpl42c EEfLaKNfQYL+1WtGdL+EwNjeO2gce8SeIEBxgmGS8xuWaPK1chQ6Wdnm9uRI6/crD6l3 V5zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/r3irPmeT/Dx8CtevopC7eCNjCmc0UwQ5+AMiup/K1g=; b=oILBXQ57l4p9MibOFCDIND+5dlV7Qt0OPX++gse038g8uhpkc08G1nWFTgWxV5/V87 hrZYwuJy6XypGptoMiPGyt1DAm6t/Y94ucO/qb+h3LJiehuIZxB8n5JKvrx/Xc9tNghF ac1U9W0E134KkM6CbWApWKgnUHRi7Snda2flMBVHBW8PiVX71vMntfE5TCaOW+9GOin6 /5wJ6g9giu4ghq6MNfwaAH7Izuq2tL+uPpR/7Os/X0EHds1sCkBAgdxy0Z1bSVzBMHkY kUqfLNuteSxsFkYEROwEI1fPLcmKcpwbAZ0QBK+RaQ0vl28VWKUvmPzut8VCfL4To6Ut knTQ== X-Gm-Message-State: AA+aEWadNuLLfnJjrzg2Y7lXI0RKiIqYQ/i0KLfvzPI31VcYZfLMIke6 7Zfoir+aL7jNzE1lxT0RBk7YpcwM X-Google-Smtp-Source: AFSGD/WeZWn99awBKqcSIPs9kPtD/i2VM4HFWly3mNe02JmvWpAapifDo0lOZDP4MqDAYnz5MB8P6w== X-Received: by 2002:a7b:c315:: with SMTP id k21mr6509125wmj.145.1544628255636; Wed, 12 Dec 2018 07:24:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:14 +0100 Message-Id: <1544628195-37728-54-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PULL 53/54] vhost-user-test: small changes to init_hugepagefs 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) After the conversion to qgraph, the equivalent of "main" will be in a constructor and will run even if the tests are not being requested. Therefore, it should not assert that init_hugepagefs succeeds and will be called when creating the TestServer. This patch changes the prototype of init_hugepagefs, this way the next patch looks nicer. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-14-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2e610d4..4e4765b 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -461,13 +461,19 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) g_mutex_unlock(&s->data_mutex); } =20 -static const char *init_hugepagefs(const char *path) +static const char *init_hugepagefs(void) { + const char *path =3D getenv("QTEST_HUGETLBFS_PATH"); struct statfs fs; int ret; =20 + if (!path) { + return NULL; + } + if (access(path, R_OK | W_OK | X_OK)) { g_test_message("access on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } =20 @@ -477,11 +483,13 @@ static const char *init_hugepagefs(const char *path) =20 if (ret !=3D 0) { g_test_message("statfs on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } =20 if (fs.f_type !=3D HUGETLBFS_MAGIC) { g_test_message("Warning: path not on HugeTLBFS: %s\n", path); + abort(); return NULL; } =20 @@ -974,7 +982,6 @@ static void test_multiqueue(void) =20 int main(int argc, char **argv) { - const char *hugefs; int ret; char template[] =3D "/tmp/vhost-test-XXXXXX"; =20 @@ -989,13 +996,7 @@ int main(int argc, char **argv) } g_assert(tmpfs); =20 - hugefs =3D getenv("QTEST_HUGETLBFS_PATH"); - if (hugefs) { - root =3D init_hugepagefs(hugefs); - g_assert(root); - } else { - root =3D tmpfs; - } + root =3D init_hugepagefs() ? : tmpfs; =20 if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", --=20 1.8.3.1