From fd8b00bacd2cde1e7aa0543acf58b1a7344f8daf Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 6 Sep 2019 18:19:57 +0200 Subject: tests: do_rmdir(): improve error handling #10955 --- test/functional/helpers.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index cf9f5f9858..5ec28dd0c7 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -577,8 +577,16 @@ function module.assert_alive() end local function do_rmdir(path) - if lfs.attributes(path, 'mode') ~= 'directory' then - return -- Don't complain. + local mode, errmsg, errcode = lfs.attributes(path, 'mode') + if mode == nil then + if errcode == 2 then + -- "No such file or directory", don't complain. + return + end + error(string.format('rmdir: %s (%d)', errmsg, errcode)) + end + if mode ~= 'directory' then + error(string.format('rmdir: not a directory: %s', path)) end for file in lfs.dir(path) do if file ~= '.' and file ~= '..' then -- cgit