From: Cyrill Gorcunov <gorcunov@gmail.com> To: tml <tarantool-patches@freelists.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com>, Cyrill Gorcunov <gorcunov@gmail.com> Subject: [PATCH] test: app/fio -- Fixup modes for open Date: Mon, 6 May 2019 13:22:21 +0300 [thread overview] Message-ID: <20190506102221.3198-1-gorcunov@gmail.com> (raw) There were typos -- we should use octal base, othervise numbers are treated as decimals. --- test/app/fio.result | 16 ++++++++-------- test/app/fio.test.lua | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/app/fio.result b/test/app/fio.result index 39b2ad0b5..87618953b 100644 --- a/test/app/fio.result +++ b/test/app/fio.result @@ -114,7 +114,7 @@ err:match("open") ~= nil --- - true ... -fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) --- ... fh1 ~= nil @@ -727,7 +727,7 @@ file5 = fio.pathjoin(tree, 'file.5') file6 = fio.pathjoin(tree, 'file.6') --- ... -fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) --- ... fh1:write("gogo") @@ -738,7 +738,7 @@ fh1:close() --- - true ... -fh1 = fio.open(file2, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file2, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) --- ... fh1:write("lolo") @@ -782,7 +782,7 @@ errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', -1) - ok ... --- test the destination file is truncated -fh5 = fio.open(file5, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 420) +fh5 = fio.open(file5, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0644', 8)) --- ... fh5:write("template data") @@ -793,7 +793,7 @@ fh5:close() --- - true ... -fh6 = fio.open(file6, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 420) +fh6 = fio.open(file6, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0644', 8)) --- ... fh6:write("to be truncated") @@ -869,7 +869,7 @@ tmpdir = fio.tempdir() tmpfile = fio.pathjoin(tmpdir, "test1") --- ... -fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) --- ... fh:write('helloworld!') @@ -900,7 +900,7 @@ fio.unlink(tmpfile) tmpfile = fio.pathjoin(tmpdir, "test") --- ... -fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) --- ... fh:write('helloworld!') @@ -1167,7 +1167,7 @@ test_run:cmd("setopt delimiter ';'") - true ... function write_file(name, odd) - local fh = fio.open(name, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) + local fh = fio.open(name, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) if odd then fh:write(string.rep('1', 100)) else diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua index ffb15c057..4e5e020bc 100644 --- a/test/app/fio.test.lua +++ b/test/app/fio.test.lua @@ -42,7 +42,7 @@ file4 = fio.pathjoin(tmpdir, 'file.4') st, err = pcall(fio.open, nil) st err:match("open") ~= nil -fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) fh1 ~= nil f1s = fh1:stat() f1s.size @@ -234,10 +234,10 @@ file4 = fio.pathjoin(tree, 'file.4') file5 = fio.pathjoin(tree, 'file.5') file6 = fio.pathjoin(tree, 'file.6') -fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) fh1:write("gogo") fh1:close() -fh1 = fio.open(file2, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh1 = fio.open(file2, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) fh1:write("lolo") fh1:close() fio.symlink(file1, file3) @@ -252,10 +252,10 @@ fio.stat(file1, file4) ~= nil errinj.set('ERRINJ_COIO_SENDFILE_CHUNK', -1) --- test the destination file is truncated -fh5 = fio.open(file5, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 420) +fh5 = fio.open(file5, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0644', 8)) fh5:write("template data") fh5:close() -fh6 = fio.open(file6, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 420) +fh6 = fio.open(file6, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0644', 8)) fh6:write("to be truncated") fio.copyfile(file5, file6) fh6:seek(0) @@ -280,7 +280,7 @@ buf = buffer.ibuf() tmpdir = fio.tempdir() tmpfile = fio.pathjoin(tmpdir, "test1") -fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) fh:write('helloworld!') fh:seek(0) fh:read() @@ -289,7 +289,7 @@ fh:read() fio.unlink(tmpfile) tmpfile = fio.pathjoin(tmpdir, "test") -fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) +fh = fio.open(tmpfile, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) fh:write('helloworld!') fh:seek(0) len = fh:read(buf:reserve(12)) @@ -376,7 +376,7 @@ tmp1 = fio.pathjoin(tmpdir, "tmp1") tmp2= fio.pathjoin(tmpdir, "tmp2") test_run:cmd("setopt delimiter ';'") function write_file(name, odd) - local fh = fio.open(name, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, 0777) + local fh = fio.open(name, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8)) if odd then fh:write(string.rep('1', 100)) else -- 2.20.1
next reply other threads:[~2019-05-06 10:22 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-06 10:22 Cyrill Gorcunov [this message] 2019-05-06 12:03 ` Vladimir Davydov 2019-05-06 12:04 ` Cyrill Gorcunov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190506102221.3198-1-gorcunov@gmail.com \ --to=gorcunov@gmail.com \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH] test: app/fio -- Fixup modes for open' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox