summaryrefslogtreecommitdiffstats
path: root/bz987158.exp
blob: 77e3a6126de827bdb75c81b49e7dbf920f382035 (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
#!expect
#
# bz987158 workaround to conveniently suppress some red-zone related
# spurious warnings caused by OpenSSL under certain circumstances.
#
# Usage:
# $ vim bz987158.exp
# $ expect bz987158.exp | col > my.supp
# $ valgrind --suppressions=my.supp ...
#
# To debug the script uncomment the "puts" lines (note: overapprox.).
#
# jpokorny[at]redhat, distributed under terms of GPLv2+

set cmd "genhash"
set args "-s 127.0.0.1 -p 4433 -S -u \"/\""
set valgrind "valgrind"

# foo|bar combination
set searchfor "aesni_cbc_encrypt" 
set cnt 0

log_user 0

spawn sh -c "$valgrind --track-origins=yes --gen-suppressions=yes -- $cmd $args 2>&1"
expect {
	-re ".*($searchfor).*" {
		#send_error "Setting suppression for: $expect_out(1,string)\r"
		#send_error "Whole block:\r$expect_out(0,string)\r"
		expect "*Print suppression" {send "y\r"}
		expect "*{" {puts "\{"}
		expect "<insert_a_suppression_name_here>" {
			incr cnt
			puts "   bz987158-$cmd-$cnt"
		}
		expect "\n" {}
		expect "*}" {puts "$expect_out(0,string)"}
		exp_continue
	}
	"*Print suppression*" {
		send "n\r"
		exp_continue
	}
}