source: trunk/devel/run @ 995

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

more clean for rebuild

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