Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH] test: fix fio test when run by the root user
Date: Wed, 29 May 2019 04:21:20 +0300	[thread overview]
Message-ID: <7998da4cb25719533c9652f0b08e1e2bfea480c1.1559091604.git.alexander.turenko@tarantool.org> (raw)

We run testing in Travis-CI using docker, which by default enters into a
shell session as root.

This is follow up for e9c96a4c1afe28dac8beb9eed2d092e05b956366 ('fio:
fix mktree error reporting').
---

https://github.com/tarantool/tarantool/pull/4044
https://github.com/tarantool/tarantool/tree/Totktonada/gh-4044-fix-fio-test
https://travis-ci.org/tarantool/tarantool/builds/538518022

 test/app/fio.result   | 18 ++++++++++++------
 test/app/fio.test.lua | 12 ++++++++----
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/test/app/fio.result b/test/app/fio.result
index 7be76656a..8819e39fa 100644
--- a/test/app/fio.result
+++ b/test/app/fio.result
@@ -709,6 +709,12 @@ fio.mktree(tree2, tonumber('0777', 8))
 - true
 ...
 -- check mktree error reporting
+--
+-- The test is skipped for the super user, because it has ability
+-- to perform any file access despite file permissions.
+uid = ffi.C.getuid()
+---
+...
 tmp3 = fio.pathjoin(tmpdir, '5')
 ---
 ...
@@ -726,11 +732,11 @@ tree123 = fio.pathjoin(tmp3, '1/2/3')
 st, err = fio.mktree(tree123)
 ---
 ...
-st
+uid == 0 or st == false
 ---
-- false
+- true
 ...
-err:match('Permission denied') ~= nil
+uid == 0 or err:match('Permission denied') ~= nil
 ---
 - true
 ...
@@ -740,11 +746,11 @@ tree4 = fio.pathjoin(tmp3, '4')
 st, err = fio.mktree(tree4)
 ---
 ...
-st
+uid == 0 or st == false
 ---
-- false
+- true
 ...
-err:match('Permission denied') ~= nil
+uid == 0 or err:match('Permission denied') ~= nil
 ---
 - true
 ...
diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua
index a1db9e2f4..6c0d2f478 100644
--- a/test/app/fio.test.lua
+++ b/test/app/fio.test.lua
@@ -227,17 +227,21 @@ fio.stat(tmp2) ~= nil
 fio.mktree(tree2, tonumber('0777', 8))
 
 -- check mktree error reporting
+--
+-- The test is skipped for the super user, because it has ability
+-- to perform any file access despite file permissions.
+uid = ffi.C.getuid()
 tmp3 = fio.pathjoin(tmpdir, '5')
 fio.mkdir(tmp3)
 fio.chmod(tmp3, tonumber('500', 8))
 tree123 = fio.pathjoin(tmp3, '1/2/3')
 st, err = fio.mktree(tree123)
-st
-err:match('Permission denied') ~= nil
+uid == 0 or st == false
+uid == 0 or err:match('Permission denied') ~= nil
 tree4 = fio.pathjoin(tmp3, '4')
 st, err = fio.mktree(tree4)
-st
-err:match('Permission denied') ~= nil
+uid == 0 or st == false
+uid == 0 or err:match('Permission denied') ~= nil
 
 -- copy and copytree
 file1 = fio.pathjoin(tmp1, 'file.1')
-- 
2.21.0

             reply	other threads:[~2019-05-29  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  1:21 Alexander Turenko [this message]
2019-05-29 12:39 ` Vladimir Davydov
2019-05-29 14:19 ` [tarantool-patches] " Kirill Yukhin

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=7998da4cb25719533c9652f0b08e1e2bfea480c1.1559091604.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] test: fix fio test when run by the root user' \
    /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