-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathait-run
executable file
·85 lines (63 loc) · 1.83 KB
/
ait-run
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
#!/bin/bash
# Run the test, collect results, add to the database
# Later use ait-plot
# Arnaldo Carvalho de Melo <[email protected]>
SERVER_MACHINE=$(hostname)
. ait.config
if [ $# -ne 1 ] ; then
echo "usage: ait-run config-file"
exit 1
fi
CONFIG_FILE=$1
if [ ! -f $CONFIG_FILE ] ; then
echo "$CONFIG_FILE not found!"
exit 1
fi
. $CONFIG_FILE
if [ -z "$TESTNAME" ] ; then
echo "TESTNAME variable not set and not present in $CONFIG_FILE"
exit 1
fi
CLIENT_APP=$AIT_DIR/ait-client-$TESTNAME
LOCK_STAT_DIR=lock_stat
# killall leftover clients
ssh $CLIENT_MACHINE killall -q $CLIENT_PROCESS_NAME 2> /dev/null
if [ $? -eq 255 ] ; then
echo "Start sshd on the $CLIENT_MACHINE client machine"
exit 1
fi
mkdir -p $REPORT_DIR 2> /dev/null
if [ -n "$LOG_FILE" ] ; then
# Remove logfile from previous runs
ssh $CLIENT_MACHINE rm $REPORT_DIR/$LOG_FILE
fi
# If /proc/lock_stat exists, reset it
if [ -f /proc/lock_stat ] ; then
rm -f $LOCK_STAT_DIR/last
echo 0 > /proc/lock_stat
fi
# remove old client report
ssh $CLIENT_MACHINE rm -f $REPORT_DIR/$REPORT_FILE
# Run the client
ssh $CLIENT_MACHINE $CLIENT_APP $SERVER_MACHINE $METRIC_RANGE > $REPORT_DIR/$REPORT_FILE
if [ $? -ne 0 ] ; then
cat $REPORT_DIR/$REPORT_FILE
exit 1
fi
# If /proc/lock_stat exists, take a snapshot
if [ -f /proc/lock_stat ] ; then
cat /proc/lock_stat > $LOCK_STAT_DIR/last
fi
if [ -n "$LOG_FILE" ] ; then
rm -f $LOG_FILE
# Get the client log file, to extract the client config
scp $CLIENT_MACHINE:$REPORT_DIR/$LOG_FILE .
fi
# Get server information
./ait-get-sysinfo $SERVER_PROCESS_NAME > ${SERVER_MACHINE}.sysinfo
# Get client information
ssh $CLIENT_MACHINE $AIT_DIR/ait-get-sysinfo $CLIENT_PROCESS_NAME > ${CLIENT_MACHINE}.sysinfo
mkdir -p reports/$TESTNAME/
# Collect it!
./ait-db-add-$TESTNAME $DBNAME $CLIENT_MACHINE $SERVER_MACHINE $REPORT_DIR/$REPORT_FILE
exit 0