File: pid.tcl

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (32 lines) | stat: -rw-r--r-- 813 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
set tests [list execname pexecname pid ppid tid uid euid gid egid]
spawn stap $srcdir/$subdir/pid.stp
#exp_internal 1
expect {
    -timeout 120
    "READY" {
	set pid [exec echo 1 > /proc/stap_test_cmd &]
	set ppid {[0-9]*}
	set uid [exec id -ru]
	set gid [exec id -rg]
	set euid [exec id -u]
	set egid [exec id -g]
	set results [list "execname: echo\r\n" "pexecname: expect\r\n" "pid: $pid\r\n" "ppid: $ppid\r\n" "tid: $pid\r\n" "uid: $uid\r\n" "euid: $euid\r\n" "gid: $gid\r\n" "egid: $egid\r\n"]
	
	set i 0
	foreach t $tests {
	    expect {
		-timeout 5
		-re [lindex $results $i] {
		    pass $t
		}
		timeout {fail "$t - timeout"}
		eof {fail "$t - unexpected EOF"}
	    }
	    incr i
	}
    }
    timeout {fail "all pid tests - timeout"}
    eof {fail "all pid tests - unexpected EOF"}
}
catch {close}
wait