summaryrefslogtreecommitdiffstats
path: root/src/lib/rpc/unit-test/rpc_test.0/fullrun.exp
blob: 73083de1f14d9f2750a8f9c73f90adc36b9498d9 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
set timeout 120

load_lib "helpers.exp"

global spawn_id
global server_id
global server_started

if { !$server_started } {return} 

# Start the client and do a full run
start_client "full run" fullrun testuser notathena 8h 1026
set client_id $spawn_id

#
# test: did we get 11 dots?
#
verbose "Starting RPC echo test.  This will take about 50 seconds.\n"

set ver_line "rpc_test server: bad verifier\[^\r\n\]*\[\r\n]+"

set dots 0
set server_lines 0
while {1} {
	expect {
		-i $server_id
		-re $ver_line {
			verbose "Got line from server."
			incr server_lines
		}
		default {
			exp_continue
		}

		-i $client_id
		. { 
			incr dots
			verbose "$expect_out(buffer)" 1
			if ($dots==11) { break }
		}
		eof {
			#
			# test: was the exit status right?
			#
			wait_client "full run" fullrun $client_id 0
			break
		}

		timeout { 
			verbose "Timeout waiting for dot\n" 1
			fail "full run: timeout waiting for dot"
			break
		}
	}
}
if {$dots==11} {
	pass "fullrun: echo test"
} else {
	fail "fullrun: echo test: expected 11 dots, got $dots"
}

#
# test: server logged four bad verifiers?
#
verbose "full run: checking server output"

# Small timeout, since the server should have already printed everything
set timeout 5

while {$server_lines < 4} {
	expect {
		-i $server_id
		-re $ver_line {
			incr server_lines
		}
		-re ".+\r\n" {
			verbose "Unexpected server output: $expect_out(buffer)"
		}
		default {
			break
		}
	}
}

if {$server_lines == 4} {
	pass "fullrun: bad verifiers"
} else {
	fail "fullrun: expected four bad verifiers, got $server_lines"
}

flush_server