From nobody Tue Feb 10 02:49:31 2026 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; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155016654822443.326268224603496; Thu, 14 Feb 2019 09:49:08 -0800 (PST) Received: from localhost ([127.0.0.1]:52373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guL8C-0004ur-6j for importer@patchew.org; Thu, 14 Feb 2019 12:49:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guL4K-0002Xb-2c for qemu-devel@nongnu.org; Thu, 14 Feb 2019 12:45:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guKvi-0003RN-HL for qemu-devel@nongnu.org; Thu, 14 Feb 2019 12:36:12 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:33243) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guKvg-0003Ng-HV for qemu-devel@nongnu.org; Thu, 14 Feb 2019 12:36:10 -0500 Received: by mail-wr1-x42a.google.com with SMTP id i12so7455823wrw.0 for ; Thu, 14 Feb 2019 09:36:08 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id s3sm1906796wmj.23.2019.02.14.09.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 09:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vUxuauqDnOrbhRqiE8T41LmhF60yntDSpw9qcKEJX10=; b=u8Mt5ykMRuIqWQ2SJJytGOEdzrmitD+PiXsOlx5n46BrwBAzp4gUhiwePUl4Jo2bc0 Y4Ow8w1oqFfbdWNAqll7ZZSTA25BDkF5lT0CrGqX5NLfbQ4e9Q3SGxkfNxSokAKk9EDA 0CJk5B5vuaZLs67cIZeDNR7WFsDqzdRVIJf792BxwHPbUYoJxQg2OvwA1KVQzSE4J2Mx Xdx2GZhQixi+Yhple4JAmXP7GZ1tintSUXdhhfQP/HFlmulI7PgZTGFuN+RpqdiDnxLH qrOj/DnHCfQAh1OrWOarwFGk2gyoDdIFeBvtePK5Owa3VljxV27nbQMhZ4ZgI7qEzfM1 TxCg== 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:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vUxuauqDnOrbhRqiE8T41LmhF60yntDSpw9qcKEJX10=; b=Xrk7w6T8UTQTij8k2zmyVN9p6hHUqKKECQ8kM2xVh8E0AjF3LZ5o1+FJEvQ7rCKhgZ wIz16UWoGMRxLIOHU+5tsCXWqsW14CI9RrCAMTZrXYJS+Ujm5VaMXtKRuxLNhhZvuIqG C3kwaL9SHUSFuhOSSAoUyoRSGZeoip7dC873yu7WZ/IZT5Ce3YPc14kcf/o1TF21v6pt F9eyt3CkqXtNWSdpNUmGacRllsA9jcNKBRfTjd8X9ttUyCjxS+yuhLjTaaVJTKo3a53h 3rFGkKDjWfRYj5K7J0HGyNrs82w9/x4d9D7MFaYaY2CgzQs3kejZEobxGdmvp3EoGUQe tIFw== X-Gm-Message-State: AHQUAubiBAm9kfoaqeH6MBYSTTCznmiergxrbDQHRWTeZnD7iQloJR7W HewvsyecFokW4kByOwZ3yATFaorn X-Google-Smtp-Source: AHgI3IaeZr+8hVWsr6Yr+XEkcDQIvhCCshTflvn+fjGdQqIoFMWCNoOenooOHcleAqEaWT/+AgHTDg== X-Received: by 2002:a5d:4bc7:: with SMTP id l7mr3643234wrt.242.1550165766638; Thu, 14 Feb 2019 09:36:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 18:35:55 +0100 Message-Id: <1550165756-21617-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550165756-21617-1-git-send-email-pbonzini@redhat.com> References: <1550165756-21617-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::42a Subject: [Qemu-devel] [PATCH 8/9] 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: , Cc: thuth@redhat.com, mst@redhat.com 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> Reviewed-by: Thomas Huth --- tests/vhost-user-test.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 33030e0..516e31c 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -465,14 +465,20 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) g_mutex_unlock(&s->data_mutex); } =20 -#ifdef CONFIG_LINUX -static const char *init_hugepagefs(const char *path) +static const char *init_hugepagefs(void) { +#ifdef CONFIG_LINUX + 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 @@ -482,17 +488,21 @@ 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 return path; -} +#else + return NULL; #endif +} =20 static TestServer *test_server_new(const gchar *name) { @@ -986,7 +996,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 @@ -1001,14 +1010,7 @@ int main(int argc, char **argv) } g_assert(tmpfs); =20 - root =3D tmpfs; -#ifdef CONFIG_LINUX - hugefs =3D getenv("QTEST_HUGETLBFS_PATH"); - if (hugefs) { - root =3D init_hugepagefs(hugefs); - g_assert(root); - } -#endif + 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