]> sourceware.org Git - systemtap.git/commitdiff
update user_string_n_quoted.exp test case
authorJonathan Lebon <jlebon@redhat.com>
Tue, 5 Nov 2013 15:17:12 +0000 (10:17 -0500)
committerJonathan Lebon <jlebon@redhat.com>
Tue, 5 Nov 2013 15:22:27 +0000 (10:22 -0500)
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.

testsuite/systemtap.string/user_string_n_quoted.exp
testsuite/systemtap.string/user_string_n_quoted.stp

index 2cce43020267e42932244634c1ffb0d691c732c3..c2166fa1bb7b4b0195b76fe9d912f5bef662156b 100644 (file)
@@ -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"
index e5db9f6dfa43d5d9bc2e2afbd94fe94d37a07a3b..73ab4de9af1e71e8950f7f146f78913c426364aa 100644 (file)
@@ -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()
        }
 }
This page took 0.030138 seconds and 5 git commands to generate.