forked from php-build/php-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·73 lines (58 loc) · 1.71 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
68
69
70
71
72
73
#!/usr/bin/env bash
# Update this when a new stable version comes around
STABLE_DEFINITIONS="5.3.29 5.4.45 5.5.38 5.6.40 7.0.33 7.1.33 7.2.34 7.3.23 7.4.11"
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 ! command -v 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 "$definition" "$BUILD_PREFIX/$definition"; then
echo "BUILD OK"
export TEST_PREFIX="$BUILD_PREFIX/$definition"
export DEFINITION_CONFIG=$(./bin/php-build --definition "$definition")
export PHP_MINOR_VERSION=${definition%.*}
export PHP_MAJOR_VERSION=${definition:0:1}
echo "Running Tests..."
if bats "tests/"; then
echo "TEST OK"
else
echo "TEST FAIL"
FAILED="$FAILED $definition"
fi
else
echo "BUILD 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