source: trunk/devel/run @ 982

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

move files to subdirs

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