-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_large.exp
executable file
·115 lines (104 loc) · 5.24 KB
/
run_large.exp
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/expect -f
#
# This Expect script was generated by autoexpect on Tue Jun 6 00:52:07 2023
# Expect and autoexpect were both written by Don Libes, NIST.
#
# Note that autoexpect does not guarantee a working script. It
# necessarily has to guess about certain things. Two reasons a script
# might fail are:
#
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
# etc.) and devices discard or ignore keystrokes that arrive "too
# quickly" after prompts. If you find your new script hanging up at
# one spot, try adding a short sleep just before the previous send.
# Setting "force_conservative" to 1 (see below) makes Expect do this
# automatically - pausing briefly before sending each character. This
# pacifies every program I know of. The -c flag makes the script do
# this in the first place. The -C flag allows you to define a
# character to toggle this mode off and on.
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
#
# 2) differing output - Some programs produce different output each time
# they run. The "date" command is an obvious example. Another is
# ftp, if it produces throughput statistics at the end of a file
# transfer. If this causes a problem, delete these patterns or replace
# them with wildcards. An alternative is to use the -p flag (for
# "prompt") which makes Expect only look for the last line of output
# (i.e., the prompt). The -P flag allows you to define a character to
# toggle this mode off and on.
#
# Read the man page for more info.
#
# -Don
set timeout -1
spawn bash -c "RUST_LOG=\"info\" cargo run --release --features big-array -- -i"
match_max 100000
# wait for 2 peers to connect
expect -exact "Discovered peer"
expect -exact "Discovered peer"
send -- "init"
send -- "\r"
expect -exact "Storage initialized"
# Start the timer
set start [clock clicks -microseconds]
send -- "put input/large_array/data.json"
send -- "\r"
# wait for both in any order
expect -re {(id Vid\(2\) was successfully.*id Vid\(1\) was successfully)|(id Vid\(1\) was successfully.*id Vid\(2\) was successfully)}
send -- "schedule input/large_array/program.json"
send -- "\r"
expect -exact "Program scheduled successfully"
expect {
-timeout 20 -exact "finished execution\r" {}
timeout { puts "Did not receive expected response"; exit 1 }
}
# Calculate the elapsed time
set end [clock clicks -microseconds]
set elapsed [expr {($end - $start) / 1000000.0}]
# matching first bytes should be enough
send -- "get 1"
send -- "\r"
expect {
-timeout 3 -exact "Vid(1): Data(\[9, 14, 205, 62, 107, 89, 152, 113, 157, 223, 19, 55, 201, 94, 5, 212, 84, 178, 12, 170, 20, 190, 218, 74, 163, 112, 140, 252, 242, 128, 210, 150, 90, 44, 180, 199, 40, 36, 63, 122, 75, 102, 20, 31, 170, 235, 230, 176, 121, 208, 112, 2, 219, 243, 123, 215, 84, 205, 143, 122, 126, 43, 34, 93, 40, 69, 10, 188, 169, 31, 136, 236, 96, 208, 11, 175, 116, 118, 68, 16, 210, 12, 122, 122, 232, 122, 3, 8" {}
timeout { puts "Did not receive expected response"; exit 1 }
}
send -- "get 2"
send -- "\r"
expect {
-timeout 3 -exact "Vid(2): Data(\[85, 92, 144, 107, 36, 168, 55, 245, 211, 92, 183, 244, 65, 102, 250, 90, 50, 219, 110, 205, 125, 51, 140, 222, 145, 145, 81, 86, 0, 58, 15, 110, 129, 203, 8, 245, 67, 49, 32, 96, 37, 215, 219, 51, 142, 200, 155, 157, 95, 3, 192, 193, 49" {}
timeout { puts "Did not receive expected response"; exit 1 }
}
send -- "get 3"
send -- "\r"
expect {
-timeout 3 -exact "Vid(3): Data(\[92, 82, 93, 85, 79, 241, 175, 132, 78, 131, 164, 195, 136, 56, 255, 142, 102, 105, 98, 103, 105, 141, 86, 148, 50, 225, 221, 170, 242, 186, 221, 248, 219, 231, 188, 50, 107, 21, 31, 26, 110, 177, 207, 44, 36, 35, 125, 45, 38, 211, 176, 195, 234, 173, 31, 187, 65, 190, 26, 247, 79, 46, 229, 243, 30, 220, 16, 14, 64, 255, 104, 209, 144, 43, 82, 162, 22, 164, 70, 178, 33, 222, 235, 240, 248, 24, 71, 97, 34, 103, 195, 139, 11, 79, 152, 212, 213, 38, 89, 85, 216, 112, 96, 65, 123, 212, 82, 229, 37, 15, 229, 229, 97, 140, 7, 167, 50, 106, 95, 22, 226, 95, 151, 169, 105, 159, 205, 221, 100, 232, 32, 165, 29, 8, 151, 54, 80, 139, 239, 158, 54, 6, 221, 35, 133, 34, 232, 51, 76, 43, 94, 233, 73, 88, 236, 77, 80, 28," {}
timeout { puts "Did not receive expected response"; exit 1 }
}
send -- "get 4"
send -- "\r"
expect {
-timeout 3 -exact "Vid(4): Data(\[92, 82, 93, 85, 79, 241, 175, 132, 78, 131, 164, 195, 136, 56, 255, 142, 102, 105, 98, 103, 105, 141, 86, 148, 50, 225, 221, 170, 242, 186, 221, 248, 219, 231, 188, 50, 107, 21, 31, 26, 110, 177, 207, 44, 36, 35, 125, 45, 38, 211, 176, 195" {}
timeout { puts "Did not receive expected response"; exit 1 }
}
send -- "get 5"
send -- "\r"
expect {
-timeout 3 -exact "Vid(5): Data(\[92, 82, 93, 85, 79, 241, 175, 132, 78, 131, 164, 195, 136, 56, 255, 142, 102, 105, 98, 103, 105, 141, 86, 148, 50, 225, 221, 170, 242, 186, 221, 248, 219, 231, 188, 50, 107, 21, 31, 26, 110, 177, 207, 44, 36, 35, 125, 45, 38, 211, 176, 195, 234" {}
timeout { puts "Did not receive expected response"; exit 1 }
}
send -- "quit"
expect "quit"
send -- "\r"
after 100
# Print the elapsed time
puts "Elapsed time: $elapsed seconds"
puts "Success!"
expect eof