File: cache.exp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (75 lines) | stat: -rw-r--r-- 2,979 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# cache.exp

# Since we need a clean cache directory, we'll use a temporary
# systemtap directory and cache (add user name so make check and
# sudo make installcheck don't clobber each others)
set local_systemtap_dir [exec pwd]/.cache_test-[exec whoami]
exec /bin/rm -rf $local_systemtap_dir
if [info exists env(SYSTEMTAP_DIR)] {
    set old_systemtap_dir $env(SYSTEMTAP_DIR)
}
set env(SYSTEMTAP_DIR) $local_systemtap_dir

# Set up the scripts we'll use.
set basic_script1 "\"probe begin { println(1) }\""
set basic_script2 "\"probe begin, end { println(2) }\""
set error_script "\"probe XbeginX { }\""
set var_script1 {{probe kernel.function("schedule_timeout") { println($jiffies) }}}

# Check basic functionality.  The 1st compilation of a script won't
# be cached, the 2nd should be cached.
cache_compile BASIC1 [F_UNCACHED_COMPILE] $basic_script1
cache_compile BASIC2 [F_CACHED_COMPILE] $basic_script1

# Adding in a macro definition should change the hash
cache_compile OPTION1 [F_UNCACHED_COMPILE] $basic_script1 -DFOO=1
cache_compile OPTION2 [F_CACHED_COMPILE] $basic_script1 -DFOO=1

# Using '-b' (bulk/relayfs mode) should change the hash
cache_compile BULK1 [F_UNCACHED_COMPILE] $basic_script1 -b
cache_compile BULK2 [F_CACHED_COMPILE] $basic_script1 -b

# Using '-t' (benchmark timing) should change the hash
cache_compile TIMING1 [F_UNCACHED_COMPILE] $basic_script1 -t
cache_compile TIMING2 [F_CACHED_COMPILE] $basic_script1 -t

# Changing the runtime directory should change the hash
set new_runtime [exec pwd]/.cache_test_runtime
exec /bin/rm -f $new_runtime
exec /bin/ln -s $env(SYSTEMTAP_RUNTIME) $new_runtime
cache_compile RUNTIME1 [F_UNCACHED_COMPILE] $basic_script1 -R $new_runtime
cache_compile RUNTIME2 [F_CACHED_COMPILE] $basic_script1 -R $new_runtime
exec /bin/rm -f $new_runtime

# Disable the cache with SYSTEMTAP_DIR
set env(SYSTEMTAP_DIR) /dev/null
cache_compile DISABLED1 [F_UNCACHED_COMPILE] $basic_script1
cache_compile DISABLED2 [F_UNCACHED_COMPILE] $basic_script1
set env(SYSTEMTAP_DIR) $local_systemtap_dir
eval [list exec /bin/rm -f] [glob "stap_*.ko"]

# Disable the cache with '-m'
cache_compile MODNAM1 [F_UNCACHED_COMPILE] $basic_script1 -m modnam
exec /bin/rm -f modnam.ko
cache_compile MODNAM2 [F_UNCACHED_COMPILE] $basic_script1 -m modnam
exec /bin/rm -f modnam.ko

# Make sure scripts that don't actually compile don't get cached
cache_compile ERROR1 [F_UNCACHED_NO_COMPILE] $error_script
cache_compile ERROR2 [F_UNCACHED_NO_COMPILE] $error_script

# Make sure basic stuff still works.
cache_compile BASIC3 [F_UNCACHED_COMPILE] $basic_script2
cache_compile BASIC4 [F_CACHED_COMPILE] $basic_script2

# Make sure vardie_from_symtable caches correctly (PR18936)
cache_compile VAR1 [F_UNCACHED_COMPILE] $var_script1
cache_compile VAR2 [F_CACHED_COMPILE] $var_script1

# Cleanup.
exec /bin/rm -rf $local_systemtap_dir
if [info exists old_systemtap_dir] {
    set env(SYSTEMTAP_DIR) $old_systemtap_dir
} else {
    unset env(SYSTEMTAP_DIR)
}