source: trunk/devel/run @ 988

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

run devel stuffs in source dir

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2# this script is for developers only
3
4case "$1" in
5prep*)
6    exec ./devel/prepare
7    ;;
8tags)
9    exec ./devel/prepare tags
10    ;;
11esac
12
13. run.cfg
14
15basename=$(basename $(pwd))
16if echo $basename | grep -- - >/dev/null; then :; else
17    dirs=${dirs:-php5-debug}
18
19    for dir in $dirs; do
20        cd ../${basename}-${dir} || exit
21
22        rm -f php-src
23        find -L . -type l | xargs rm -f
24        lndir ../$basename >/dev/null
25        find . -iname .\*.swp | xargs rm -f
26        ln -sf ~/src/php/$dir php-src
27        for i in ~/src/php/$dir/sapi/cgi/php{,-cgi}; do
28            [[ -r $i ]] && ln -sf "$i" php-cgi
29        done
30        ln -sf ~/src/php/$dir/sapi/cli/php php-cli
31
32        pwd
33        $0 "$@"
34    done
35    exit
36fi
37phpbasename=${basename#*-}
38xcachebasename=${basename%%-*}
39
40if [[ ! -z $1 ]]; then
41    type=$1
42    shift
43
44    if [[ ! -z $1 ]]; then
45        args=("$@")
46    elif [[ -z $args ]]; then
47        args=(test.php)
48    fi
49fi
50
51case "$type" in
52reb*)
53    PHPDIRS=${PHPDIRS:-$HOME/test}
54    if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
55        echo $PHPDIRS/$phpbasename/bin/phpize not found
56        exit
57    fi
58    export PATH=$PHPDIRS/$phpbasename/bin:$PATH
59    phpize --clean \
60    && phpize \
61    && CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
62    && make clean all
63    exit
64    ;;
65make)
66    MAKEARGS=("$@")
67    ;;
68esac
69
70LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
71ret=${PIPESTATUS[0]}
72if [[ $ret -ne 0 || $type = make ]]; then
73    exit $ret
74fi
75
76cmd=()
77tracer=()
78case "$basename" in
79*-apache1*)
80    cmd=($HOME/apache1/bin/httpd -X)
81    ;;
82*-apache*)
83    exit 1
84    ;;
85*)
86    cmd=(./php-cgi -q -c php.ini)
87    "${cmd[@]}" -v
88    ;;
89esac
90
91case "${args[0]}" in
92fcgi)
93    args=(-b 1026)
94    shift
95    ;;
96esac
97
98case "$type" in
99ltr*)
100    export USE_ZEND_ALLOC=0
101    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
102    ;;
103str*)
104    tracer=(strace -s1024 -T ./php-cgi)
105    ;;
106gdb)
107    #USE_ZEND_ALLOC=0
108    tracer=(gdb --args)
109    ;;
110val*)
111    export USE_ZEND_ALLOC=0
112    tracer=(valgrind --gen-suppressions=all)
113    ;;
114dc)
115    exec ./php-cli -c php.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
116    ;;
117dop)
118    exec ./php-cli -c php.ini ./bin/phpdop.phpr "${args[@]}"
119    ;;
120retest)
121    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
122    ;;
123test)
124    case "${args[0]}" in
125    *.phpt)
126        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
127        ;;
128    */)
129        exec make xcachetest TESTS="${args[@]}"
130        ;;
131    *)
132        exec make xcachetest
133        ;;
134    esac
135    ;;
136esac
137
138export XCACHE_SKIP_FCGI_WARNING=1
139echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
140exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.