Line 1... |
Line 1... |
#!/bin/bash
|
#!/bin/bash
|
|
|
#the max server load that is permited for runing the parallel test
|
#the max server load that is permited for runing the parallel test
|
max_allowed_server_load=35
|
max_allowed_server_load=26
|
source "my_password.sh" # define servers and passwords
|
source "my_password.sh" # define servers and passwords
|
|
|
SCRPT_FULL_PATH=$(realpath ${BASH_SOURCE[0]})
|
SCRPT_FULL_PATH=$(realpath ${BASH_SOURCE[0]})
|
SCRPT_DIR_PATH=$(dirname $SCRPT_FULL_PATH)
|
SCRPT_DIR_PATH=$(dirname $SCRPT_FULL_PATH)
|
|
|
Line 13... |
Line 13... |
|
|
#servers=( $server1 $server2 $server3 ) # an array which define the list of servers
|
#servers=( $server1 $server2 $server3 ) # an array which define the list of servers
|
my_server="to be selected"
|
my_server="to be selected"
|
SERVER_ROOT_DIR="~/pronoc_verify"
|
SERVER_ROOT_DIR="~/pronoc_verify"
|
|
|
ProNoC="../../.."
|
ProNoC="$SCRPT_DIR_PATH/../../.."
|
|
|
my_srcs=( "rtl"
|
my_srcs=( "rtl"
|
"Integration_test"
|
"Integration_test"
|
"src_verilator"
|
"src_verilator"
|
"src_c/netrace-1.0"
|
"src_c/netrace-1.0"
|
|
"src_c/synfull"
|
"script"
|
"script"
|
"/perl_gui/lib/perl" )
|
"/perl_gui/lib/perl" )
|
|
|
|
|
rm "$SCRPT_DIR_PATH/report"
|
|
|
# A POSIX variable
|
|
OPTIND=1 # Reset in case getopts has been used previously in the shell.
|
|
|
|
# Initialize our own variables:
|
|
paralel_run=20
|
|
MIN=2
|
|
MAX=80
|
|
STEP=4
|
|
dir="models"
|
|
|
|
|
|
|
|
models_path=$(realpath $ProNoC/Integration_test/synthetic_sim)
|
|
|
|
|
|
|
|
|
|
while getopts "h?p:u:l:s:d:m:" opt; do
|
|
case "$opt" in
|
|
h|\?)
|
|
echo "./run [options]
|
|
|
|
[options]
|
|
-h show this help
|
|
-p <int number> : Enter the number of parallel simulations or
|
|
compilations. The default value is 4.
|
|
-u <int number> : Enter the maximum injection ratio in %. Default is 80
|
|
-l <int number> : Enter the minimum injection ratio in %. Default is 5
|
|
-s <int number> : Enter the injection step increase ratio in %.
|
|
Default value is 25.
|
|
-d <dir name> : The dir name where the simulation models configuration
|
|
files are located in. The default dir is \"models\"
|
|
-m <simulation model name1,simulation model name2,...> : Enter the
|
|
simulation model name in simulation dir. If the
|
|
simulation model name is not provided, it runs the
|
|
simulation for all existing models in model dir.
|
|
"
|
|
|
|
declare -a dirs
|
|
i=1
|
|
for d in $models_path/*/
|
|
do
|
|
m=$(basename "${d%/}")
|
|
if [ $m != "src" ]; then
|
|
dirs[i++]="$m"
|
|
fi
|
|
done
|
|
echo " For -d option, there are ${#dirs[@]} dir names available:"
|
|
for((i=1;i<=${#dirs[@]};i++))
|
|
do
|
|
echo " $i ${dirs[i]}"
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
;;
|
|
p) paralel_run=$OPTARG
|
|
;;
|
|
u) MAX=$OPTARG
|
|
;;
|
|
l) MIN=$OPTARG
|
|
;;
|
|
s) STEP=$OPTARG
|
|
;;
|
|
d) dir=$OPTARG
|
|
;;
|
|
m) model="-m $OPTARG"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
[ "${1:-}" = "--" ] && shift
|
|
|
|
echo "paralel_run=$paralel_run, MAX=$MAX, MIN=$MIN, STEP=$STEP, dir=$dir models=$model Leftovers: $@"
|
|
|
|
|
|
|
|
args="-p $paralel_run -u $MAX -l $MIN -s $STEP -d $dir $model"
|
|
|
|
|
|
|
|
report="${SCRPT_DIR_PATH}/reports/${dir}_report"
|
|
|
|
|
|
rm $report
|
|
|
|
|
|
|
|
|
#copy_sources
|
#copy_sources
|
#login_in_server
|
#login_in_server
|
|
|
#step one login in tje server and read the load
|
#step one login in tje server and read the load
|
function get_server_avg_load {
|
function get_server_avg_load {
|
out=$(sshpass -p $my_passwd ssh -t -o "StrictHostKeyChecking no" $1 "uptime")
|
out=$(ssh -t -o "StrictHostKeyChecking no" $1 "uptime")
|
load_avg=$(grep -oP '(?<=load average: )[0-9]+' <<< $out)
|
load_avg=$(grep -oP '(?<=load average: )[0-9]+' <<< $out)
|
}
|
}
|
|
|
|
|
function select_a_server {
|
function select_a_server {
|
Line 61... |
Line 150... |
echo "server $my_server is selected for running the test"
|
echo "server $my_server is selected for running the test"
|
}
|
}
|
|
|
|
|
function copy_sources {
|
function copy_sources {
|
sshpass -p $my_passwd ssh -o "StrictHostKeyChecking no" $my_server rm -rf ${SERVER_ROOT_DIR}
|
ssh -o "StrictHostKeyChecking no" $my_server rm -rf ${SERVER_ROOT_DIR}
|
sshpass -p $my_passwd ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc/perl_gui/lib/"
|
ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc/perl_gui/lib/"
|
sshpass -p $my_passwd ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc/src_c/"
|
ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc/src_c/"
|
sshpass -p $my_passwd ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc_work"
|
ssh -o "StrictHostKeyChecking no" $my_server mkdir -p "${SERVER_ROOT_DIR}/mpsoc_work"
|
for i in "${my_srcs[@]}"; do
|
for i in "${my_srcs[@]}"; do
|
echo "Copy $i on the server"
|
echo "Copy $i on the server"
|
sshpass -p $my_passwd scp -o "StrictHostKeyChecking no" -r "$ProNoC/$i" "$my_server:${SERVER_ROOT_DIR}/mpsoc/$i"
|
scp -o "StrictHostKeyChecking no" -r "$ProNoC/$i" "$my_server:${SERVER_ROOT_DIR}/mpsoc/$i"
|
done
|
done
|
sshpass -p $my_passwd scp -o "StrictHostKeyChecking no" -r "$SCRPT_DIR_PATH/server_run.sh" "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/server_run.sh"
|
scp -o "StrictHostKeyChecking no" -r "$SCRPT_DIR_PATH/server_run.sh" "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim/server_run.sh"
|
}
|
}
|
|
|
|
|
function run_test {
|
function run_test {
|
cmd="export PRONOC_WORK=${SERVER_ROOT_DIR}/mpsoc_work;"
|
cmd="export PRONOC_WORK=${SERVER_ROOT_DIR}/mpsoc_work;"
|
sshpass -p $my_passwd ssh -t -o "StrictHostKeyChecking no" $my_server $cmd
|
ssh -t -o "StrictHostKeyChecking no" $my_server $cmd
|
|
|
}
|
}
|
|
|
#setps to run the verrification
|
#setps to run the verrification
|
|
|
Line 87... |
Line 176... |
select_a_server
|
select_a_server
|
#2
|
#2
|
copy_sources
|
copy_sources
|
#3 run the test
|
#3 run the test
|
|
|
sshpass -p $my_passwd ssh -o "StrictHostKeyChecking no" $my_server "cd ${SERVER_ROOT_DIR}/mpsoc/Integration_test; source \"/etc/profile\"; bash server_run.sh;"
|
ssh -o "StrictHostKeyChecking no" $my_server "cd ${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim; source \"/etc/profile\"; bash server_run.sh $args;"
|
|
|
#collect the report
|
#collect the report
|
rm "$SCRPT_DIR_PATH/report"
|
rm "$report"
|
sshpass -p $my_passwd scp -o "StrictHostKeyChecking no" -r "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/report" "$SCRPT_DIR_PATH/report"
|
scp -o "StrictHostKeyChecking no" -r "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim/report" "$report"
|
wait
|
wait
|
gedit "$SCRPT_DIR_PATH/report"
|
meld "$report" "${report}_old" &
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|