From owner-svn-src-projects@freebsd.org Tue Jun 25 16:49:21 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 9674C15D1364 for ; Tue, 25 Jun 2019 16:49:21 +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 2116F6BC58; Tue, 25 Jun 2019 16:49:21 +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 F07D31B1AE; Tue, 25 Jun 2019 16:49:20 +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 x5PGnK9G093586; Tue, 25 Jun 2019 16:49:20 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PGnKos093585; Tue, 25 Jun 2019 16:49:20 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906251649.x5PGnKos093585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 25 Jun 2019 16:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r349375 - 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: 349375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2116F6BC58 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] 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: Tue, 25 Jun 2019 16:49:21 -0000 Author: asomers Date: Tue Jun 25 16:49:20 2019 New Revision: 349375 URL: https://svnweb.freebsd.org/changeset/base/349375 Log: fusefs: fix multiple issues with the io tests * During TearDown, close the test file before the backing file. That way the backing file artifact will have the correct contents after the test completes. It doesn't matter when running in Kyua, but it may when running the test manually. * Add a closeopen operation that mimics what FSX does with the "-c" option. * Skip mmap-related tests when vfs.fusefs.data_cache_mode == 0 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 Tue Jun 25 16:39:25 2019 (r349374) +++ projects/fuse2/tests/sys/fs/fusefs/io.cc Tue Jun 25 16:49:20 2019 (r349375) @@ -29,7 +29,9 @@ */ extern "C" { +#include #include +#include #include #include @@ -175,6 +177,8 @@ void SetUp() void TearDown() { + if (m_test_fd >= 0) + close(m_test_fd); if (m_backing_fd >= 0) close(m_backing_fd); if (m_control_fd >= 0) @@ -183,6 +187,17 @@ void TearDown() /* Deliberately leak test_fd */ } +void do_closeopen() +{ + ASSERT_EQ(0, close(m_test_fd)) << strerror(errno); + m_test_fd = open("backing_file", O_RDWR); + ASSERT_LE(0, m_test_fd) << strerror(errno); + + ASSERT_EQ(0, close(m_control_fd)) << strerror(errno); + m_control_fd = open("control", O_RDWR); + ASSERT_LE(0, m_control_fd) << strerror(errno); +} + void do_ftruncate(off_t offs) { ASSERT_EQ(0, ftruncate(m_test_fd, offs)) << strerror(errno); @@ -298,6 +313,22 @@ void do_write(ssize_t size, off_t offs) }; +class IoCacheable: public Io { +public: +virtual void SetUp() { + const char *node = "vfs.fusefs.data_cache_mode"; + int val = 0; + size_t size = sizeof(val); + + ASSERT_EQ(0, sysctlbyname(node, &val, &size, NULL, 0)) + << strerror(errno); + if (val == 0) + GTEST_SKIP() << + "fusefs data caching must be enabled for this test"; + Io::SetUp(); +} +}; + /* * Extend a file with dirty data in the last page of the last block. * @@ -321,7 +352,7 @@ TEST_P(Io, extend_from_dirty_page) * * fsx -c 100 -i 100 -l 524288 -o 131072 -N5 -P /tmp -S19 fsx.bin */ -TEST_P(Io, extend_by_mapwrite) +TEST_P(IoCacheable, extend_by_mapwrite) { do_mapwrite(0x849e, 0x29a3a); /* [0x29a3a, 0x31ed7] */ do_mapwrite(0x3994, 0x3c7d8); /* [0x3c7d8, 0x4016b] */ @@ -347,7 +378,7 @@ TEST_P(Io, last_page) * * fsx -c 100 -i 100 -l 524288 -o 131072 -N11 -P /tmp -S14 fsx.bin */ -TEST_P(Io, mapread_hole) +TEST_P(IoCacheable, mapread_hole) { do_write(0x123b7, 0xf205); /* [0xf205, 0x215bb] */ do_mapread(0xeeea, 0x2f4c); /* [0x2f4c, 0x11e35] */ @@ -461,6 +492,11 @@ TEST_P(Io, resize_a_valid_buffer_while_extending) } INSTANTIATE_TEST_CASE_P(Io, Io, + Combine(Values(0, FUSE_ASYNC_READ), /* m_init_flags */ + Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ + Bool())); /* m_async */ + +INSTANTIATE_TEST_CASE_P(Io, IoCacheable, Combine(Values(0, FUSE_ASYNC_READ), /* m_init_flags */ Values(0x1000, 0x10000, 0x20000), /* m_maxwrite */ Bool())); /* m_async */