aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/os_SUITE.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2013-05-15 15:16:50 +0200
committerDan Gudmundsson <[email protected]>2013-06-03 12:58:45 +0200
commit0057676c3ebfd603658631088c977219ba2b0cc6 (patch)
tree879f3125ed8b569e25eefc02c3b5c5a201d824a3 /lib/kernel/test/os_SUITE.erl
parent892fb14882ef356c90eda8aa02ca43c3db8b53da (diff)
downloadotp-0057676c3ebfd603658631088c977219ba2b0cc6.tar.gz
otp-0057676c3ebfd603658631088c977219ba2b0cc6.tar.bz2
otp-0057676c3ebfd603658631088c977219ba2b0cc6.zip
kernel: Handle unicode in os:cmd
Allow unicode strings in os:cmd and try to convert the result bytes to unicode list. Also test it.
Diffstat (limited to 'lib/kernel/test/os_SUITE.erl')
-rw-r--r--lib/kernel/test/os_SUITE.erl26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index 73ed704ae3..9b474c4cdf 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -20,7 +20,7 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2]).
--export([space_in_cwd/1, quoting/1, space_in_name/1, bad_command/1,
+-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, evil/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -28,9 +28,8 @@
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [space_in_cwd, quoting, space_in_name, bad_command,
- find_executable, unix_comment_in_command, deep_list_command,
- evil].
+ [space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command,
+ find_executable, unix_comment_in_command, deep_list_command, evil].
groups() ->
[].
@@ -95,6 +94,21 @@ quoting(Config) when is_list(Config) ->
?line [] = receive_all(),
ok.
+
+cmd_unicode(doc) -> "Test that unicode arguments work.";
+cmd_unicode(suite) -> [];
+cmd_unicode(Config) when is_list(Config) ->
+ ?line DataDir = ?config(data_dir, Config),
+ ?line Echo = filename:join(DataDir, "my_echo"),
+
+ ?line comp("one", os:cmd(Echo ++ " one")),
+ ?line comp("one::two", os:cmd(Echo ++ " one two")),
+ ?line comp("åäö::ϼΩ", os:cmd(Echo ++ " åäö " ++ [1020, 937])),
+ ?t:sleep(5),
+ ?line [] = receive_all(),
+ ok.
+
+
space_in_name(doc) ->
"Test that program with a space in its name can be executed.";
space_in_name(suite) -> [];
@@ -302,8 +316,8 @@ comp(Expected, Got) ->
Expected ->
ok;
Other ->
- ok = io:format("Expected: ~s\n", [Expected]),
- ok = io:format("Got: ~s\n", [Other]),
+ ok = io:format("Expected: ~ts\n", [Expected]),
+ ok = io:format("Got: ~ts\n", [Other]),
test_server:fail()
end.