From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id CBFD42C8A3 for ; Tue, 28 May 2019 21:21:43 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ve24QW_7GkTW for ; Tue, 28 May 2019 21:21:43 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 225D728910 for ; Tue, 28 May 2019 21:21:43 -0400 (EDT) From: Alexander Turenko Subject: [tarantool-patches] [PATCH] test: fix fio test when run by the root user Date: Wed, 29 May 2019 04:21:20 +0300 Message-Id: <7998da4cb25719533c9652f0b08e1e2bfea480c1.1559091604.git.alexander.turenko@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Kirill Yukhin Cc: Alexander Turenko , tarantool-patches@freelists.org 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