aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2019-04-28 23:36:32 +0300
committerMartin Pärtel <martin.partel@gmail.com>2019-04-28 23:36:32 +0300
commit65b17173bda92a5e03f931244eca3f8afa127328 (patch)
treee4b2b0a7c7d0270451e0f0f2e4f2a2b3addbb55a /tests/test_bindfs.rb
parent95a721e0cb55465dda5ceae50e1fde944ad8a354 (diff)
downloadbindfs-65b17173bda92a5e03f931244eca3f8afa127328.tar.gz
Cleanups, tests and optimizations for #74.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index c5d41f6..9e5d381 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -775,6 +775,28 @@ if `uname`.strip == 'Linux' &&
end
end
+# Pull Request #74
+if `uname`.strip == 'Linux'
+ def odirect_data
+ ('abc' * 10000)[0...8192]
+ end
+
+ testenv("", :title => "O_DIRECT reads") do
+ File.write("src/f", odirect_data)
+ read_data = `#{$tests_dir}/odirect_read mnt/f`
+ assert { $?.success? }
+ assert { read_data == odirect_data }
+ end
+
+ testenv("", :title => "O_DIRECT writes") do
+ IO.popen("#{$tests_dir}/odirect_write mnt/f", "w") do |pipe|
+ pipe.write(odirect_data)
+ end
+ assert { $?.success? }
+ assert { File.read("src/f") == odirect_data }
+ end
+end
+
if `uname`.strip != 'FreeBSD' # -o dev is not supported on FreeBSD
root_testenv("-odev") do
system("mknod mnt/zero c 1 5")