source: trunk/devel/run @ 1006

Last change on this file since 1006 was 1006, checked in by moo, 21 months ago

fix win32 build

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2# this script is for developers only
3set -e
4
5. devel/run.cfg
6if [[ ! -z $1 ]]; then
7    type=$1
8fi
9
10case "$type" in
11prep*)
12    exec ./devel/prepare
13    ;;
14xtest)
15    exec /usr/bin/make -f devel/test.mak
16    ;;
17tags)
18    exec ./devel/prepare tags
19    ;;
20esac
21
22basename=$(basename $(pwd))
23if echo $basename | grep -- - >/dev/null; then :; else
24    svn propget svn:ignore . > .svnignore
25
26    dirs=${dirs:-php5-debug}
27    for dir in $dirs; do
28        mkdir -p ../${basename}-${dir}
29        cd ../${basename}-${dir} || exit
30        lndir ../${basename} > /dev/null
31
32        pwd
33        $0 "$@"
34    done
35    exit
36fi
37
38phpbasename=${basename#*-}
39xcachebasename=${basename%%-*}
40xcachesrcdir=../$xcachebasename
41
42if [[ ! -z $1 ]]; then
43    type=$1
44    shift
45
46    args=("$@")
47fi
48
49if [[ -z ${args[0]} ]]; then
50    args=(devel.php)
51fi
52
53case "$type" in
54reb*)
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*)
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 \
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 \
89        --enable-xcache-coverager \
90        --enable-xcache-test --enable-xcache-constant \
91    && make clean all
92    exit
93    ;;
94make)
95    MAKEARGS=("$@")
96    ;;
97esac
98
99LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
100ret=${PIPESTATUS[0]}
101if [[ $ret -ne 0 || $type = make ]]; then
102    exit $ret
103fi
104
105cmd=()
106tracer=()
107case "$basename" in
108*-apache1*)
109    cmd=($HOME/apache1/bin/httpd -X)
110    ;;
111*-apache*)
112    exit 1
113    ;;
114*)
115    cmd=(./php-cgi -q -c devel.ini)
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)
144    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdc.phpr "${args[@]}" | tee decompiled.php
145    ;;
146dop)
147    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdop.phpr "${args[@]}"
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.