From nobody Wed Dec 18 16:21:46 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YCzTQ4FBpz5hY8w; Wed, 18 Dec 2024 16:21:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YCzTQ3n7Qz4Wwr; Wed, 18 Dec 2024 16:21:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734538906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OcAhHM2EgyedwOdRPxUovAtDbDoHDqVYCokIG7B/QS4=; b=wiJ9SY3CF81I1CxrvXgxgCfAROWhTRvgNNd6CJx2i/ODiUQjHQLsx5a9LVquWRNST/ueNu ZI1NmT1Yg2Jn2IxJ14MJ80fwSoc/+px0XsZeTofgFYcgVWmzZfc0j+X7Y7X6sOtDhsp26c Zwy9cKNIx3NodOT4dnuXaoaSd8ndvf4YQDPp5vINQD+cM4fIwGS8ju7eJcrpX7OLvWeAha MiTUTgDl7/hF390p5Z5Arg38P5FZCYo5rK7lQ85Z7t9WcYdGlvvJIisfLpB6bvu/xoT20W YhwwZXsZ3DRFaxisE1XLIPgqrIzi1V8Ii9DBVA+CsL7PwUrJzBim6ZWyjU/8DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734538906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OcAhHM2EgyedwOdRPxUovAtDbDoHDqVYCokIG7B/QS4=; b=ynSbLe7W6bf5/yUUOKV08QOj2jqvPngGqxh1hOlDwrqQ0Nei7lnI+WNsgWHq4zIPuEVPzV GRMW47gEfeqS82k5b3z8gUn4QziRGP5K2y/r5IbVEFtWy40RyPLYNtPdzyNhr8AMBxzm/w kTqABu2D1JKvaVO2BxCX+3LgNfSyokYIFGoOsEq9VSYemQ2IVUXf0NVDs2GCPaVF6QhYyO K1ISgOVOTyxzR46MjEqLYR9QX9bfOubK0wW66JVGTTdx+nbvMHg9QRjOgOqj2/NhGQF35f Z3qXyB6urVnAYQVRpqpew+ZRBqr3GbJcoh9LdMveYiRySBBn1Oywpv6uUl33zQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734538906; a=rsa-sha256; cv=none; b=hDS1pti7g7XxUT2LxI0Mgm14SlHq/sA6jfymvxxOJf7yEMxqjQ3OcW66GnfjxEJ1LCoAMJ jElsrBWNdJ1RXHeLVLc4LgidsM3FnGxG+/7l6ejID4LvAtjgUTsko9JM6E4yS5IBhsv2IY aBetqoUmSSC7g8Y5VLRlmLvYYlN4aHsmOWDP0lj0R4fQzQ0pd+wLHhvBVFH+liJ1x1ppn1 G3nedVBRCUGMJIqUhe4J+6ON/U5TajugDJR2BvLB924hy0RBjhjrrhdVtyr2gxQLHOwSwW CXtDUmWagzdTrzPJUHe/GB540ru7TeL2jfnkIzCQg17HCH48ZRytRucGr8c6mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YCzTQ3MpszG1w; Wed, 18 Dec 2024 16:21:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BIGLkj2015473; Wed, 18 Dec 2024 16:21:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BIGLkkC015470; Wed, 18 Dec 2024 16:21:46 GMT (envelope-from git) Date: Wed, 18 Dec 2024 16:21:46 GMT Message-Id: <202412181621.4BIGLkkC015470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: b18799757947 - main - fusefs: More accurately test the unique tokens in the test suite List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1879975794772ee51f0b4865753364c7d7626c3 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=b1879975794772ee51f0b4865753364c7d7626c3 commit b1879975794772ee51f0b4865753364c7d7626c3 Author: Alan Somers AuthorDate: 2024-12-18 01:38:05 +0000 Commit: Alan Somers CommitDate: 2024-12-18 16:21:35 +0000 fusefs: More accurately test the unique tokens in the test suite Every fuse ticket has a "unique" token. As the name implies, they're supposed to be unique. Previously the fusefs test suite verified their uniqueness by relying on the fact that they are also sequential. But they aren't guaranteed to be sequential. Enhance the tests by removing that convenient assumption. MFC after: 2 weeks Sponsored by: Axcient --- tests/sys/fs/fusefs/mockfs.cc | 15 ++++++--------- tests/sys/fs/fusefs/mockfs.hh | 6 ++++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index bd7bd1b663f9..023cecd0276f 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -421,6 +421,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, uint32_t kernel_minor_version, uint32_t max_write, bool async, bool noclusterr, unsigned time_gran, bool nointr, bool noatime, const char *fsname, const char *subtype) + : m_uniques(new std::unordered_set) { struct sigaction sa; struct iovec *iov = NULL; @@ -436,7 +437,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, m_pm = pm; m_time_gran = time_gran; m_quit = false; - m_last_unique = 0; + if (m_pm == KQ) m_kq = kqueue(); else @@ -738,14 +739,10 @@ void MockFS::audit_request(const mockfs_buf_in &in, ssize_t buflen) { default: FAIL() << "Unknown opcode " << in.header.opcode; } - /* - * Check that the ticket's unique value is sequential. Technically it - * doesn't need to be sequential, merely unique. But the current - * fusefs driver _does_ make it sequential, and that's easy to check - * for. - */ - if (in.header.unique != ++m_last_unique) - FAIL() << "Non-sequential unique value"; + /* Verify that the ticket's unique value is actually unique. */ + if (m_uniques->find(in.header.unique) != m_uniques->end()) + FAIL() << "Non-unique \"unique\" value"; + m_uniques->insert(in.header.unique); } void MockFS::init(uint32_t flags) { diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 958964f769d4..38efcd049a61 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -36,6 +36,8 @@ extern "C" { #include "fuse_kernel.h" } +#include + #include #define TIME_T_MAX (std::numeric_limits::max()) @@ -298,8 +300,8 @@ class MockFS { /* pid of the test process */ pid_t m_pid; - /* The unique value of the header of the last received operation */ - uint64_t m_last_unique; + /* Every "unique" value of a fuse ticket seen so far */ + std::unique_ptr> m_uniques; /* Method the daemon should use for I/O to and from /dev/fuse */ enum poll_method m_pm;