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

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