File: rep_ret.exp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (62 lines) | stat: -rw-r--r-- 1,847 bytes parent folder | download | duplicates (6)
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
set test "rep_ret"

# This test is only for i386 and x86_64
# Test 32-on-64 when available
switch -regexp $::tcl_platform(machine) {
    {^i\d86$} { set arches [list "-default"] }
    {^x86_64$} { set arches [list "-m64" "-m32"]}
    default { unsupported "$test"; return }
}

foreach arch $arches {

  set exe ${test}${arch}
  verbose "testing $exe"

  set test_flags "additional_flags=-g"
  set test_flags "$test_flags additional_flags=-fomit-frame-pointer"

  if {$arch != "-default"} {
    set test_flags "$test_flags additional_flags=$arch"
  }

  set res [target_compile $srcdir/$subdir/$test.c $exe executable "$test_flags"]
  if { $res != "" } {
    verbose "target_compile $exe failed: $res" 2
    fail "${test}.c compile ${arch}"
    untested "$exe"
    return
  } else {
    pass "${test}.c compile ${arch}"
  }

  if {[installtest_p] && [uprobes_p]} {
    set ok 0
    set warn 0

    spawn stap -e {probe process(@1).function("*") { println(probefunc()) }} ./$exe -c ./$exe
    # We have two cases for main below to handle the possibility of main not being the first
    # line being printed out (but only one of the two will ever fire, so the count is still 3)
    # The test however does still ensure that main is followed by rep_ret then by repnz_ret.
    expect {
      -re {\r\nmain\r\n} { incr ok; exp_continue }
      -re {^main\r\n} { incr ok; exp_continue }
      -re {^rep_ret\r\n} { incr ok; exp_continue }
      -re {^repnz_ret\r\n} { incr ok; exp_continue }
      -re {^WARNING: Number of errors: 0, skipped probes: [^\r\n]*\r\n} { incr warn; exp_continue }
      timeout { fail "$exe (timeout)" }
      eof { }
    }
    catch { close }; catch { wait }

    if {$ok == 3 && $warn == 0} {
      pass "$exe"
    } else {
      fail "$exe ($ok, $warn)"
    }
  } else {
    untested "$exe"
  }
  catch {exec rm -f $exe}

}