aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/file_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-12-08 14:24:51 +0100
committerRaimo Niskanen <[email protected]>2011-12-20 12:05:47 +0100
commit665f2d450a8f26dfb14e0c9891d1167d80768286 (patch)
tree1de357dc63a32aca855f4ebe8f6ee0f911aec14a /lib/kernel/test/file_SUITE.erl
parenta67091debf20c972dd7ce1a8379fee6673fbe571 (diff)
downloadotp-665f2d450a8f26dfb14e0c9891d1167d80768286.tar.gz
otp-665f2d450a8f26dfb14e0c9891d1167d80768286.tar.bz2
otp-665f2d450a8f26dfb14e0c9891d1167d80768286.zip
file_SUITE: Fix unix_free/1
unix_free/1 returned the total size of the disk, not the free space.
Diffstat (limited to 'lib/kernel/test/file_SUITE.erl')
-rw-r--r--lib/kernel/test/file_SUITE.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl
index 85346762ac..70c1569543 100644
--- a/lib/kernel/test/file_SUITE.erl
+++ b/lib/kernel/test/file_SUITE.erl
@@ -3310,9 +3310,11 @@ unix_free(Config) ->
Cmd = ["df -k '",?config(priv_dir, Config),"'"],
DF0 = os:cmd(Cmd),
io:format("$ ~s~n~s", [Cmd,DF0]),
- [$\n|DF1] = lists:dropwhile(fun ($\n) -> false; (_) -> true end, DF0),
- {ok,[N],_} = io_lib:fread(" ~*s ~d", DF1),
- N.
+ Lines = re:split(DF0, "\n", [trim,{return,list}]),
+ Last = lists:last(Lines),
+ RE = "^[^\\s]*\\s+\\d+\\s+\\d+\\s+(\\d+)",
+ {match,[Avail]} = re:run(Last, RE, [{capture,all_but_first,list}]),
+ list_to_integer(Avail).
do_large_file(Config) ->
?line Watchdog = ?t:timetrap(?t:minutes(5)),