@@ -11,6 +11,26 @@ usage () {
11
11
exit 1
12
12
}
13
13
14
+ normal=" $( tput sgr0 ) "
15
+ bold=" $( tput bold ) "
16
+ black=" $( tput setaf 0 ) "
17
+ red=" $( tput setaf 1 ) "
18
+ green=" $( tput setaf 2 ) "
19
+ yellow=" $( tput setaf 3 ) "
20
+ blue=" $( tput setaf 4 ) "
21
+ megenta=" $( tput setaf 5 ) "
22
+ cyan=" $( tput setaf 6 ) "
23
+ white=" $( tput setaf 7 ) "
24
+ bblack=" ${bold}${black} "
25
+ bred=" ${bold}${red} "
26
+ bgreen=" ${bold}${green} "
27
+ byellow=" ${bold}${yellow} "
28
+ bblue=" ${bold}${blue} "
29
+ bmegenta=" ${bold}${megenta} "
30
+ bcyan=" ${bold}${cyan} "
31
+ bwhite=" ${bold}${white} "
32
+ tcolor=" ${bblack} $( tput setab 7 ) "
33
+
14
34
opts=$( getopt -u -o h -l help -- " $@ " )
15
35
[ $? != 0 ] && usage
16
36
@@ -34,15 +54,15 @@ mode="${1}"
34
54
case " ${mode} " in
35
55
clean)
36
56
cat << -EOL
37
- [ -f Makefile ] && make distclean
57
+ ${bwhite} [ -f Makefile ] && make distclean
38
58
rm -rf autom4te.cache build include modules
39
59
rm -f .deps Makefile* ac*.m4 compile
40
60
rm -f config.h* config.nice configure* config.sub config.guess
41
61
rm -f install-sh ltmain.sh missing mkinstalldirs run-tests.php
42
62
43
63
rm -f package.xml
44
64
find ./tests ! -name '*.phpt' -a ! -name '*.txt' -a -type f
45
- rm -f magic_arginfo.h && git checkout -- magic_arginfo.h
65
+ rm -f magic_arginfo.h && git checkout -- magic_arginfo.h${normal}
46
66
----->
47
67
EOL
48
68
@@ -74,21 +94,53 @@ case "${mode}" in
74
94
rm -f package.xml
75
95
;;
76
96
test)
97
+ PHPBIN=/opt/php-qa/php${2} /bin/php
98
+ PHPIZE=/opt/php-qa/php${2} /bin/phpize
99
+ PHPCONFIG=/opt/php-qa/php${2} /bin/php-config
100
+ PHP_OPT=" "
101
+
102
+ if [[ $# == 2 ]]; then
103
+ ./manage.sh clean
104
+ echo " ${PHPIZE} && ./configure"
105
+ ${PHPIZE} && ./configure && make -j8 || exit 0
106
+ fi
107
+
108
+ PHP_OPT+=" -d 'track_errors=1' -d 'extension_dir=./modules/' -d 'extension=magic.so'"
109
+
77
110
if [[ -f tests/${3} .php ]]; then
78
- /usr/bin/php${2} -d " extension_dir=./modules/" -d " extension=magic" tests/${3} .php
111
+ cat << -EOL
112
+ ${bgreen} ------------------------------------------------------------------------
113
+ Sample code execution:
114
+
115
+ ${bcyan}${PHPBIN} ${PHP_OPT} test/${3} .php
116
+ ${bgreen} ------------------------------------------------------------------------${normal}
117
+
118
+ EOL
119
+ ${PHPBIN} ${PHP_OPT} test/${3} .php
79
120
exit $?
80
121
elif [[ -f ${3} ]]; then
81
- /usr/bin/php${2} -d " extension_dir=./modules/" -d " extension=magic" ${3}
122
+ cat << -EOL
123
+ ${bgreen} ------------------------------------------------------------------------
124
+ Sample code execution:
125
+
126
+ ${bcyan}${PHPBIN} ${PHP_OPT} ${3}
127
+ ${bgreen} ------------------------------------------------------------------------${normal}
128
+
129
+ EOL
130
+ eval " ${PHPBIN} ${PHP_OPT} ${3} "
82
131
exit $?
83
132
fi
84
133
85
- if [[ -z $3 ]]; then
86
- ./manage.sh clean
87
- echo " phpize${2} ./configure"
88
- phpize${2} && ./configure && make -j8 || exit 0
89
- fi
90
- echo " make test PHP_EXECUTABLE=/usr/bin/php${2} "
91
- make test PHP_EXECUTABLE=/usr/bin/php${2} <<< n
134
+ cat << -EOL
135
+ ${bwhite} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136
+ ${tcolor} ** MAKE test:: ${normal}
137
+ ${bwhite} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138
+
139
+ ${bcyan} make test PHP_EXECUTABLE=${PHPBIN}
140
+ ${bwhite} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~${normal}
141
+
142
+ EOL
143
+ make test PHP_EXECUTABLE=${PHPBIN} <<< n
92
144
;;
93
145
stub)
94
146
# stub tagging
0 commit comments