From 12d05899a39efac3f5298601f56caf8cb7709897 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 5 Nov 2013 10:17:12 -0500 Subject: [PATCH] update user_string_n_quoted.exp test case With commit 7bec2c2, the default behaviour of user_string_n_quoted() has changed. The test case is now updated to test that user_string_n_quoted() trims strings according to input length and that user_string_n2_quoted() trims strings according to output length given the inverse parameters. --- .../systemtap.string/user_string_n_quoted.exp | 21 ++++++++----------- .../systemtap.string/user_string_n_quoted.stp | 13 ++++++++++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/testsuite/systemtap.string/user_string_n_quoted.exp b/testsuite/systemtap.string/user_string_n_quoted.exp index 2cce43020..c2166fa1b 100644 --- a/testsuite/systemtap.string/user_string_n_quoted.exp +++ b/testsuite/systemtap.string/user_string_n_quoted.exp @@ -1,15 +1,12 @@ set test "user_string_n_quoted" if {![installtest_p]} { untested $test; return } -spawn stap $srcdir/$subdir/user_string_n_quoted.stp -c "echo this_is_a_test > /dev/null" -expect { - -timeout 60 - {"this_is_a_"...} { pass $test } - eof { fail $test } - timeout { - fail "$test (timeout)" - catch { exec kill -INT -- -[exp_pid] } - } -} - -catch { close }; catch { wait } +set ::result_string {"this_is_a_test\n" +"this_is_a_test" +"this_is_a_tes" +"this_is_a_test\n" +"this_is_a_te"... +"this_is_a_t"... +"this_is_a_"... +"this_is_a"...} +stap_run2 $srcdir/$subdir/$test.stp -c "echo this_is_a_test > /dev/null" diff --git a/testsuite/systemtap.string/user_string_n_quoted.stp b/testsuite/systemtap.string/user_string_n_quoted.stp index e5db9f6df..73ab4de9a 100644 --- a/testsuite/systemtap.string/user_string_n_quoted.stp +++ b/testsuite/systemtap.string/user_string_n_quoted.stp @@ -1,9 +1,18 @@ -# Ensure that user_string_n_quoted truncates properly and there's no -# off-by-one error... PR15617 +# Ensure that user_string_n_quoted truncates properly by input length and +# there's no off-by-one error (see PR15617). Also ensures that +# user_string_n2_quoted properly truncates by output length. +# We avoid using @MAXSTRINGLEN to not have to require -g probe syscall.write { if (pid() == target()) { printf("%s\n", user_string_n_quoted(buf_uaddr, 15)) + printf("%s\n", user_string_n_quoted(buf_uaddr, 14)) + printf("%s\n", user_string_n_quoted(buf_uaddr, 13)) + printf("%s\n", user_string_n2_quoted(buf_uaddr, 99, 18)) + printf("%s\n", user_string_n2_quoted(buf_uaddr, 99, 17)) + printf("%s\n", user_string_n2_quoted(buf_uaddr, 99, 16)) + printf("%s\n", user_string_n2_quoted(buf_uaddr, 99, 15)) + printf("%s\n", user_string_n2_quoted(buf_uaddr, 99, 14)) exit() } } -- 2.43.5