forked from php-build/php-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·67 lines (52 loc) · 1.49 KB
/
run-tests.sh
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
#!/usr/bin/env bash
# Update this when a new stable version comes around
STABLE_DEFINITIONS="5.3.29 5.4.45 5.5.30 5.6.16 7.0.0RC8"
TIME="$(date "+%Y%m%d%H%M%S")"
DEFINITIONS="$(./bin/php-build --definitions)"
BUILD_PREFIX="/tmp/php-build-test-$TIME"
BUILD_LIST=
FAILED=
usage() {
echo "Usage: ./run-tests.sh all|stable|<definition>,..."
}
if ! which "bats" > /dev/null; then
echo "You need http://github.com/sstephenson/bats installed." >&2
exit 1
fi
case "$1" in
stable)
BUILD_LIST="$STABLE_DEFINITIONS"
;;
*)
if [ $# -eq 0 ]; then
usage
exit 1
fi
BUILD_LIST="$@"
;;
esac
echo "Testing definitions $BUILD_LIST"
echo
[ -n "$TRAVIS" ] && while true; do echo "..."; sleep 60; done & #https://github.com/php-build/php-build/issues/134
for definition in $BUILD_LIST; do
echo -n "Building '$definition'..."
if ./bin/php-build --pear "$definition" "$BUILD_PREFIX/$definition"; then
echo "OK"
export TEST_PREFIX="$BUILD_PREFIX/$definition"
grep -e 'install_pyrus' "share/php-build/definitions/$definition" > /dev/null
export INSTALL_PYRUS=$?
echo "Running Tests..."
bats "tests/"
else
echo "FAIL"
FAILED="$FAILED $definition"
fi
done
[ -n "$TRAVIS" ] && kill %1 #https://github.com/php-build/php-build/issues/134
if [ -z "$FAILED" ]; then
rm -rf "$BUILD_PREFIX"
else
echo "Build fail."
echo "Failed Definitions:$FAILED"
exit 1
fi