-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
executable file
·121 lines (114 loc) · 6.35 KB
/
test.sh
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
116
117
#!/bin/bash
set -e
#we flush the ARP cache because outdated ARP entries may let tests fail
sudo ip -s -s neigh flush all
if [ $# -ge 1 ]; then
TASK=$1
else
TASK=all
fi
case $TASK in
# the following first targets are testing the TcpEngine as mode=DelayedProxyEngine or SimpleProxyEngine
test_rfs_ip)
export RUST_LOG="tcp_lib=info,test_tcp_proxy=debug,e2d2=info"
export RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test test_tcp_proxy | jq -r 'select((.profile.test == true) and (.target.name == "test_tcp_proxy")) | .filenames[]'`
echo $executable
echo ./tests/test_rfs_ip.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
test_rfs_ip.2)
export RUST_LOG="tcp_lib=info,test_tcp_proxy=info,e2d2=info"
export RUST_BACKTRACE=1
executable=`cargo test $2 --no-run --message-format=json --test test_tcp_proxy | jq -r 'select((.profile.test == true) and (.target.name == "test_tcp_proxy")) | .filenames[]'`
echo $executable
echo ./tests/test_rfs_ip.2.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
test_rfs_port)
export RUST_LOG="tcp_lib=debug,test_tcp_proxy=debug,e2d2=info,netfcts=debug"tcp
export RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test test_tcp_proxy | jq -r 'select((.profile.test == true) and (.target.name == "test_tcp_proxy")) | .filenames[]'`
echo $executable
echo ./tests/test_rfs_port.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
timeout)
export RUST_BACKTRACE=1
export RUST_LOG="tcp_lib=debug,timeout=debug,e2d2=info"
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test timeout | jq -r 'select((.profile.test == true) and (.target.name == "timeout")) | .filenames[]'`
echo $executable
echo ./tests/timeout.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
timeout.2)
export RUST_BACKTRACE=1
export RUST_LOG="tcp_lib=info,timeout=info,e2d2=info"
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test timeout | jq -r 'select((.profile.test == true) and (.target.name == "timeout")) | .filenames[]'`
echo $executable
echo ./tests/timeout.2.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" $executable --nocapture
;;
client_syn_fin)
export RUST_LOG="tcp_lib=info,client_syn_fin=info,e2d2=info"
export RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test client_syn_fin | jq -r 'select((.profile.test == true) and (.target.name == "client_syn_fin")) | .filenames[]'`
echo $executable
echo ./tests/client_syn_fin.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
client_syn_fin.2)
export RUST_LOG="tcp_lib=info,client_syn_fin=info,e2d2=info"
executable=`cargo test $2 --no-run --message-format=json --test client_syn_fin | jq -r 'select((.profile.test == true) and (.target.name == "client_syn_fin")) | .filenames[]'`
echo $executable
echo ./tests/client_syn_fin.2.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" $executable --nocapture
;;
## the following targets are testing the TcpEngine as mode=TrafficEngine
test_as_client)
export RUST_LOG="tcp_lib=debug,e2d2=debug", RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test test_as_client | jq -r 'select((.profile.test == true) and (.target.name == "test_as_client")) | .filenames[]'`
echo $executable
echo ./tests/test_gen.toml > tests/toml_file.txt
sudo -E env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
test_as_server)
export RUST_LOG="tcp_lib=info,e2d2=info", RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test test_as_server | jq -r 'select((.profile.test == true) and (.target.name == "test_as_server")) | .filenames[]'`
echo $executable
echo ./tests/test_gen.toml > tests/toml_file.txt
sudo -E env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
macswap)
export RUST_LOG="tcp_lib=info,macswap=info,e2d2=info", RUST_BACKTRACE=1
executable=`cargo test $2 $3 $4 --no-run --message-format=json --test macswap | jq -r 'select((.profile.test == true) and (.target.name == "macswap")) | .filenames[]'`
echo $executable
echo ./tests/macswap.toml > tests/toml_file.txt
sudo -E env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
test_as_client.2)
export RUST_LOG="tcp_lib=info,e2d2=info", RUST_BACKTRACE=1
executable=`cargo test $2 --no-run --message-format=json --test test_as_client | jq -r 'select((.profile.test == true) and (.target.name == "test_as_client")) | .filenames[]'`
echo $executable
echo ./tests/test_gen.2.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH; LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
test_as_server.2)
export RUST_LOG="tcp_lib=info,e2d2=info", RUST_BACKTRACE=1
executable=`cargo test $2 --no-run --message-format=json --test test_as_server | jq -r 'select((.profile.test == true) and (.target.name == "test_as_server")) | .filenames[]'`
echo $executable
echo ./tests/test_gen.2.toml > tests/toml_file.txt
sudo -E env "PATH=$PATH" $executable --nocapture
;;
macswap.2)
export RUST_LOG="tcp_lib=info,macswap=info,e2d2=info", RUST_BACKTRACE=1
executable=`cargo test $2 --no-run --message-format=json --test macswap | jq -r 'select((.profile.test == true) and (.target.name == "macswap")) | .filenames[]'`
echo $executable
echo ./tests/macswap.2.toml > tests/toml_file.txt
sudo -E env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" $executable --nocapture
;;
all)
./test.sh test_as_client $2 $3 $4
./test.sh test_as_server $2 $3 $4
;;
esac