#!/bin/bash
-TEMP=`getopt -o dhsSmfq --long debug,help,failnorerun,quiet,serial,tct,modules -n 'execute.sh' -- "$@"`
+TEMP=`getopt -o dhsSmfqp: --long debug,help,failnorerun,quiet,serial,tct,modules,prefix: -n 'execute.sh' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
echo -e " execute.sh\t\tExecute test cases from all modules in parallel"
echo -e " execute.sh -f \tExecute test cases from all modules in parallel without rerunning failed test cases"
echo -e " execute.sh -d <testcase>\tDebug testcase"
+ echo -e " execute.sh -p <prefix>\tExecute all testcases named with <prefix>"
echo -e " execute.sh [module]\tExecute test cases from the given module in parallel"
echo -e " execute.sh -s [module]\t\tExecute test cases in serial using Testkit-Lite"
echo -e " execute.sh -S [module]\t\tExecute test cases in serial"
opt_debug=0
opt_noFailedRerun="";
opt_quiet="";
+opt_match="";
while true ; do
case "$1" in
-h|--help) usage ;;
-f|--nofailedrerun) opt_noFailedRerun="-f" ; shift ;;
-S|--serial) opt_serial="-s" ; shift ;;
-q|--quiet) opt_quiet="-q" ; shift ;;
+ -p|--prefix) opt_match="-m $2" ; shift 2;;
-m|--modules) opt_modules=1 ; shift ;;
--) shift; break;;
*) echo "Internal error $1!" ; exit 1 ;;
echo -e "$ASCII_BOLD"
echo -e "Executing $mod$ASCII_RESET"
output_start $mod
- dbus-launch build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun $opt_quiet
+ dbus-launch build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun $opt_quiet $opt_match
output_end $mod
done
summary_end
module=$1
shift;
output_start ${module}
- dbus-launch build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $opt_quiet $*
+ dbus-launch build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $opt_quiet $opt_match $*
output_end ${module}
summary_end
done
echo $1 not found
fi
+
+ # Kill off any dangling or sleeping dbus sessions that we would have created
+ cgroup=$(awk -F ':' '$2 == "name=systemd" { print $3 }' /proc/self/cgroup)
+ if [ -n "$cgroup" ] ; then
+ for pid in $(cat /sys/fs/cgroup/systemd/$cgroup/tasks 2>/dev/null); do
+ comm=$(cat /proc/$pid/comm 2>/dev/null)
+ case "$comm" in
+ dbus-daemon|dbus-launch)
+ kill $pid
+ ;;
+ esac
+ done
+ fi
fi
if [ -f summary.xml ] ; then