From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Wed, 17 Apr 2019 00:40:34 +0300 From: Cyrill Gorcunov Subject: [PATCH v4 3/3] test: app/fio -- Add ERRINJ_COIO_SENDFILE_CHUNK Message-ID: <20190416214034.GL13702@uranus.lan> References: <20190416200858.19473-1-gorcunov@gmail.com> <20190416200858.19473-4-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190416200858.19473-4-gorcunov@gmail.com> To: tml Cc: Vladimir Davydov List-ID: To test sendfile work in a cycle -- force transferring 1 byte at once. --- v4: These files are quite small so test with 1 byte chunk to force sendfile cycle. test/app/fio.result | 23 +++++++++++++++++++++++ test/app/fio.test.lua | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/test/app/fio.result b/test/app/fio.result index 486cb8043..879e0a767 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,26 @@ fio.stat(fio.pathjoin(tmp2, "file.1")) ~= nil --- - true ... +--- test copyfile to operate with one byte transfer +errinj = box.error.injection +--- +... +errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', 1) +--- +- ok +... +fio.copyfile(file1, file4) +--- +- true +... +fio.stat(file1, file4) ~= nil +--- +- true +... +errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', -1) +--- +- ok +... 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..1255b2804 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") @@ -241,6 +242,13 @@ fio.symlink(file1, file3) fio.copyfile(file1, tmp2) fio.stat(fio.pathjoin(tmp2, "file.1")) ~= nil +--- test copyfile to operate with one byte transfer +errinj = box.error.injection +errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', 1) +fio.copyfile(file1, file4) +fio.stat(file1, file4) ~= nil +errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', -1) + res, err = fio.copyfile(fio.pathjoin(tmp1, 'not_exists.txt'), tmp1) res err:match("failed to copy") ~= nil -- 2.20.1