From nobody Fri Nov 7 14:42:20 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548094311122297.53629953439633; Mon, 21 Jan 2019 10:11:51 -0800 (PST) Received: from localhost ([127.0.0.1]:57421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gle2x-0008O4-Ol for importer@patchew.org; Mon, 21 Jan 2019 13:11:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gldy4-0004JW-Kn for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gldy3-00046O-Hi for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:40 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:36531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gldy3-000452-9j for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:39 -0500 Received: by mail-wr1-x435.google.com with SMTP id u4so24487904wrp.3 for ; Mon, 21 Jan 2019 10:06:39 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 133sm56197732wme.9.2019.01.21.10.06.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jan 2019 10:06:37 -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=AenEjm+4RYn656X+TjWzddNMCHS4MsbcZ7LsVuW2WlA=; b=bMI6oIcAXAiclrUjo+Q1eyg7uTzBI/mptn7a26M/hK+vcCjvNehg6eQxaf4lxiFdPy PsEUrUvh0c064m0y1G6WRcGZFmBeINzno+UbK1GYf5+m65YUHXgKHWqi63LARswQjlHC zAPHf+PssvS3FSkSXYt/mkuNc6yvZYPYW7X4EA5DsvlvZMAXid637MtzmQ9P9xh4U5rU uYjpl6keHtFaw+oriYwmzR0/iLHblt7ld2te5xhZeSGkT8WWs84MjND0VbXNe7t+ROII j+x/iangvmoHz/vXHtcoparupO7doVrXtTdFHwBM2xt7KC0lhAvBDSxTiodGwpCYPH+U UMRQ== 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=AenEjm+4RYn656X+TjWzddNMCHS4MsbcZ7LsVuW2WlA=; b=C0meQoo0IWZXNeTTEW4wq6bPQhmeAnbLgGLFZywwQN4tK28DhGkhssyJBTB07av79j 4nijpqs9JtEg+m4tlULKVTcVtOk7aVYitW4sLZR33iBiPrMs14xGq1Dq7owlZlUtRk1r 3GUxpo2pnahQtbHDnIM/d7yS8pQjK21KeszUcJm+PZ6b0lRHshQgqxQQ+dIO+Qg0sMWQ wRe4gBQVjGm1408M+8JsvygltEy1XCur4E+eKIq4H1lVrkAcH2WXRf6dZEmzjJlBu2E2 Zw9cPm4eNLEe7D3hLgtOaZo67nIZdvwNjAYYa9koWzQ/wAkgZ/CYpzSBC34RPBGIAU1J uG0g== X-Gm-Message-State: AJcUukeVQ69VNU9FoXu35tU833XuFmX1MvwihTO4yniGGSlsm/seA+M7 CAt8zkYxK2WcfvbnuLr3yPpwvF/J X-Google-Smtp-Source: ALg8bN48RDmH8gcRFFBAfN2tiDFOKkQOrFM7Y4t1fcD+FJrcUBy728UP+Syos8r1RGSD1e6PuQf+pw== X-Received: by 2002:adf:f605:: with SMTP id t5mr27580203wrp.229.1548093997998; Mon, 21 Jan 2019 10:06:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Jan 2019 19:05:46 +0100 Message-Id: <1548093980-43088-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> References: <1548093980-43088-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::435 Subject: [Qemu-devel] [PULL 15/49] 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 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6aa62ac..a02f107 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -464,14 +464,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 @@ -481,17 +487,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) { @@ -978,7 +988,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 @@ -993,14 +1002,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