Skip to content

Commit 9491b61

Browse files
committed
Hook up exit handler properly
1 parent 8bd9427 commit 9491b61

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

contrib/load-tester/run.sh

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,57 @@
44
# echo "core.%e.%p" > /proc/sys/kernel/core_pattern
55
# http://stackoverflow.com/a/18368068
66

7+
function main() {
8+
if [[ -z "$SUDO_USER" ]]; then
9+
echo "Hey, you should run this with sudo"
10+
exit 1
11+
fi
712

8-
if [[ -z "$SUDO_USER" ]]; then
9-
echo "Hey, you should run this with sudo"
10-
exit 1
11-
fi
13+
echo "core.%e.%p" > /proc/sys/kernel/core_pattern
14+
ulimit -c unlimited
1215

13-
echo "core.%e.%p" > /proc/sys/kernel/core_pattern
14-
ulimit -c unlimited
16+
COUNT=40
17+
echo "Make sure to configure GatewayInterface in wifidog_mock.conf"
1518

16-
COUNT=40
17-
echo "Make sure to configure GatewayInterface in wifidog_mock.conf"
19+
./generate_interfaces.sh start $COUNT || exit 1
1820

19-
./generate_interfaces.sh start $COUNT || exit 1
21+
sudo -u "$SUDO_USER" ./mock_auth.py &
22+
MA_PID="$!"
2023

21-
sudo -u "$SUDO_USER" ./mock_auth.py &
22-
MA_PID="$!"
24+
# work around libtool stuff - do not execute wrapper!
25+
#EXEC="../../src/.libs/wifidog"
26+
#export LD_LIBRARY_PATH="../../libhttpd/.libs/"
27+
# trace-children is necessary because of the libtool wrapper -.-
28+
#valgrind --leak-check=full --trace-children=yes --trace-children-skip=/bin/sh \
29+
# --log-file=valgrind.log $EXEC -d 7 -f -c wifidog-mock.conf -a /tmp/arp 2> wifidog.log &
2330

24-
# work around libtool stuff - do not execute wrapper!
25-
#EXEC="../../src/.libs/wifidog"
26-
#export LD_LIBRARY_PATH="../../libhttpd/.libs/"
27-
# trace-children is necessary because of the libtool wrapper -.-
28-
#valgrind --leak-check=full --trace-children=yes --trace-children-skip=/bin/sh \
29-
# --log-file=valgrind.log $EXEC -d 7 -f -c wifidog-mock.conf -a /tmp/arp 2> wifidog.log &
31+
# for -fsanitize=address
32+
export ASAN_OPTIONS=check_initialization_order=1
33+
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5
3034

31-
# for -fsanitize=address
32-
export ASAN_OPTIONS=check_initialization_order=1
33-
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5
3435

36+
../../src/wifidog -d 7 -f -c wifidog-mock.conf -a /tmp/arp &> wifidog.log &
37+
WD_PID="$!"
3538

36-
../../src/wifidog -d 7 -f -c wifidog-mock.conf -a /tmp/arp &> wifidog.log &
37-
WD_PID="$!"
3839

40+
sudo -u "$SUDO_USER" ./plot_memory.sh $WD_PID &
41+
M_PID="$!"
3942

40-
sudo -u "$SUDO_USER" ./plot_memory.sh $WD_PID &
41-
M_PID="$!"
43+
IF=`sudo -u "$SUDO_USER" grep GatewayInterface wifidog-mock.conf | cut -f 2 -d ' '`
4244

43-
IF=`sudo -u "$SUDO_USER" grep GatewayInterface wifidog-mock.conf | cut -f 2 -d ' '`
45+
echo "Waiting for wifidog to come up"
4446

45-
echo "Waiting for wifidog to come up"
47+
sleep 10
4648

47-
sleep 10
49+
sudo -u "$SUDO_USER" ./fire_requests.py \
50+
--target-interface $IF \
51+
--source-interface-prefix mac \
52+
--source-interface-count $COUNT \
53+
--process-count 3
4854

49-
sudo -u "$SUDO_USER" ./fire_requests.py \
50-
--target-interface $IF \
51-
--source-interface-prefix mac \
52-
--source-interface-count $COUNT \
53-
--process-count 3
55+
#./generate_interfaces.sh stop
5456

55-
#./generate_interfaces.sh stop
57+
}
5658

5759
function cleanup() {
5860

@@ -64,3 +66,5 @@ function cleanup() {
6466
}
6567

6668
trap cleanup EXIT
69+
70+
main

0 commit comments

Comments
 (0)