applied patch per SF bug 3302219

"unit tests are badly portable"
This commit is contained in:
Vadim Kurland
2011-05-14 22:47:37 -07:00
parent e149666e51
commit 04545f9818
4 changed files with 30 additions and 40 deletions
+3 -12
View File
@@ -7,24 +7,15 @@ SUBDIRS = src doc
DOLLAR = $ DOLLAR = $
build_tests.commands = cd src/unit_tests; \ build_tests.commands = ./unit_tests.sh make build_tests
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make build_tests; \
cd -
build_tests.depends = all build_tests.depends = all
run_tests.commands = cd src/unit_tests; \ run_tests.commands = ./unit_tests.sh make run_tests
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make run_tests; \
cd -
run_tests.depends = all run_tests.depends = all
tests.depends = run_tests tests.depends = run_tests
clean_tests.commands = cd src/unit_tests; \ clean_tests.commands = ./unit_tests.sh make clean_tests
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make clean_tests; \
cd -
QMAKE_EXTRA_TARGETS += build_tests run_tests clean_tests tests QMAKE_EXTRA_TARGETS += build_tests run_tests clean_tests tests
+3 -6
View File
@@ -3,14 +3,11 @@ DOLLAR = $
libgui.target = ../libgui/libgui.a libgui.target = ../libgui/libgui.a
libgui.commands = cd ../libgui && qmake -spec $$QMAKESPEC && make && cd - libgui.commands = cd ../libgui && qmake -spec $$QMAKESPEC && make && cd -
build_tests.commands = echo "Building tests..."; \ build_tests.commands = ./unit_tests.sh make build_tests
./unit_tests.sh make build_tests
run_tests.commands = echo "Running tests..."; \ run_tests.commands = ./unit_tests.sh make run_tests
./unit_tests.sh make run_tests
clean_tests.commands = echo "Cleaning tests..."; \ clean_tests.commands = ./unit_tests.sh make clean
./unit_tests.sh make clean
build_tests.depends = libgui build_tests.depends = libgui
run_tests.depends = libgui run_tests.depends = libgui
+17 -14
View File
@@ -1,24 +1,27 @@
#!/bin/bash #!/bin/sh
set +x QMAKE="${QMAKE:-qmake}"
QMAKEPARAMS="${QMAKESPEC:+ -spec $QMAKESPEC}"
commands=$@ set -e
build() { build() {
directory=$1 local _d="$1"
shift shift
commands=$@ (
cd $directory cd "$_d" &&
[ ! -e Makefile ] && qmake -spec $QMAKESPEC ([ -f Makefile ] || $QMAKE $QMAKEPARAMS) &&
$commands || exit 1 "$@"
cd - )
} }
build main $commands build main "$@"
for directory in `find . -maxdepth 1 -type d -regex '\./[A-Za-z0-9\-\_]*'` find . -maxdepth 1 -type d |
egrep -- '^\./[A-Za-z0-9_-]*$' |
while read _d
do do
echo "======================= $directory" echo "======================= $_d"
build $directory $commands build "$_d" "$@"
done done
+7 -8
View File
@@ -1,12 +1,11 @@
#!/bin/bash #!/bin/sh
action=$@ QMAKE="${QMAKE:-qmake}"
QMAKEPARAMS="${QMAKESPEC:+ -spec $QMAKESPEC}"
for directory in $(find . -name unit_tests) set -e
find . -mindepth 1 -type d -name unit_tests | while read directory
do do
home=`pwd` echo "===> Running tests in $directory"
cd $directory (cd $directory && $QMAKE $QMAKEPARAMS && "$@")
[ -z $QMAKESPEC ] && { qmake || exit 1; } || { qmake -spec $QMAKESPEC || exit 1; }
$action || exit 1
cd $home
done done