[PATCH] test: app/fio -- Fixup modes for open

Vladimir Davydov vdavydov.dev at gmail.com
Mon May 6 15:03:21 MSK 2019


On Mon, May 06, 2019 at 01:22:21PM +0300, Cyrill Gorcunov wrote:
> 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(-)

You missed a couple of places - I amended the patch as follows and pushed it to
master:

diff --git a/test/app-tap/csv.test.lua b/test/app-tap/csv.test.lua
index 0a656aaa..a7f17b1e 100755
--- a/test/app-tap/csv.test.lua
+++ b/test/app-tap/csv.test.lua
@@ -58,7 +58,7 @@ file2 = fio.pathjoin(tmpdir, 'file.2')
 file3 = fio.pathjoin(tmpdir, 'file.3')
 file4 = fio.pathjoin(tmpdir, 'file.4')
 
-local f = fio.open(file1, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, 0777)
+local f = fio.open(file1, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8))
 f:write("123 , 5  ,       92    , 0, 0\n" ..
         "1, 12  34, 56, \"quote , \", 66\nok")
 f:close()
@@ -67,7 +67,7 @@ test:is(table2str(csv.load(f, {chunk_size = 10})), test4_ans, "fio test1")
 f:close()
 
 
-f = fio.open(file2, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, 0777)
+f = fio.open(file2, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8))
 f:write("1\n23,456,abcac,\'multiword field 4\'\n" ..
         "none,none,0\n" ..
         ",,\n" ..
diff --git a/test/app/fio.result b/test/app/fio.result
index 87618953..e9480503 100644
--- a/test/app/fio.result
+++ b/test/app/fio.result
@@ -704,7 +704,7 @@ fio.stat(tmp2) ~= nil
 ---
 - true
 ...
-fio.mktree(tree2, 0777)
+fio.mktree(tree2, tonumber('0777', 8))
 ---
 - true
 ...
@@ -1245,7 +1245,7 @@ fio.open(nil)
 ---
 - error: 'builtin/fio.lua: Usage: fio.open(path[, flags[, mode]])'
 ...
-fio.open(tmp1, {'A'}, 0777)
+fio.open(tmp1, {'A'}, tonumber('0777', 8))
 ---
 - error: 'builtin/fio.lua: fio.open(): unknown flag: A'
 ...
diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua
index 4e5e020b..aa7f2bbb 100644
--- a/test/app/fio.test.lua
+++ b/test/app/fio.test.lua
@@ -224,7 +224,7 @@ err:match("mktree") ~= nil
 fio.mktree(tree)
 fio.stat(tree) ~= nil
 fio.stat(tmp2) ~= nil
-fio.mktree(tree2, 0777)
+fio.mktree(tree2, tonumber('0777', 8))
 
 -- copy and copytree
 file1 = fio.pathjoin(tmp1, 'file.1')
@@ -409,7 +409,7 @@ fio.rmdir(tmpdir)
 test_run:cmd("push filter '(.builtin/.*.lua):[0-9]+' to '\\1'")
 fh1:seek(nil, 'a')
 fio.open(nil)
-fio.open(tmp1, {'A'}, 0777)
+fio.open(tmp1, {'A'}, tonumber('0777', 8))
 fio.open(tmp1, { 'O_RDWR', 'O_TRUNC', 'O_CREAT' }, {'A'})
 fio.pathjoin(nil)
 fio.pathjoin('abc', nil)



More information about the Tarantool-patches mailing list