From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9FE7D469719 for ; Fri, 6 Mar 2020 00:15:19 +0300 (MSK) From: Vladislav Shpilevoy Date: Thu, 5 Mar 2020 22:15:17 +0100 Message-Id: <4ecccbd1294ac024dfc9c05d2d7f74b908e50992.1583442898.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, kyukhin@tarantool.org In 89c73e64c071cb7402406bf1eb8d767d4dfe4e6e ("fio: respect $TMPDIR in fio.tempdir(), when it is set") was added a test checking that fio.tempdir() returns a path to a folder, stored by a path specified in $TMPDIR environment variable. Check was done by calling Lua returned_path:find(tmpdir_path). If tmpdir path contained 'special' characters such as '.', it didn't match, because string.find() takes a regular expression, not just a string. string.startswith() works fine. Follow-up #4794 --- Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4794-follow-up-test Issue: https://github.com/tarantool/tarantool/issues/4794 test/app/fio.result | 6 +++--- test/app/fio.test.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/app/fio.result b/test/app/fio.result index cd18ed32c..783fa4fab 100644 --- a/test/app/fio.result +++ b/test/app/fio.result @@ -1465,7 +1465,7 @@ cwd = fio.cwd() old_tmpdir = os.getenv('TMPDIR') --- ... -tmpdir = cwd..'/tmp' +tmpdir = cwd..'/tmp-.dot.-' --- ... fio.mkdir(tmpdir) @@ -1478,7 +1478,7 @@ os.setenv('TMPDIR', tmpdir) dir = fio.tempdir() --- ... -dir:find(tmpdir) ~= nil or {dir, tmpdir} +dir:startswith(tmpdir) or {dir, tmpdir} --- - true ... @@ -1503,7 +1503,7 @@ os.setenv('TMPDIR', nil) dir = fio.tempdir() --- ... -dir:find('/tmp') ~= nil or dir +dir:startswith('/tmp') or dir --- - true ... diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua index 242ff08ad..6825b882f 100644 --- a/test/app/fio.test.lua +++ b/test/app/fio.test.lua @@ -481,11 +481,11 @@ fio.mktree('/dev/null/dir') cwd = fio.cwd() old_tmpdir = os.getenv('TMPDIR') -tmpdir = cwd..'/tmp' +tmpdir = cwd..'/tmp-.dot.-' fio.mkdir(tmpdir) os.setenv('TMPDIR', tmpdir) dir = fio.tempdir() -dir:find(tmpdir) ~= nil or {dir, tmpdir} +dir:startswith(tmpdir) or {dir, tmpdir} fio.stat(dir) ~= nil or fio.stat(dir) tmpdir = cwd..'/tmp2' @@ -494,7 +494,7 @@ fio.tempdir() os.setenv('TMPDIR', nil) dir = fio.tempdir() -dir:find('/tmp') ~= nil or dir +dir:startswith('/tmp') or dir tmpdir = cwd..'/'..string.rep('t', 5000) os.setenv('TMPDIR', tmpdir) -- 2.21.1 (Apple Git-122.3)