mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-22 03:07:20 +01:00
another patch from persgray@gmail.com, making commandLinePrintingTest run on both Linux and BSD
This commit is contained in:
parent
e0be917ef2
commit
bc490dad17
@ -1,47 +1,46 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
rm -f print.pdf >/dev/null 2>/dev/null
|
||||
|
||||
QTVERSION=`qmake --version | tail -n1| cut -d' ' -f4`
|
||||
TESTNAME=$(basename `pwd`)
|
||||
QTVERSION=$(${QMAKE:-qmake} --version 2>&1 | tail -n1| cut -d' ' -f4)
|
||||
TESTNAME=${0##/}
|
||||
PASSED=0
|
||||
FAILED=0
|
||||
SKIPPED=0
|
||||
|
||||
function pass # test_name
|
||||
pass() # test_name
|
||||
{
|
||||
echo "PASS : ${TESTNAME}::$1()"
|
||||
PASSED=$((PASSED+1))
|
||||
}
|
||||
|
||||
function fail # test_name
|
||||
fail() # test_name
|
||||
{
|
||||
echo "FAIL! : ${TESTNAME}::$1()"
|
||||
FAILED=$((FAILED+1))
|
||||
}
|
||||
|
||||
function output # test_name text
|
||||
output() # test_name text
|
||||
{
|
||||
echo -n "QDEBUG : ${TESTNAME}::$1() "
|
||||
shift
|
||||
echo $@
|
||||
}
|
||||
|
||||
function run_command # test_name command
|
||||
run_command() # test_name command
|
||||
{
|
||||
test=$1
|
||||
shift
|
||||
command=$@
|
||||
output=$($command 2>&1)
|
||||
output=$("$@" 2>&1)
|
||||
returned=$?
|
||||
ORIGIFS=$IFS
|
||||
IFS=`echo -en "\n\b"`
|
||||
IFS=`printf "\n\b"`
|
||||
for line in $output
|
||||
do
|
||||
output $test $line
|
||||
done
|
||||
IFS=$ORIGIFS
|
||||
[ $returned -eq 0 ] && pass $test || fail $test
|
||||
[ "$returned" -eq 0 ] && pass "$test" || fail "$test"
|
||||
}
|
||||
|
||||
|
||||
@ -51,8 +50,8 @@ pass "initTestCase"
|
||||
|
||||
# -------- actual testing goes here --------
|
||||
|
||||
run_command "runPrinting" "../../gui/fwbuilder -f test.fwb -P test"
|
||||
run_command "fileExists" "ls print.pdf"
|
||||
run_command "runPrinting" ../../gui/fwbuilder -f test.fwb -P test
|
||||
run_command "fileExists" ls print.pdf
|
||||
|
||||
# --------- end of actual testing ---------
|
||||
|
||||
@ -61,4 +60,4 @@ rm -f print.pdf >/dev/null 2>&1
|
||||
pass "cleanupTestCase"
|
||||
echo "Totals: ${PASSED} passed, ${FAILED} failed, ${SKIPPED} skipped"
|
||||
echo "********* Finished testing of ${TESTNAME} *********"
|
||||
[ ${FAILED} -eq 0 ] && exit 0 || exit 1
|
||||
[ "${FAILED}" -eq 0 ] && exit 0 || exit 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user