Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/array_string.exp

raw
1 # PR 11220. Make sure we can store large strings in arrays.
2
3 if {![installtest_p]} { untested $test; return }
4
5 set test "ARRAY_STRING"
6
7 set test_script {
8 global str
9 global str_array[1]
10
11 probe begin {
12 str = " 0:123456789+123456789+123456789+123456789+123456789+123456789 1:123456789+123456789+123456789+123456789+123456789+123456789 2:123456789+123456789+123456789+123456789+123456789+123456789 3:123456789+123456789+123456789+123456789+123456789+123456789 4:123456789+123456789+123456789+123456789+123456789+123456789 5:123456789+123456789+123456789+123456789+123456789+123456789 6:123456789+123456789+123456789+123456789+123456789+123456789 7:123456789+123456789+123456789+123456789+123456789+123456789"
13 str_array[0] = str
14 printf("systemtap starting probe\n")
15 }
16
17 probe end {
18 printf("systemtap ending probe\n")
19 if (strlen(str) < 500) {
20 printf("string str is too short: %d\n", strlen(str))
21 printf("%s\n", str)
22 }
23 if (strlen(str) == strlen(str_array[0])) {
24 printf("string lengths match\n")
25 }
26 else {
27 printf("string lengths *don't* match\n")
28 printf("str: %d\n", strlen(str))
29 printf("str_array[0]: %d\n", strlen(str_array[0]))
30 }
31 if (str_array[0] == str) {
32 printf("strings match\n")
33 }
34 else {
35 printf("strings *don't* match!\n")
36 printf("str: %s\n", str)
37 printf("str_array[0]: %s\n", str_array[0])
38 }
39 }
40 }
41
42 set output "string lengths match\r\nstrings match\r\n"
43
44 # Set MAXSTRINGLEN to 512 to be sure we're testing what we intend.
45 foreach runtime [get_runtime_list] {
46 if {$runtime != ""} {
47 stap_run "$test ($runtime)" no_load $output -DMAXSTRINGLEN=512 \
48 --runtime=$runtime -e $test_script
49 } else {
50 stap_run $test no_load $output -DMAXSTRINGLEN=512 -e $test_script
51 }
52 }