aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-03-21 17:51:39 +0100
committerSverker Eriksson <[email protected]>2018-03-21 17:53:44 +0100
commitbf4418b4bb9166a6a27937b53710d2b4d30925af (patch)
treef10cd9d49bd78d914d4e5317fb8ab35b22fc0c11 /lib
parent5a583d0e58a97038f5fa3bdfa3c35694f0a18f34 (diff)
downloadotp-bf4418b4bb9166a6a27937b53710d2b4d30925af.tar.gz
otp-bf4418b4bb9166a6a27937b53710d2b4d30925af.tar.bz2
otp-bf4418b4bb9166a6a27937b53710d2b4d30925af.zip
kernel: Fix os_SUITE:max_size_command for OTP-19
where string:trim does not exist.
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/test/os_SUITE.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index cfd475becf..d7f0463289 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -324,9 +324,17 @@ max_size_command(_Config) ->
Res32768 = os:cmd("cat /dev/zero", #{ max_size => 32768 }),
32768 = length(Res32768),
- ResHello = string:trim(os:cmd("echo hello", #{ max_size => 20 })),
+ ResHello = string_trim(os:cmd("echo hello", #{ max_size => 20 })),
5 = length(ResHello).
+string_trim(S) ->
+ lists:reverse(string_trim_left(lists:reverse(string_trim_left(S)))).
+
+string_trim_left([C | T]) when C =:= $\s; C =:= $\n; C =:= $\t; C =:= $\r ->
+ string_trim_left(T);
+string_trim_left(S) ->
+ S.
+
%% Test that the os:perf_counter api works as expected
perf_counter_api(_Config) ->