diff options
author | Siri Hansen <[email protected]> | 2013-05-02 11:10:19 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2013-05-02 12:20:50 +0200 |
commit | 428ae2085c8f9df7364fbf5742aba0962bb9a3de (patch) | |
tree | c899a0a064444141deb808ef773b844a4a46b594 /lib/stdlib/test | |
parent | f717cdd28f4a0382db18239622a4a0ba30b29336 (diff) | |
download | otp-428ae2085c8f9df7364fbf5742aba0962bb9a3de.tar.gz otp-428ae2085c8f9df7364fbf5742aba0962bb9a3de.tar.bz2 otp-428ae2085c8f9df7364fbf5742aba0962bb9a3de.zip |
Fix zip_SUITE:borderline test
This test fails on a test host where no proper unix unzip is
installed. This has been corrected.
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r-- | lib/stdlib/test/zip_SUITE.erl | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/stdlib/test/zip_SUITE.erl b/lib/stdlib/test/zip_SUITE.erl index 7233c061ef..a57641ef62 100644 --- a/lib/stdlib/test/zip_SUITE.erl +++ b/lib/stdlib/test/zip_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2011. All Rights Reserved. +%% Copyright Ericsson AB 2006-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -109,13 +109,32 @@ borderline_test(Size, TempDir) -> ok. unzip_list(Archive, Name) -> - case os:find_executable("unzip") of - Unzip when is_list(Unzip) -> + case unix_unzip_exists() of + true -> unzip_list1(Archive, Name); _ -> ok end. +%% Used to do os:find_executable() to check if unzip exists, but on +%% some hosts that would give an unzip program which did not take the +%% "-Z" option. +%% Here we check that "unzip -Z" (which should display usage) and +%% check that it exists with status 0. +unix_unzip_exists() -> + case os:type() of + {unix,_} -> + Port = open_port({spawn,"unzip -Z > /dev/null"}, [exit_status]), + receive + {Port,{exit_status,0}} -> + true; + {Port,{exit_status,_Fail}} -> + false + end; + _ -> + false + end. + unzip_list1(Archive, Name) -> Expect = Name ++ "\n", cmd_expect("unzip -Z -1 " ++ Archive, Expect). |