diff options
author | Elan Ruusamäe | 2019-08-07 20:08:32 (GMT) |
---|---|---|
committer | Elan Ruusamäe | 2019-08-07 20:56:55 (GMT) |
commit | 93d946f280ce84ad4cafa9358e2727e40871254e (patch) | |
tree | 025dfc6b1827fd46a9e1830bc5ad154276fd897b /dep-tests.sh | |
parent | e3002b0db6bacf2c0d275cc1d6e6b56017318739 (diff) | |
download | php-93d946f280ce84ad4cafa9358e2727e40871254e.zip php-93d946f280ce84ad4cafa9358e2727e40871254e.tar.gz |
dep-tests.sh: move main to function
Diffstat (limited to 'dep-tests.sh')
-rwxr-xr-x | dep-tests.sh | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/dep-tests.sh b/dep-tests.sh index 3d1a398..c79530a 100755 --- a/dep-tests.sh +++ b/dep-tests.sh @@ -33,31 +33,35 @@ dep_opcache='pcre' php=${PHP:-$(php-config --php-binary)} ext_dir=${EXTENSION_DIR:-$(php-config --extension-dir)} conf_dir=${CONFIG_DIR:-$(php-config --sysconfdir)/conf.d $(php-config --sysconfdir)/cli.d} -tmpini=$(mktemp) - -# poldek --sn ac-ready -u php-* -for ext in ${*:-$ext_dir/*.so}; do - [ -f $ext ] || continue - ext=${ext##*/}; ext=${ext%.so} - - deps=$(eval echo \$dep_$ext) - # add ext itself, if already not in list (spl case) - [[ $deps = *\ $ext\ * ]] || deps="$deps $ext" - - echo -n "$ext (deps: ${deps# })..." - - # special: opcache is listed as "Zend Opcache" - [ "$ext" = "opcache" ] && ext="zend opcache" - - grep -rlE '^(zend_)?extension=('$(echo "${deps# }" | tr ' ' '|')').so$' $conf_dir | LC_ALL=C sort | xargs cat > $tmpini - $php -n -d extension_dir=$ext_dir -c $tmpini -r "exit(extension_loaded('${ext}') ? 0 : 1);" - rc=$? - if [ $rc = 0 ]; then - echo OK - else - echo FAIL - echo "Failed config was:" - cat $tmpini - fi -done -rm -f $t + +test_deps() { + tmpini=$(mktemp) + + # poldek --sn ac-ready -u php-* + for ext in ${*:-$ext_dir/*.so}; do + [ -f $ext ] || continue + ext=${ext##*/}; ext=${ext%.so} + + deps=$(eval echo \$dep_$ext) + # add ext itself, if already not in list (spl case) + [[ $deps = *\ $ext\ * ]] || deps="$deps $ext" + + echo -n "$ext (deps: ${deps# })..." + + # special: opcache is listed as "Zend Opcache" + [ "$ext" = "opcache" ] && ext="zend opcache" + + grep -rlE '^(zend_)?extension=('$(echo "${deps# }" | tr ' ' '|')').so$' $conf_dir | LC_ALL=C sort | xargs cat > $tmpini + $php -n -d extension_dir=$ext_dir -c $tmpini -r "exit(extension_loaded('${ext}') ? 0 : 1);" + rc=$? + if [ $rc = 0 ]; then + echo OK + else + echo FAIL + echo "Failed config was:" + cat $tmpini + fi + done +} + +test_deps "$@" |