source: trunk/devel/run @ 1002

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

refactor: default args for run

  • Property svn:executable set to *
File size: 2.8 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 \
83    && CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
[988]84    && make clean all
[982]85    exit
86    ;;
87make)
[980]88    MAKEARGS=("$@")
[982]89    ;;
90esac
[980]91
[982]92LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
[980]93ret=${PIPESTATUS[0]}
94if [[ $ret -ne 0 || $type = make ]]; then
95    exit $ret
96fi
97
[977]98cmd=()
99tracer=()
100case "$basename" in
101*-apache1*)
102    cmd=($HOME/apache1/bin/httpd -X)
103    ;;
104*-apache*)
105    exit 1
106    ;;
107*)
[998]108    cmd=(./php-cgi -q -c devel.ini)
[977]109    "${cmd[@]}" -v
110    ;;
111esac
112
113case "${args[0]}" in
114fcgi)
115    args=(-b 1026)
116    shift
117    ;;
118esac
119
120case "$type" in
121ltr*)
122    export USE_ZEND_ALLOC=0
123    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
124    ;;
125str*)
126    tracer=(strace -s1024 -T ./php-cgi)
127    ;;
128gdb)
129    #USE_ZEND_ALLOC=0
130    tracer=(gdb --args)
131    ;;
132val*)
133    export USE_ZEND_ALLOC=0
134    tracer=(valgrind --gen-suppressions=all)
135    ;;
136dc)
[998]137    exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
[977]138    ;;
139dop)
[998]140    exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}"
[977]141    ;;
142retest)
143    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
144    ;;
145test)
146    case "${args[0]}" in
147    *.phpt)
148        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
149        ;;
150    */)
151        exec make xcachetest TESTS="${args[@]}"
152        ;;
153    *)
154        exec make xcachetest
155        ;;
156    esac
157    ;;
158esac
159
160export XCACHE_SKIP_FCGI_WARNING=1
161echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
162exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.