source: trunk/devel/run @ 1062

Last change on this file since 1062 was 1062, checked in by moo, 2 years ago

const some mem handlers
split non-shared data from shm
make editor goto file correctly

  • Property svn:executable set to *
File size: 4.5 KB
RevLine 
[977]1#!/bin/bash
2# this script is for developers only
[998]3set -e
[977]4
[998]5. devel/run.cfg
6if [[ ! -z $1 ]]; then
7    type=$1
8fi
9
10case "$type" in
[988]11prep*)
12    exec ./devel/prepare
13    ;;
[1011]14dep*)
15    pwd=$(readlink -f "$(pwd)")
16    builddir=$(readlink -f ../trunk-php5-debug)
17    if [[ -z $builddir ]]; then
18        echo required ../trunk-php5-debug not found
19        return 1
20    fi
[1018]21    find . -iname \*.c | sort | while read -r sourceFile; do
[1011]22        sourceFile=${sourceFile#./}
[1015]23        case "$sourceFile" in
24        includes.c)
25            echo -n "\$(XCACHE_INCLUDES_I) "
26            ;;
27        esac
[1011]28        echo -n "\$(builddir)/${sourceFile%.c}.lo:"
29        for dependency in $(gcc -M $sourceFile -I$HOME/test/php5-debug/include/php/{,main,Zend,TSRM} -I. -I${builddir} -MG | sed 's#.*:##g' | sed 's#\\##g'); do
30            dependency=$(readlink -f "$dependency")
31            case "$dependency" in
32            $pwd/*)
33                dependency=${dependency#$pwd/}
34                ;;
35            $builddir/*)
36                dependency="\$(builddir)/"${dependency#$builddir/}
37                ;;
38            esac
39
40            case "$dependency" in
41            /*) ;;
42            $sourceFile) ;;
43            \$\(builddir\)/xc_processor.h)
44                echo -n " \$(XCACHE_PROC_H)"
45                ;;
46            \$\(builddir\)/xc_processor.c.h)
47                echo -n " \$(XCACHE_PROC_C)"
48                ;;
49            *)
50                if [[ -r $dependency ]]; then
51                    echo -n " \$(srcdir)/$dependency"
52                else
53                    echo "$dependency not found" >&2
54                fi
55            esac
56        done
57        echo
58    done > Makefile.frag.deps
59    exit
60    ;;
[998]61xtest)
62    exec /usr/bin/make -f devel/test.mak
63    ;;
[988]64tags)
65    exec ./devel/prepare tags
66    ;;
67esac
68
[977]69basename=$(basename $(pwd))
70if echo $basename | grep -- - >/dev/null; then :; else
[998]71    svn propget svn:ignore . > .svnignore
72
[977]73    dirs=${dirs:-php5-debug}
74    for dir in $dirs; do
[998]75        mkdir -p ../${basename}-${dir}
[977]76        cd ../${basename}-${dir} || exit
[998]77        lndir ../${basename} > /dev/null
[982]78
[977]79        pwd
80        $0 "$@"
81    done
82    exit
83fi
[995]84
[982]85phpbasename=${basename#*-}
86xcachebasename=${basename%%-*}
[995]87xcachesrcdir=../$xcachebasename
[977]88
[1019]89if [[ $# -gt 0 ]]; then
[977]90    type=$1
91    shift
[1025]92    if [[ $# -gt 0 ]]; then
93        args=("$@")
94    fi
[977]95fi
96
[1002]97if [[ -z ${args[0]} ]]; then
[1025]98    args=(devel.php)
[1002]99fi
100
[988]101case "$type" in
[1013]102phpize)
[998]103    if [[ -r Makefile ]]; then
[1024]104        make xcachesvnclean || true
[998]105    fi
106    ;;
107esac
108
109rm -f php-src
110find -L . -type l | xargs rm -f
111lndir "$xcachesrcdir" >/dev/null
112find . -iname .\*.swp | xargs rm -f
113ln -sf ~/src/php/$phpbasename php-src
114for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
115    if [[ -r $i ]]; then
116        ln -sf "$i" php-cgi
117    fi
118done
119ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
[1048]120ln -sf ~/src/php/$phpbasename/sapi/fpm/php-fpm php-fpm
[998]121
122case "$type" in
[1013]123phpize)
[982]124    PHPDIRS=${PHPDIRS:-$HOME/test}
125    if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
126        echo $PHPDIRS/$phpbasename/bin/phpize not found
127        exit
128    fi
129    export PATH=$PHPDIRS/$phpbasename/bin:$PATH
130    phpize --clean \
131    && phpize \
[1044]132    && CFLAGS="-g -O0 -Wall -Wno-unused -W -Wshadow -Werror=implicit-function-declaration -std=c89 -D_GNU_SOURCE -D_POSIX_SOURCE -Dinline=" ./configure \
[1003]133        --enable-xcache-cacher \
134        --enable-xcache-optimizer \
135        --enable-xcache-encoder \
136        --enable-xcache-decoder \
137        --enable-xcache-disassembler \
[1006]138        --enable-xcache-coverager \
[1022]139        --enable-xcache-test \
140        --enable-xcache-constant
[982]141    exit
142    ;;
143make)
[980]144    MAKEARGS=("$@")
[982]145    ;;
146esac
[980]147
[1022]148LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 \
[1062]149| sed -ur \
150    -e 's#Werror=implicit-function-declaration#We/rror=i/mplicit-function-declaration#' \
151    -e 's#\./xc_processor\.h#'$PWD'/xc_processor.h#' \
152    -e 's#\./xc_processor\.c\.h#'$PWD'/xc_processor.c.h#' \
[1022]153| hi error implicit warn FAIL
[980]154ret=${PIPESTATUS[0]}
155if [[ $ret -ne 0 || $type = make ]]; then
156    exit $ret
157fi
158
[977]159cmd=()
160tracer=()
161case "$basename" in
162*-apache1*)
163    cmd=($HOME/apache1/bin/httpd -X)
164    ;;
165*-apache*)
166    exit 1
167    ;;
168*)
[1048]169    case "${args[0]}" in
170    fcgi)
171        cmd=(./php-cgi -q -c devel.ini)
172        args=(-b 1026)
173        ;;
174    fpm)
175        cmd=(./php-fpm -c devel.ini)
176        args=(-y devel.fpm)
177        ;;
178    *)
179        cmd=(./php-cgi -q -c devel.ini)
180        ;;
181    esac
182
[1024]183    "${cmd[@]}" -v || true
[977]184esac
185
186case "$type" in
187ltr*)
188    export USE_ZEND_ALLOC=0
189    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
190    ;;
191str*)
[1028]192    tracer=(strace -s1024 -T)
[977]193    ;;
194gdb)
195    #USE_ZEND_ALLOC=0
196    tracer=(gdb --args)
197    ;;
198val*)
199    export USE_ZEND_ALLOC=0
200    tracer=(valgrind --gen-suppressions=all)
201    ;;
202dc)
[1053]203    exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
[977]204    ;;
205dop)
[1053]206    exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}"
[977]207    ;;
208retest)
209    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
210    ;;
211test)
212    case "${args[0]}" in
213    *.phpt)
214        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
215        ;;
216    */)
217        exec make xcachetest TESTS="${args[@]}"
218        ;;
219    *)
220        exec make xcachetest
221        ;;
222    esac
223    ;;
224esac
225
226export XCACHE_SKIP_FCGI_WARNING=1
227echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
228exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.