diff options
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/src/inet_res.erl | 4 | ||||
-rw-r--r-- | lib/kernel/test/file_SUITE.erl | 77 | ||||
-rw-r--r-- | lib/kernel/test/prim_file_SUITE.erl | 74 |
3 files changed, 87 insertions, 68 deletions
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index d5a8a2f134..2276ddcd08 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -872,7 +872,7 @@ query_ns(S0, Id, Buffer, IP, Port, Timer, Retry, I, end end. -query_udp(_S, _Id, _Buffer, _IP, _Port, 0, Verbose) -> +query_udp(_S, _Id, _Buffer, _IP, _Port, 0, _Verbose) -> timeout; query_udp(S, Id, Buffer, IP, Port, Timeout, Verbose) -> ?verbose(Verbose, "Try UDP server : ~p:~p (timeout=~w)\n", @@ -908,7 +908,7 @@ query_udp(S, Id, Buffer, IP, Port, Timeout, Verbose) -> {error,econnrefused} end. -query_tcp(0, _Id, _Buffer, _IP, _Port, Verbose) -> +query_tcp(0, _Id, _Buffer, _IP, _Port, _Verbose) -> timeout; query_tcp(Timeout, Id, Buffer, IP, Port, Verbose) -> ?verbose(Verbose, "Try TCP server : ~p:~p (timeout=~w)\n", diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index 2f73394c4e..fdab2eb02b 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -360,41 +360,50 @@ make_del_dir(Config) when is_list(Config) -> ?line {error, eexist} = ?FILE_MODULE:make_dir(NewDir), ?line ok = ?FILE_MODULE:del_dir(NewDir), ?line {error, enoent} = ?FILE_MODULE:del_dir(NewDir), - - %% Check that we get an error when trying to create... - %% a deep directory - ?line NewDir2 = filename:join(RootDir, - atom_to_list(?MODULE) - ++"_mk-dir/foo"), - ?line {error, enoent} = ?FILE_MODULE:make_dir(NewDir2), - %% a nameless directory - ?line {error, enoent} = ?FILE_MODULE:make_dir(""), - %% a directory with illegal name - ?line {error, badarg} = ?FILE_MODULE:make_dir({1,2,3}), - - %% a directory with illegal name, even if it's a (bad) list - ?line {error, badarg} = ?FILE_MODULE:make_dir([1,2,3,{}]), - - %% Maybe this isn't an error, exactly, but worth mentioning anyway: - %% ok = ?FILE_MODULE:make_dir([$f,$o,$o,0,$b,$a,$r])), - %% The above line works, and created a directory "./foo" - %% More elegant would maybe have been to fail, or to really create - %% a directory, but with a name that incorporates the "bar" part of - %% the list, so that [$f,$o,$o,0,$f,$o,$o] wouldn't refer to the same - %% dir. But this would slow it down. - - %% 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? - case ?FILE_MODULE:del_dir('..') of - {error, eexist} -> ok; - {error, einval} -> ok %FreeBSD + % Make sure we are not in a directory directly under test_server + % as that would result in eacess errors when trying to delere '..', + % because there are processes having that directory as current. + ?line ok = ?FILE_MODULE:make_dir(NewDir), + ?line {ok,CurrentDir} = file:get_cwd(), + ?line ok = ?FILE_MODULE:set_cwd(NewDir), + try + %% Check that we get an error when trying to create... + %% a deep directory + ?line NewDir2 = filename:join(RootDir, + atom_to_list(?MODULE) + ++"_mk-dir-noexist/foo"), + ?line {error, enoent} = ?FILE_MODULE:make_dir(NewDir2), + %% a nameless directory + ?line {error, enoent} = ?FILE_MODULE:make_dir(""), + %% a directory with illegal name + ?line {error, badarg} = ?FILE_MODULE:make_dir({1,2,3}), + + %% a directory with illegal name, even if it's a (bad) list + ?line {error, badarg} = ?FILE_MODULE:make_dir([1,2,3,{}]), + + %% Maybe this isn't an error, exactly, but worth mentioning anyway: + %% ok = ?FILE_MODULE:make_dir([$f,$o,$o,0,$b,$a,$r])), + %% The above line works, and created a directory "./foo" + %% More elegant would maybe have been to fail, or to really create + %% a directory, but with a name that incorporates the "bar" part of + %% the list, so that [$f,$o,$o,0,$f,$o,$o] wouldn't refer to the same + %% dir. But this would slow it down. + + %% 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 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,{}]), + + ?line [] = flush(), + ?line test_server:timetrap_cancel(Dog) + after + ?FILE_MODULE:set_cwd(CurrentDir) end, - ?line {error, enoent} = ?FILE_MODULE:del_dir(""), - ?line {error, badarg} = ?FILE_MODULE:del_dir([3,2,1,{}]), - - ?line [] = flush(), - ?line test_server:timetrap_cancel(Dog), ok. cur_dir_0(suite) -> []; diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index a04ea3cdcd..00eda6292f 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -250,39 +250,49 @@ make_del_dir(Config, Handle, Suffix) -> ?line ok = ?PRIM_FILE_call(del_dir, Handle, [NewDir]), ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [NewDir]), - %% Check that we get an error when trying to create... - %% a deep directory - ?line NewDir2 = filename:join(RootDir, - atom_to_list(?MODULE) - ++"_mk-dir/foo"), - ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [NewDir2]), - %% a nameless directory - ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [""]), - %% a directory with illegal name - ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, ['mk-dir']), - - %% a directory with illegal name, even if it's a (bad) list - ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, [[1,2,3,{}]]), - - %% Maybe this isn't an error, exactly, but worth mentioning anyway: - %% ok = ?PRIM_FILE:make_dir([$f,$o,$o,0,$b,$a,$r])), - %% The above line works, and created a directory "./foo" - %% More elegant would maybe have been to fail, or to really create - %% a directory, but with a name that incorporates the "bar" part of - %% the list, so that [$f,$o,$o,0,$f,$o,$o] wouldn't refer to the same - %% dir. But this would slow it down. - - %% 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? - case ?PRIM_FILE_call(del_dir, Handle, [".."]) of - {error, eexist} -> ok; - {error, einval} -> ok %FreeBSD + % Make sure we are not in a directory directly under test_server + % as that would result in eacess errors when trying to delere '..', + % because there are processes having that directory as current. + ?line ok = ?PRIM_FILE_call(make_dir, Handle, [NewDir]), + ?line {ok, CurrentDir} = ?PRIM_FILE_call(get_cwd, Handle, []), + ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [NewDir]), + try + %% Check that we get an error when trying to create... + %% a deep directory + ?line NewDir2 = filename:join(RootDir, + atom_to_list(?MODULE) + ++"_mk-dir-noexist/foo"), + ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [NewDir2]), + %% a nameless directory + ?line {error, enoent} = ?PRIM_FILE_call(make_dir, Handle, [""]), + %% a directory with illegal name + ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, ['mk-dir']), + + %% a directory with illegal name, even if it's a (bad) list + ?line {error, badarg} = ?PRIM_FILE_call(make_dir, Handle, [[1,2,3,{}]]), + + %% Maybe this isn't an error, exactly, but worth mentioning anyway: + %% ok = ?PRIM_FILE:make_dir([$f,$o,$o,0,$b,$a,$r])), + %% The above line works, and created a directory "./foo" + %% More elegant would maybe have been to fail, or to really create + %% a directory, but with a name that incorporates the "bar" part of + %% the list, so that [$f,$o,$o,0,$f,$o,$o] wouldn't refer to the same + %% dir. But this would slow it down. + + %% 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 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,{}]]), + + ?line test_server:timetrap_cancel(Dog) + after + ?line ok = ?PRIM_FILE_call(set_cwd, Handle, [CurrentDir]) end, - ?line {error, enoent} = ?PRIM_FILE_call(del_dir, Handle, [""]), - ?line {error, badarg} = ?PRIM_FILE_call(del_dir, Handle, [[3,2,1,{}]]), - - ?line test_server:timetrap_cancel(Dog), ok. cur_dir_0a(suite) -> []; |