From a9162ca58e8d7ced775566bec3f6154c66685135 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 29 Dec 2017 21:24:56 +0000 Subject: Add test for writes with async disabled (now default) --- netfs/fuse/fuseConfig.ice | 2 +- netfs/unittests/Jamfile.jam | 1 + netfs/unittests/fgwritesFuse.xml | 15 +++++++++++++++ netfs/unittests/testCore.cpp | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 netfs/unittests/fgwritesFuse.xml diff --git a/netfs/fuse/fuseConfig.ice b/netfs/fuse/fuseConfig.ice index 1e6aed3..52116ea 100644 --- a/netfs/fuse/fuseConfig.ice +++ b/netfs/fuse/fuseConfig.ice @@ -19,7 +19,7 @@ module NetFS { string AuthToken; ["slicer:name:async"] - bool Async; + bool Async = false; }; ["slicer:key:name","slicer:value:resource","slicer:item:resource"] diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam index a6a549f..114895c 100644 --- a/netfs/unittests/Jamfile.jam +++ b/netfs/unittests/Jamfile.jam @@ -36,6 +36,7 @@ run testCore.cpp : : : defaultDaemon.xml defaultFuse.xml + fgwritesFuse.xml secureDaemon.xml secureFuse.xml BOOST_TEST_DYN_LINK diff --git a/netfs/unittests/fgwritesFuse.xml b/netfs/unittests/fgwritesFuse.xml new file mode 100644 index 0000000..37f55a3 --- /dev/null +++ b/netfs/unittests/fgwritesFuse.xml @@ -0,0 +1,15 @@ + + + + + testvol + + testvol + + overridden + + + + + + diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 3d23870..4aa2619 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -495,6 +495,25 @@ BOOST_AUTO_TEST_CASE( utimens ) BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_CASE( testFGWrites ) +{ + Core c("defaultDaemon.xml", "fgwritesFuse.xml"); + struct fuse_file_info fi; + memset(&fi, 0, sizeof(fi)); + struct stat st; + memset(&st, 0, sizeof(st)); + fi.flags = O_RDWR; + BOOST_REQUIRE_EQUAL(c.fuse->create("/test", 0600, &fi), 0); + BOOST_REQUIRE_EQUAL(c.fuse->write("/test", "some test buffer", 16, 0, &fi), 16); + BOOST_REQUIRE_EQUAL(c.fuse->getattr("/test", &st), 0); + BOOST_REQUIRE_EQUAL(st.st_size, 16); + char buf[11]; + memset(&buf, 0, sizeof(buf)); + BOOST_REQUIRE_EQUAL(c.fuse->read("/test", buf, 10, 5, &fi), 10); + BOOST_REQUIRE_EQUAL(buf, "test buffe"); + BOOST_REQUIRE_EQUAL(c.fuse->release("/test", &fi), 0); +} + BOOST_AUTO_TEST_CASE( testNoAuthNoPass ) { Core c("defaultDaemon.xml", "defaultFuse.xml"); -- cgit v1.2.3