-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgnome-test
More file actions
executable file
·84 lines (70 loc) · 1.83 KB
/
gnome-test
File metadata and controls
executable file
·84 lines (70 loc) · 1.83 KB
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
#!/bin/bash
#
# Script that runs a test emerge from clean
#
# Set usage output
USAGE="[-h |--help] [-n | --no-tmpfs ] [-t | --test] <atom>"
LONGUSAGE="\t-h, --help\n\t\tPrint this help message
\t-n, --no-tmpfs\n\t\tDo not mount tmpfs
\t-t, --test\n\t\tRun tests on <atom> (and <atom> only)
\t<atom>\n\t\tDepend atom to emerge"
# Standard functions
source ${SCRIPTS}/functions.sh
# Script name
ME=$(basename $0)
# Parse arguments
ARGS=`getopt -o hnt --long help,no-tmpfs,test -n "${ME}" -- "$@"`
if [ $? != 0 ] ; then
usage
fi
eval set -- "$ARGS"
while true ; do
case "$1" in
-h|--help) usage; shift ;;
-n|--no-tmpfs) NOTMPFS="yes"; shift ;;
-t|--test) TEST="yes"; shift ;;
--) shift ; break ;;
* ) usage "Invalid argument $1";;
esac
done
# Remaining arguments are in $1, $2, etc. as normal
PACKAGE=$1
CHROOT_BASE="/opt/chroots"
CHROOT_NAME="gnome"
CHROOT_DIR="${CHROOT_BASE}/${CHROOT_NAME}"
cd ${CHROOT_BASE} || die "no ${CHROOT_BASE}"
# clean up
echo "Testing ${PACKAGE}"
dchroot ${CHROOT_NAME} stop
if [ -z "${NOTMPFS}" ]; then
sudo umount -f ${CHROOT_DIR}
sudo mount -t tmpfs shm ${CHROOT_DIR}
else
sudo rm -rf ${CHROOT_DIR}
sudo mkdir -p ${CHROOT_DIR}
fi
cd ${CHROOT_DIR} || die "No ${CHROOT_DIR}"
sudo tar xjpf ${CHROOT_BASE}/${CHROOT_NAME}-current.tar.bz2
cd ${CHROOT_BASE}
dchroot -d ${CHROOT_NAME} start
dchroot ${CHROOT_NAME} run -- emerge -v ${PACKAGE}
retval=$?
if [ "${retval}" == "0" ]; then
echo "emerge ${PACKAGE} succeeded"
else
echo "emerge ${PACKAGE} failed"
fi
if [ "${retval}" == "0" ] && [ -n "${TEST}" ]; then
dchroot ${CHROOT_NAME} run -- FEATURES=test emerge -v ${PACKAGE}
tretval=$?
if [ "${tretval}" == "0" ]; then
echo " tests on ${PACKAGE} succeeded"
else
echo " tests on ${PACKAGE} failed"
fi
fi
dchroot ${CHROOT_NAME} stop
if [ -z "${NOTMPFS}" ]; then
sudo umount -f ${CHROOT_DIR}
fi
exit ${retval}