diff options
author | Lukas Larsson <[email protected]> | 2017-12-13 11:22:45 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2017-12-13 11:22:45 +0100 |
commit | 846415992c7806190df626ebf327018a00c04ea9 (patch) | |
tree | c7908dedf6672d9a41d02fd32b481aba36523767 /lib/kernel/test/os_SUITE.erl | |
parent | 2302ea8ca97b8a9075e9234d15430c47d3a115c8 (diff) | |
download | otp-846415992c7806190df626ebf327018a00c04ea9.tar.gz otp-846415992c7806190df626ebf327018a00c04ea9.tar.bz2 otp-846415992c7806190df626ebf327018a00c04ea9.zip |
kernel: Add os:cmd/2 with max_size option
Diffstat (limited to 'lib/kernel/test/os_SUITE.erl')
-rw-r--r-- | lib/kernel/test/os_SUITE.erl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index 53a9e168ef..079b9790f6 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -25,7 +25,8 @@ -export([space_in_cwd/1, quoting/1, cmd_unicode/1, space_in_name/1, bad_command/1, find_executable/1, unix_comment_in_command/1, deep_list_command/1, large_output_command/1, background_command/0, background_command/1, - message_leak/1, close_stdin/0, close_stdin/1, perf_counter_api/1]). + message_leak/1, close_stdin/0, close_stdin/1, max_size_command/1, + perf_counter_api/1]). -include_lib("common_test/include/ct.hrl"). @@ -37,7 +38,7 @@ all() -> [space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command, find_executable, unix_comment_in_command, deep_list_command, large_output_command, background_command, message_leak, - close_stdin, perf_counter_api]. + close_stdin, max_size_command, perf_counter_api]. groups() -> []. @@ -312,6 +313,19 @@ close_stdin(Config) -> "-1" = os:cmd(Fds). +max_size_command(_Config) -> + + Res20 = os:cmd("cat /dev/zero", #{ max_size => 20 }), + 20 = length(Res20), + + Res0 = os:cmd("cat /dev/zero", #{ max_size => 0 }), + 0 = length(Res0), + + Res32768 = os:cmd("cat /dev/zero", #{ max_size => 32768 }), + 32768 = length(Res32768), + + ResHello = os:cmd("echo hello", #{ max_size => 20 }), + 6 = length(ResHello). %% Test that the os:perf_counter api works as expected perf_counter_api(_Config) -> |