source: trunk/devel/run @ 1006

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

fix win32 build

  • Property svn:executable set to *
File size: 3.0 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    ;;
[998]14xtest)
15    exec /usr/bin/make -f devel/test.mak
16    ;;
[988]17tags)
18    exec ./devel/prepare tags
19    ;;
20esac
21
[977]22basename=$(basename $(pwd))
23if echo $basename | grep -- - >/dev/null; then :; else
[998]24    svn propget svn:ignore . > .svnignore
25
[977]26    dirs=${dirs:-php5-debug}
27    for dir in $dirs; do
[998]28        mkdir -p ../${basename}-${dir}
[977]29        cd ../${basename}-${dir} || exit
[998]30        lndir ../${basename} > /dev/null
[982]31
[977]32        pwd
33        $0 "$@"
34    done
35    exit
36fi
[995]37
[982]38phpbasename=${basename#*-}
39xcachebasename=${basename%%-*}
[995]40xcachesrcdir=../$xcachebasename
[977]41
42if [[ ! -z $1 ]]; then
43    type=$1
44    shift
45
[1002]46    args=("$@")
[977]47fi
48
[1002]49if [[ -z ${args[0]} ]]; then
50    args=(devel.php)
51fi
52
[988]53case "$type" in
[985]54reb*)
[998]55    if [[ -r Makefile ]]; then
56        make xcachesvnclean
57    fi
58    ;;
59esac
60
61rm -f php-src
62find -L . -type l | xargs rm -f
63lndir "$xcachesrcdir" >/dev/null
64find . -iname .\*.swp | xargs rm -f
65ln -sf ~/src/php/$phpbasename php-src
66for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
67    if [[ -r $i ]]; then
68        ln -sf "$i" php-cgi
69    fi
70done
71ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
72
73case "$type" in
74reb*)
[982]75    PHPDIRS=${PHPDIRS:-$HOME/test}
76    if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
77        echo $PHPDIRS/$phpbasename/bin/phpize not found
78        exit
79    fi
80    export PATH=$PHPDIRS/$phpbasename/bin:$PATH
81    phpize --clean \
82    && phpize \
[1003]83    && CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure \
84        --enable-xcache-cacher \
85        --enable-xcache-optimizer \
86        --enable-xcache-encoder \
87        --enable-xcache-decoder \
88        --enable-xcache-disassembler \
[1006]89        --enable-xcache-coverager \
[1003]90        --enable-xcache-test --enable-xcache-constant \
[988]91    && make clean all
[982]92    exit
93    ;;
94make)
[980]95    MAKEARGS=("$@")
[982]96    ;;
97esac
[980]98
[982]99LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
[980]100ret=${PIPESTATUS[0]}
101if [[ $ret -ne 0 || $type = make ]]; then
102    exit $ret
103fi
104
[977]105cmd=()
106tracer=()
107case "$basename" in
108*-apache1*)
109    cmd=($HOME/apache1/bin/httpd -X)
110    ;;
111*-apache*)
112    exit 1
113    ;;
114*)
[998]115    cmd=(./php-cgi -q -c devel.ini)
[977]116    "${cmd[@]}" -v
117    ;;
118esac
119
120case "${args[0]}" in
121fcgi)
122    args=(-b 1026)
123    shift
124    ;;
125esac
126
127case "$type" in
128ltr*)
129    export USE_ZEND_ALLOC=0
130    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
131    ;;
132str*)
133    tracer=(strace -s1024 -T ./php-cgi)
134    ;;
135gdb)
136    #USE_ZEND_ALLOC=0
137    tracer=(gdb --args)
138    ;;
139val*)
140    export USE_ZEND_ALLOC=0
141    tracer=(valgrind --gen-suppressions=all)
142    ;;
143dc)
[1003]144    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdc.phpr "${args[@]}" | tee decompiled.php
[977]145    ;;
146dop)
[1003]147    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdop.phpr "${args[@]}"
[977]148    ;;
149retest)
150    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
151    ;;
152test)
153    case "${args[0]}" in
154    *.phpt)
155        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
156        ;;
157    */)
158        exec make xcachetest TESTS="${args[@]}"
159        ;;
160    *)
161        exec make xcachetest
162        ;;
163    esac
164    ;;
165esac
166
167export XCACHE_SKIP_FCGI_WARNING=1
168echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
169exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.