From 748ba3a9c58a5a12a1423fd0311d8c681e38169e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 5 May 2010 17:51:24 +0200 Subject: 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. --- lib/kernel/test/file_SUITE.erl | 5 ++++- lib/kernel/test/prim_file_SUITE.erl | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/kernel') 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,{}]]), -- cgit v1.2.3