diff options
author | Björn Gustavsson <[email protected]> | 2010-05-05 17:51:24 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-05-05 18:03:36 +0200 |
commit | 748ba3a9c58a5a12a1423fd0311d8c681e38169e (patch) | |
tree | 1ba5bdfe02a54c7916956e8bdafaa7cf3df410fd | |
parent | c032d352a8610b47b2e88fd871d5047468240f16 (diff) | |
download | otp-748ba3a9c58a5a12a1423fd0311d8c681e38169e.tar.gz otp-748ba3a9c58a5a12a1423fd0311d8c681e38169e.tar.bz2 otp-748ba3a9c58a5a12a1423fd0311d8c681e38169e.zip |
Adjust test of file:del_dir("..") to accept {error,einval}
On FreeBSD, file:del_dir("..") will return {error,einval} rather
than the expected {error,eexist}, and so will file:del_dir("../.."),
and so on.
It could be argued that we should change the implementation of
file:del_dir/1 to remap the error code (as some other error codes
are remapped to reduce the differences between different platforms),
but the consistency gained does not seem to be worth the effort.
Therefore, until we'll find a real-world use case where it is
essential to have consistent error codes for file:del_dir("..") on
all platforms, change the test case to accept both errors.
-rw-r--r-- | lib/kernel/test/file_SUITE.erl | 5 | ||||
-rw-r--r-- | lib/kernel/test/prim_file_SUITE.erl | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index d01e1f1fcf..1d170790a3 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -270,7 +270,10 @@ make_del_dir(Config) when is_list(Config) -> %% Try deleting some bad directories %% Deleting the parent directory to the current, sounds dangerous, huh? %% Don't worry ;-) the parent directory should never be empty, right? - ?line {error, eexist} = ?FILE_MODULE:del_dir('..'), + case ?FILE_MODULE:del_dir('..') of + {error, eexist} -> ok; + {error, einval} -> ok %FreeBSD + end, ?line {error, enoent} = ?FILE_MODULE:del_dir(""), ?line {error, badarg} = ?FILE_MODULE:del_dir([3,2,1,{}]), diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index 860aeecbf4..413a829640 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -243,7 +243,10 @@ make_del_dir(Config, Handle, Suffix) -> %% Try deleting some bad directories %% Deleting the parent directory to the current, sounds dangerous, huh? %% Don't worry ;-) the parent directory should never be empty, right? - ?line {error, eexist} = ?PRIM_FILE_call(del_dir, Handle, [".."]), + case ?PRIM_FILE_call(del_dir, Handle, [".."]) of + {error, eexist} -> ok; + {error, einval} -> ok %FreeBSD + end, ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [""]), ?line {error, badarg} = ?PRIM_FILE_call(del_dir, Handle, [[3,2,1,{}]]), |