[PATCH 3/3] test: app/fio -- Add ERRINJ_COIO_SENDFILE_CHUNK

Cyrill Gorcunov gorcunov at gmail.com
Tue Apr 16 23:08:58 MSK 2019


To test sendfile work in a cycle -- force transferring
1024 bytes at once.
---
 test/app/fio.result   | 18 ++++++++++++++++++
 test/app/fio.test.lua |  5 +++++
 2 files changed, 23 insertions(+)

diff --git a/test/app/fio.result b/test/app/fio.result
index 486cb8043..d640ab596 100644
--- a/test/app/fio.result
+++ b/test/app/fio.result
@@ -718,6 +718,9 @@ file2 = fio.pathjoin(tmp2, 'file.2')
 file3 = fio.pathjoin(tree, 'file.3')
 ---
 ...
+file4 = fio.pathjoin(tree, 'file.4')
+---
+...
 fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777)
 ---
 ...
@@ -752,6 +755,21 @@ fio.stat(fio.pathjoin(tmp2, "file.1")) ~= nil
 ---
 - true
 ...
+errinj = box.error.injection
+---
+...
+errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', 1024)
+---
+- ok
+...
+fio.copyfile(file1, file4)
+---
+- true
+...
+fio.stat(file1, file4) ~= nil
+---
+- true
+...
 res, err = fio.copyfile(fio.pathjoin(tmp1, 'not_exists.txt'), tmp1)
 ---
 ...
diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua
index 9af37044d..87d578991 100644
--- a/test/app/fio.test.lua
+++ b/test/app/fio.test.lua
@@ -230,6 +230,7 @@ fio.mktree(tree2, 0777)
 file1 = fio.pathjoin(tmp1, 'file.1')
 file2 = fio.pathjoin(tmp2, 'file.2')
 file3 = fio.pathjoin(tree, 'file.3')
+file4 = fio.pathjoin(tree, 'file.4')
 
 fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777)
 fh1:write("gogo")
@@ -240,6 +241,10 @@ fh1:close()
 fio.symlink(file1, file3)
 fio.copyfile(file1, tmp2)
 fio.stat(fio.pathjoin(tmp2, "file.1")) ~= nil
+errinj = box.error.injection
+errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', 1024)
+fio.copyfile(file1, file4)
+fio.stat(file1, file4) ~= nil
 
 res, err = fio.copyfile(fio.pathjoin(tmp1, 'not_exists.txt'), tmp1)
 res
-- 
2.20.1




More information about the Tarantool-patches mailing list