Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] test: app/fio -- Fixup modes for open
@ 2019-05-06 10:22 Cyrill Gorcunov
  2019-05-06 12:03 ` Vladimir Davydov
  0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2019-05-06 10:22 UTC (permalink / raw)
  To: tml; +Cc: Vladimir Davydov, Cyrill Gorcunov

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test: app/fio -- Fixup modes for open
  2019-05-06 10:22 [PATCH] test: app/fio -- Fixup modes for open Cyrill Gorcunov
@ 2019-05-06 12:03 ` Vladimir Davydov
  2019-05-06 12:04   ` Cyrill Gorcunov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Davydov @ 2019-05-06 12:03 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test: app/fio -- Fixup modes for open
  2019-05-06 12:03 ` Vladimir Davydov
@ 2019-05-06 12:04   ` Cyrill Gorcunov
  0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2019-05-06 12:04 UTC (permalink / raw)
  To: Vladimir Davydov; +Cc: tml

On Mon, May 06, 2019 at 03:03:21PM +0300, Vladimir Davydov wrote:
> 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:

Thank you!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-06 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06 10:22 [PATCH] test: app/fio -- Fixup modes for open Cyrill Gorcunov
2019-05-06 12:03 ` Vladimir Davydov
2019-05-06 12:04   ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox