Skip to content

Commit 82c0350

Browse files
committedMar 27, 2021
release 3.0.1
1 parent 314cdcd commit 82c0350

File tree

2 files changed

+68
-11
lines changed

2 files changed

+68
-11
lines changed
 

‎manage.sh

+63-11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ usage () {
1111
exit 1
1212
}
1313

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+
1434
opts=$(getopt -u -o h -l help -- "$@")
1535
[ $? != 0 ] && usage
1636

@@ -34,15 +54,15 @@ mode="${1}"
3454
case "${mode}" in
3555
clean)
3656
cat <<-EOL
37-
[ -f Makefile ] && make distclean
57+
${bwhite}[ -f Makefile ] && make distclean
3858
rm -rf autom4te.cache build include modules
3959
rm -f .deps Makefile* ac*.m4 compile
4060
rm -f config.h* config.nice configure* config.sub config.guess
4161
rm -f install-sh ltmain.sh missing mkinstalldirs run-tests.php
4262
4363
rm -f package.xml
4464
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}
4666
----->
4767
EOL
4868

@@ -74,21 +94,53 @@ case "${mode}" in
7494
rm -f package.xml
7595
;;
7696
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+
77110
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
79120
exit $?
80121
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}"
82131
exit $?
83132
fi
84133

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
92144
;;
93145
stub)
94146
# stub tagging

‎package.xml.tmpl

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<file md5sum="@LICENSE@" name="LICENSE" role="doc" />
4040
<file md5sum="@config.m4@" name="config.m4" role="src" />
4141
<file md5sum="@magic.c@" name="magic.c" role="src" />
42+
<file md5sum="@magic_arginfo.h@" name="magic_arginfo.h" role="src" />
4243
<file md5sum="@php_magic.h@" name="php_magic.h" role="src" />
4344
<file md5sum="@sample.php@" name="sample.php" role="src" />
4445
<dir name="tests">
@@ -47,6 +48,10 @@
4748
<file md5sum="@tests/003-user-magicfile.phpt@" name="003-user-magicfile.phpt" role="test" />
4849
<file md5sum="@tests/004-with-flag.phpt@" name="004-with-flag.phpt" role="test" />
4950
<file md5sum="@tests/005-flag-magicfile.phpt@" name="005-flag-magicfile.phpt" role="test" />
51+
<file md5sum="@tests/006-magicfile-flag.phpt@" name="006-magicfile-flag.phpt" role="test" />
52+
<file md5sum="@tests/007-php-errormsg.phpt@" name="007-php-errormsg.phpt" role="test" />
53+
<file md5sum="@tests/008-error-get-last.phpt@" name="008-error-get-last.phpt" role="test" />
54+
<file md5sum="@tests/009-data-control.phpt@" name="009-data-control.phpt" role="test" />
5055
</dir>
5156
</dir> <!-- / -->
5257
</contents>

0 commit comments

Comments
 (0)