From: Jonathan Lebon Date: Tue, 5 Nov 2013 15:17:12 +0000 (-0500) Subject: update user_string_n_quoted.exp test case X-Git-Tag: release-2.4~12 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=12d05899a39efac3f5298601f56caf8cb7709897;p=systemtap.git 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. --- 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() } }