1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2025-10-16 07:28:25 +02:00

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

View File

@ -7,24 +7,15 @@ SUBDIRS = src doc
DOLLAR = $
build_tests.commands = cd src/unit_tests; \
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make build_tests; \
cd -
build_tests.commands = ./unit_tests.sh make build_tests
build_tests.depends = all
run_tests.commands = cd src/unit_tests; \
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make run_tests; \
cd -
run_tests.commands = ./unit_tests.sh make run_tests
run_tests.depends = all
tests.depends = run_tests
clean_tests.commands = cd src/unit_tests; \
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC && \
./unit_tests.sh make clean_tests; \
cd -
clean_tests.commands = ./unit_tests.sh make clean_tests
QMAKE_EXTRA_TARGETS += build_tests run_tests clean_tests tests

View File

@ -3,14 +3,11 @@ DOLLAR = $
libgui.target = ../libgui/libgui.a
libgui.commands = cd ../libgui && qmake -spec $$QMAKESPEC && make && cd -
build_tests.commands = echo "Building tests..."; \
./unit_tests.sh make build_tests
build_tests.commands = ./unit_tests.sh make build_tests
run_tests.commands = echo "Running tests..."; \
./unit_tests.sh make run_tests
run_tests.commands = ./unit_tests.sh make run_tests
clean_tests.commands = echo "Cleaning tests..."; \
./unit_tests.sh make clean
clean_tests.commands = ./unit_tests.sh make clean
build_tests.depends = libgui
run_tests.depends = libgui

View File

@ -1,24 +1,27 @@
#!/bin/bash
#!/bin/sh
set +x
QMAKE="${QMAKE:-qmake}"
QMAKEPARAMS="${QMAKESPEC:+ -spec $QMAKESPEC}"
commands=$@
set -e
build() {
directory=$1
shift
commands=$@
cd $directory
[ ! -e Makefile ] && qmake -spec $QMAKESPEC
$commands || exit 1
cd -
local _d="$1"
shift
(
cd "$_d" &&
([ -f Makefile ] || $QMAKE $QMAKEPARAMS) &&
"$@"
)
}
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
echo "======================= $directory"
build $directory $commands
echo "======================= $_d"
build "$_d" "$@"
done

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
home=`pwd`
cd $directory
[ -z $QMAKESPEC ] && { qmake || exit 1; } || { qmake -spec $QMAKESPEC || exit 1; }
$action || exit 1
cd $home
echo "===> Running tests in $directory"
(cd $directory && $QMAKE $QMAKEPARAMS && "$@")
done