summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-12-29 21:24:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-12-29 21:24:56 +0000
commita9162ca58e8d7ced775566bec3f6154c66685135 (patch)
tree9926772b4b49b4ebec6199a363a481a3f32da57e
parentFix locking issues around BG writes and add covering unit tests (diff)
downloadnetfs-a9162ca58e8d7ced775566bec3f6154c66685135.tar.bz2
netfs-a9162ca58e8d7ced775566bec3f6154c66685135.tar.xz
netfs-a9162ca58e8d7ced775566bec3f6154c66685135.zip
Add test for writes with async disabled (now default)
-rw-r--r--netfs/fuse/fuseConfig.ice2
-rw-r--r--netfs/unittests/Jamfile.jam1
-rw-r--r--netfs/unittests/fgwritesFuse.xml15
-rw-r--r--netfs/unittests/testCore.cpp19
4 files changed, 36 insertions, 1 deletions
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
: : :
<dependency>defaultDaemon.xml
<dependency>defaultFuse.xml
+ <dependency>fgwritesFuse.xml
<dependency>secureDaemon.xml
<dependency>secureFuse.xml
<define>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 @@
+<?xml version="1.0" encoding="ascii"?>
+<config>
+ <resources>
+ <resource>
+ <name>testvol</name>
+ <resource>
+ <export>testvol</export>
+ <endpoints>
+ <endpoint>overridden</endpoint>
+ </endpoints>
+ </resource>
+ </resource>
+ </resources>
+</config>
+
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");