-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnome-test-all
executable file
·65 lines (52 loc) · 1.34 KB
/
gnome-test-all
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
#!/bin/bash
#
# Script that runs a test emerge from clean
#
BASEDIR="${HOME}/gnome-test"
DATE=$(date "+%F-%T")
OUTDIR="${BASEDIR}/${DATE}"
# Set usage output
USAGE="[-h |--help] [<test-directory>]"
LONGUSAGE="\t-h, --help\n\t\tPrint this help message
\t<test-directory>\n\t\tDirectory to work in; defaults to ${BASEDIR}/date"
# Standard functions
source ${SCRIPTS}/functions.sh
# Script name
ME=$(basename $0)
# Parse arguments
ARGS=`getopt -o h --long help -n "${ME}" -- "$@"`
if [ $? != 0 ] ; then
usage
fi
eval set -- "$ARGS"
while true ; do
case "$1" in
-h|--help) usage; shift ;;
--) shift ; break ;;
* ) usage "Invalid argument $1";;
esac
done
# Remaining arguments are in $1, $2, etc. as normal
if [ -n "${1}" ]; then
OUTDIR=${1}
fi
if [ ! -d ${OUTDIR} ]; then
mkdir -p ${OUTDIR}/failed
mkdir -p ${OUTDIR}/succeeded
cp ${BASEDIR}/pkglist ${OUTDIR}
fi
# We need the whole pipe to fail if gnome-test fails
set -o pipefail
for i in $(cat ${OUTDIR}/pkglist); do
FNAME=$(echo $i | sed 's#/#:#')
if gnome-test $i | tee ${OUTDIR}/current; then
RESULT="succeeded"
mv ${OUTDIR}/current ${OUTDIR}/succeeded/${FNAME}
else
RESULT="failed"
mv ${OUTDIR}/current ${OUTDIR}/failed/${FNAME}
fi
echo "${i} ${RESULT}" >> ${OUTDIR}/finished
done
DONECOUNT=$(cat ${OUTDIR}/finished | wc -l)
vim -i NONE -c "${DONECOUNT}d" -c "wq" ${OUTDIR}/pkglist