diff options
author | John Högberg <[email protected]> | 2019-04-02 12:29:28 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-04-02 12:29:28 +0200 |
commit | 8b88a5bf0400e522e569c0e00ffc491d270fc374 (patch) | |
tree | d870ef27253ba2f4977028dba4e0e9a9794c714d /erts/emulator/test/efile_SUITE.erl | |
parent | 91e6f3a30b8d6e779050f6e7fd418479bc9f9948 (diff) | |
parent | 25045707f86bf6352d927fa0351cb0a1a339f6ae (diff) | |
download | otp-8b88a5bf0400e522e569c0e00ffc491d270fc374.tar.gz otp-8b88a5bf0400e522e569c0e00ffc491d270fc374.tar.bz2 otp-8b88a5bf0400e522e569c0e00ffc491d270fc374.zip |
Merge branch 'john/erts/cuddle-efile-suite'
* john/erts/cuddle-efile-suite:
efile_SUITE: Fix proc_zero_sized_files on systems with empty /proc
Diffstat (limited to 'erts/emulator/test/efile_SUITE.erl')
-rw-r--r-- | erts/emulator/test/efile_SUITE.erl | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/erts/emulator/test/efile_SUITE.erl b/erts/emulator/test/efile_SUITE.erl index 55c5343739..045b351e02 100644 --- a/erts/emulator/test/efile_SUITE.erl +++ b/erts/emulator/test/efile_SUITE.erl @@ -105,34 +105,27 @@ open_files(Name) -> %% a /proc directory), let's read some zero sized files 500 times each, while %% ensuring that response isn't empty << >> proc_zero_sized_files(Config) when is_list(Config) -> - {Type, Flavor} = os:type(), - %% Some files which exist on Linux but might be missing on other systems - Inputs = ["/proc/cpuinfo", - "/proc/meminfo", - "/proc/partitions", - "/proc/swaps", - "/proc/version", - "/proc/uptime", - %% curproc is present on freebsd - "/proc/curproc/cmdline"], - case filelib:is_dir("/proc") of - false -> {skip, "/proc not found"}; % skip the test if no /proc - _ when Type =:= unix andalso Flavor =:= sunos -> - %% SunOS has a /proc, but no zero sized special files - {skip, "sunos does not have any zero sized special files"}; - true -> - %% Take away files which do not exist in proc - Inputs1 = lists:filter(fun filelib:is_file/1, Inputs), - - %% Fail if none of mentioned files exist in /proc, did we just get - %% a normal /proc directory without any special files? - ?assertNotEqual([], Inputs1), - + TestFiles0 = [%% Some files which exist on Linux but might be missing on + %% other systems + "/proc/cpuinfo", + "/proc/meminfo", + "/proc/partitions", + "/proc/swaps", + "/proc/version", + "/proc/uptime", + %% curproc is present on FreeBSD + "/proc/curproc/cmdline"], + + TestFiles = [F || F <- TestFiles0, filelib:is_file(F)], + + case TestFiles of + [_|_] -> %% For 6 inputs and 500 attempts each this do run anywhere %% between 500 and 3000 function calls. - lists:foreach( - fun(Filename) -> do_proc_zero_sized(Filename, 500) end, - Inputs1) + [do_proc_zero_sized(F, 500) || F <- TestFiles], + ok; + [] -> + {skip, "Failed to find any known zero-sized files"} end. %% @doc Test one file N times to also trigger possible leaking fds and memory |