From owner-svn-src-projects@freebsd.org Wed Jun 26 19:10:40 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 042D915CFB2E for ; Wed, 26 Jun 2019 19:10:40 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95E7C83D2B; Wed, 26 Jun 2019 19:10:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72300428B; Wed, 26 Jun 2019 19:10:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QJAda4031590; Wed, 26 Jun 2019 19:10:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QJAd7b031589; Wed, 26 Jun 2019 19:10:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906261910.x5QJAd7b031589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Jun 2019 19:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r349436 - projects/fuse2/tests/sys/fs/fusefs X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: projects/fuse2/tests/sys/fs/fusefs X-SVN-Commit-Revision: 349436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 95E7C83D2B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 19:10:40 -0000 Author: asomers Date: Wed Jun 26 19:10:39 2019 New Revision: 349436 URL: https://svnweb.freebsd.org/changeset/base/349436 Log: fusefs: run the io tests with direct io, too Now the io tests are run in all cache modes. The fusefs test suite can now get adequate coverage without changing the value of vfs.fusefs.data_cache_mode, which is only needed for legacy file systems now. Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/tests/sys/fs/fusefs/io.cc Modified: projects/fuse2/tests/sys/fs/fusefs/io.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/io.cc Wed Jun 26 17:42:47 2019 (r349435) +++ projects/fuse2/tests/sys/fs/fusefs/io.cc Wed Jun 26 19:10:39 2019 (r349436) @@ -51,6 +51,28 @@ extern "C" { using namespace testing; +enum cache_mode { + Uncached, + Writethrough, + Writeback, + WritebackAsync +}; + +const char *cache_mode_to_s(enum cache_mode cm) { + switch (cm) { + case Uncached: + return "Uncached"; + case Writethrough: + return "Writethrough"; + case Writeback: + return "Writeback"; + case WritebackAsync: + return "WritebackAsync"; + default: + return "Unknown"; + } +} + const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; const uint64_t ino = 42; @@ -76,13 +98,15 @@ static void compare(const void *tbuf, const void *cont } } -class Io: public FuseTest, - public WithParamInterface> { +typedef tuple IoParam; + +class Io: public FuseTest, public WithParamInterface { public: int m_backing_fd, m_control_fd, m_test_fd; off_t m_filesize; +bool m_direct_io; -Io(): m_backing_fd(-1), m_control_fd(-1) {}; +Io(): m_backing_fd(-1), m_control_fd(-1), m_direct_io(false) {}; void SetUp() { @@ -98,16 +122,35 @@ void SetUp() if (get<0>(GetParam())) m_init_flags |= FUSE_ASYNC_READ; m_maxwrite = get<1>(GetParam()); - if (get<2>(GetParam())) - m_init_flags |= FUSE_WRITEBACK_CACHE; - m_async = get<3>(GetParam()); + switch (get<2>(GetParam())) { + case Uncached: + m_direct_io = true; + break; + case WritebackAsync: + m_async = true; + /* FALLTHROUGH */ + case Writeback: + m_init_flags |= FUSE_WRITEBACK_CACHE; + /* FALLTHROUGH */ + case Writethrough: + break; + default: + FAIL() << "Unknown cache mode"; + } FuseTest::SetUp(); if (IsSkipped()) return; + if (verbosity > 0) { + printf("Test Parameters: init_flags=%#x maxwrite=%#x " + "%sasync cache=%s\n", + m_init_flags, m_maxwrite, m_async? "" : "no", + cache_mode_to_s(get<2>(GetParam()))); + } + expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); - expect_open(ino, 0, 1); + expect_open(ino, m_direct_io ? FOPEN_DIRECT_IO : 0, 1); EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { return (in.header.opcode == FUSE_WRITE && @@ -488,11 +531,13 @@ TEST_P(Io, resize_a_valid_buffer_while_extending) INSTANTIATE_TEST_CASE_P(Io, Io, Combine(Bool(), /* async read */ Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ - Bool(), /* writeback cache */ - Bool())); /* m_async */ + Values(Uncached, Writethrough, Writeback, WritebackAsync) + ) +); INSTANTIATE_TEST_CASE_P(Io, IoCacheable, Combine(Bool(), /* async read */ Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ - Bool(), /* writeback cache */ - Bool())); /* m_async */ + Values(Writethrough, Writeback, WritebackAsync) + ) +);