summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/test.exp
blob: 98829cc4f177766dfe91602b19d73b5736e85cee (plain)
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
return  ;# this will need more rework for obj!=src testing

proc test_procedure {} {
global subdir
if {$subdir != ""} {
    cd $subdir
}

# compile sys.stp and keep it
catch {exec stap -kvvp4 sys.stp} res1
set path ""
regexp {Keeping temporary directory "([^\"]*)"} $res1 match path
if {$path == ""} {
  send_log "ERROR:\n$res1\n"
  fail "ERROR:\n$res1\n"
  return -1
}
foreach line [split $res1 \n] {
  if {[regexp {Pass 4: compiled C into "([^\"]*)"} $line match module]} {
	    break
        }
}

if {![info exists module]} { 
  send_log "Compiling sys.stp failed:\n$res1\n"
  fail "Compiling sys.stp failed:\n$res1\n"
  return -1
}

set flags ""
foreach filename [lsort [glob *.c]] {
  set file [string range $filename 0 end-2]
  target_compile $filename $file executable $flags
  send_log "Testing ${file}\n"
  set res [exec ./test.tcl $file $path/$module]
  if {$res == "PASS"} {
    pass "$file"
  } elseif {$res == "UNSUPP"} {
    unsupported "$file not supported on this arch"
  } else {
    fail "$file"
    send_log "$res\n"
  }
}

if {$tcl_platform(machine) == "x86_64"} {
  # on x86_64, test 32-bit and 64-bit binaries
  set flags "additional_flags=-m32"
  foreach filename [lsort [glob *.c]] {
    set file [string range $filename 0 end-2]
    target_compile $filename $file executable $flags
    send_log "Testing 32-bit ${file}\n"
    set res [exec ./test.tcl $file $path/$module]
    if {$res == "PASS"} {
      pass "32-bit $file"
    } elseif {$res == "UNSUPP"} {
      unsupported "$file not supported on this arch"
    } else {
      fail "32-bit $file"
      send_log "$res\n"
    }
  }
}

exec rm -rf $path
if {$subdir != ""} {
  cd ..
}
}

test_procedure