sim: bfin: tweak run-tests for parallel usage
This commit is contained in:
parent
9fb7353ff0
commit
b6857b1e6c
2 changed files with 34 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* run-tests.sh: Add support for running in parallel.
|
||||||
|
|
||||||
2013-06-17 Mike Frysinger <vapier@gentoo.org>
|
2013-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* se_allopcodes.h: Add debugging related comments.
|
* se_allopcodes.h: Add debugging related comments.
|
||||||
|
|
|
@ -10,6 +10,7 @@ usage() {
|
||||||
-rs Run on simulator
|
-rs Run on simulator
|
||||||
-rj <board> Run on board via JTAG
|
-rj <board> Run on board via JTAG
|
||||||
-rh <ip> Run on board ip
|
-rh <ip> Run on board ip
|
||||||
|
-j <num> Num jobs to run
|
||||||
EOF
|
EOF
|
||||||
exit ${0:-1}
|
exit ${0:-1}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +21,14 @@ boardjtag=
|
||||||
run_sim=false
|
run_sim=false
|
||||||
run_jtag=false
|
run_jtag=false
|
||||||
run_host=false
|
run_host=false
|
||||||
|
jobs=`getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`
|
||||||
|
: $(( jobs += 1 ))
|
||||||
while [ -n "$1" ] ; do
|
while [ -n "$1" ] ; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-rs) run_sim=true;;
|
-rs) run_sim=true;;
|
||||||
-rj) boardjtag=$2; shift; run_jtag=true;;
|
-rj) boardjtag=$2; shift; run_jtag=true;;
|
||||||
-rh) boardip=$2; shift; run_host=true;;
|
-rh) boardip=$2; shift; run_host=true;;
|
||||||
|
-j) jobs=$2; shift;;
|
||||||
-*) usage;;
|
-*) usage;;
|
||||||
*) break;;
|
*) break;;
|
||||||
esac
|
esac
|
||||||
|
@ -36,6 +40,8 @@ if ${run_host} && [ -z "${boardip}" ] ; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cd "${0%/*}" || exit 1
|
||||||
|
|
||||||
dorsh() {
|
dorsh() {
|
||||||
# rsh sucks and does not pass up its exit status, so we have to:
|
# rsh sucks and does not pass up its exit status, so we have to:
|
||||||
# on board:
|
# on board:
|
||||||
|
@ -85,7 +91,6 @@ dojtag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
testit() {
|
testit() {
|
||||||
|
|
||||||
local name=$1 x=$2 y=`echo $2 | sed 's:\.[xX]$::'` out rsh_out addr
|
local name=$1 x=$2 y=`echo $2 | sed 's:\.[xX]$::'` out rsh_out addr
|
||||||
shift; shift
|
shift; shift
|
||||||
local fail=`grep xfail ${y}`
|
local fail=`grep xfail ${y}`
|
||||||
|
@ -145,8 +150,7 @@ pf() {
|
||||||
[ $# -eq 0 ] && set -- *.[Ss]
|
[ $# -eq 0 ] && set -- *.[Ss]
|
||||||
bins_hw=$( (${run_sim} || ${run_jtag}) && printf '%s.x ' "$@")
|
bins_hw=$( (${run_sim} || ${run_jtag}) && printf '%s.x ' "$@")
|
||||||
if ${run_host} ; then
|
if ${run_host} ; then
|
||||||
for files in $@
|
for files in "$@" ; do
|
||||||
do
|
|
||||||
tmp=`grep -e CYCLES -e TESTSET -e CLI -e STI -e RTX -e RTI -e SEQSTAT $files -l`
|
tmp=`grep -e CYCLES -e TESTSET -e CLI -e STI -e RTX -e RTI -e SEQSTAT $files -l`
|
||||||
if [ -z "${tmp}" ] ; then
|
if [ -z "${tmp}" ] ; then
|
||||||
bins_host=`echo "${bins_host} ${files}.X"`
|
bins_host=`echo "${bins_host} ${files}.X"`
|
||||||
|
@ -194,20 +198,41 @@ if ${run_host} ; then
|
||||||
rsh -l root $boardip '/bin/dmesg -c' > /dev/null
|
rsh -l root $boardip '/bin/dmesg -c' > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SIM="../../../bfin/run"
|
||||||
|
if [ ! -x ${SIM} ] ; then
|
||||||
|
SIM="bfin-elf-run"
|
||||||
|
fi
|
||||||
|
echo "Using sim: ${SIM}"
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
unexpected_fail=0
|
unexpected_fail=0
|
||||||
unexpected_pass=0
|
unexpected_pass=0
|
||||||
expected_pass=0
|
expected_pass=0
|
||||||
|
pids=()
|
||||||
for s in "$@" ; do
|
for s in "$@" ; do
|
||||||
${run_sim} && testit SIM ${s}.x bfin-elf-run `sed -n '/^# sim:/s|^[^:]*:||p' ${s}`
|
(
|
||||||
|
out=$(
|
||||||
|
${run_sim} && testit SIM ${s}.x ${SIM} `sed -n '/^# sim:/s|^[^:]*:||p' ${s}`
|
||||||
${run_jtag} && testit JTAG ${s}.x dojtag
|
${run_jtag} && testit JTAG ${s}.x dojtag
|
||||||
${run_host} && testit HOST ${s}.X dorsh
|
${run_host} && testit HOST ${s}.X dorsh
|
||||||
|
)
|
||||||
|
case $out in
|
||||||
|
*PASS*) ;;
|
||||||
|
*) echo "$out" ;;
|
||||||
|
esac
|
||||||
|
) &
|
||||||
|
pids+=( $! )
|
||||||
|
if [[ ${#pids[@]} -gt ${jobs} ]] ; then
|
||||||
|
wait ${pids[0]}
|
||||||
|
pids=( ${pids[@]:1} )
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
|
|
||||||
killall -q bfin-gdbproxy
|
killall -q bfin-gdbproxy
|
||||||
if [ ${ret} -eq 0 ] ; then
|
if [ ${ret} -eq 0 ] ; then
|
||||||
rm -f gdbproxy.log
|
rm -f gdbproxy.log
|
||||||
${MAKE} -s clean &
|
# ${MAKE} -s clean &
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo number of failures ${ret}
|
echo number of failures ${ret}
|
||||||
|
@ -222,4 +247,3 @@ else
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue