From 0009cb8171f141e113777e7f6557a0cfa1542d5a Mon Sep 17 00:00:00 2001 From: OBATA Akio Date: Thu, 15 Aug 2019 17:02:19 +0900 Subject: [PATCH] fix some sh portability fixes Replace bash specific way with POSIX one. Signed-off-by: OBATA Akio --- karm/test/__lib.sh | 8 ++++---- karm/test/booktime-baddate.sh | 4 ++-- karm/test/booktime-badduration.sh | 4 ++-- karm/test/booktime-badtime.sh | 4 ++-- karm/test/booktime-baduid.sh | 4 ++-- karm/test/booktime-works.sh | 4 ++-- karm/test/bug94447.sh | 2 +- karm/test/delete.sh | 4 ++-- karm/test/refresh_on_change.sh | 4 ++-- karm/test/version.sh | 4 ++-- karm/test/webdav.sh | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/karm/test/__lib.sh b/karm/test/__lib.sh index 06fd9df6..0f8be7bb 100644 --- a/karm/test/__lib.sh +++ b/karm/test/__lib.sh @@ -1,7 +1,7 @@ # Expects karm test file in $TESTFILE # Returns dcop id in $DCOP_ID -function set_up() +set_up() { DCOPID=`dcop 2>/dev/null | grep karm` @@ -44,7 +44,7 @@ function set_up() then break else - let "idx += 1" + idx=$(( idx + 1 )) fi sleep 1 done @@ -64,12 +64,12 @@ function set_up() fi } -function test_func() +test_func() { echo "Yep, that works." } -function tear_down() +tear_down() { if [ -n "$DCOPID" ]; then dcop "$DCOPID" KarmDCOPIface quit; fi; diff --git a/karm/test/booktime-baddate.sh b/karm/test/booktime-baddate.sh index d89e54cb..fa94a6c7 100755 --- a/karm/test/booktime-baddate.sh +++ b/karm/test/booktime-baddate.sh @@ -2,7 +2,7 @@ TESTFILE="/tmp/testkarm1.ics" -source __lib.sh +. ./__lib.sh set_up @@ -13,7 +13,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface bookTime $TASKID notadate 360 2>/dev/null` tear_down EXPECTED=5 -if [ "$RVAL" == "$EXPECTED" ]; then +if [ "$RVAL" = "$EXPECTED" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/booktime-badduration.sh b/karm/test/booktime-badduration.sh index 2b1e8c96..b18f59a8 100755 --- a/karm/test/booktime-badduration.sh +++ b/karm/test/booktime-badduration.sh @@ -2,7 +2,7 @@ TESTFILE="/tmp/testkarm1.ics" -source __lib.sh +. ./__lib.sh set_up @@ -13,7 +13,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface bookTime $TASKID 20050619 notanumber 2>/dev/nul tear_down EXPECTED=7 -if [ "$RVAL" == "$EXPECTED" ]; then +if [ "$RVAL" = "$EXPECTED" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/booktime-badtime.sh b/karm/test/booktime-badtime.sh index 1bbaa3d5..abc98c33 100755 --- a/karm/test/booktime-badtime.sh +++ b/karm/test/booktime-badtime.sh @@ -2,7 +2,7 @@ TESTFILE="/tmp/testkarm1.ics" -source __lib.sh +. ./__lib.sh set_up @@ -13,7 +13,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface bookTime $TASKID 20050619Tabc 360 2>/dev/null` tear_down EXPECTED=5 -if [ "$RVAL" == "$EXPECTED" ]; then +if [ "$RVAL" = "$EXPECTED" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/booktime-baduid.sh b/karm/test/booktime-baduid.sh index 8cb06424..94364b3d 100755 --- a/karm/test/booktime-baduid.sh +++ b/karm/test/booktime-baduid.sh @@ -4,7 +4,7 @@ TESTFILE="/tmp/testkarm1.ics" -source __lib.sh +. ./__lib.sh set_up @@ -13,7 +13,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface bookTime bad-uid 20050619 360 2>/dev/null` tear_down EXPECTED=4 -if [ "$RVAL" == "$EXPECTED" ]; then +if [ "$RVAL" = "$EXPECTED" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/booktime-works.sh b/karm/test/booktime-works.sh index 280e1231..4f242163 100755 --- a/karm/test/booktime-works.sh +++ b/karm/test/booktime-works.sh @@ -2,7 +2,7 @@ TESTFILE="/tmp/testkarm1.ics" -source __lib.sh +. ./__lib.sh set_up @@ -21,7 +21,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface totalMinutesForTaskId $TASKID 2>/dev/null` SKIP_TESTFILE_DELETE=true tear_down -if [ "x$RVAL" == "x$DURATION" ]; then +if [ "x$RVAL" = "x$DURATION" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/bug94447.sh b/karm/test/bug94447.sh index fa163735..630d1ff9 100755 --- a/karm/test/bug94447.sh +++ b/karm/test/bug94447.sh @@ -8,7 +8,7 @@ exec >>check.log 2>&1 TESTFILE="testkarm.ics" TESTTODO="testtodo" -source __lib.sh +. ./__lib.sh set_up diff --git a/karm/test/delete.sh b/karm/test/delete.sh index 78f04a7d..b0ea38bf 100755 --- a/karm/test/delete.sh +++ b/karm/test/delete.sh @@ -7,7 +7,7 @@ exec >> check.log 2>&1 TESTFILE="/tmp/testkarm1.ics" rm $TESTFILE -source __lib.sh +. ./__lib.sh set_up @@ -24,7 +24,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface version 2>/dev/null` tear_down -if [ "$RVAL" == "" ]; then +if [ "$RVAL" = "" ]; then echo "FAIL $0: got no version." exit 1; else diff --git a/karm/test/refresh_on_change.sh b/karm/test/refresh_on_change.sh index 6253c63b..0f020080 100755 --- a/karm/test/refresh_on_change.sh +++ b/karm/test/refresh_on_change.sh @@ -6,7 +6,7 @@ exec >>check.log 2>&1 -source __lib.sh +. /__lib.sh TESTFILE="/tmp/testkarm.ics" @@ -48,7 +48,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface taskIdFromName $TODO_NAME` tear_down # check that todo was found -if [ "$RVAL" == "$TODO_UID" ]; then +if [ "$RVAL" = "$TODO_UID" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/version.sh b/karm/test/version.sh index 64fbc8fb..6350e73c 100755 --- a/karm/test/version.sh +++ b/karm/test/version.sh @@ -7,7 +7,7 @@ exec >>check.log 2>&1 TESTFILE="/tmp/testkarm1.ics" VERSION="1.6.0" -source __lib.sh +. ./__lib.sh set_up @@ -15,7 +15,7 @@ RVAL=`dcop $DCOPID KarmDCOPIface version 2>/dev/null` tear_down -if [ "$RVAL" == "$VERSION" ]; then +if [ "$RVAL" = "$VERSION" ]; then echo "PASS $0" exit 0; else diff --git a/karm/test/webdav.sh b/karm/test/webdav.sh index 8d51db92..39ca0813 100755 --- a/karm/test/webdav.sh +++ b/karm/test/webdav.sh @@ -4,7 +4,7 @@ exec >>check.log 2>&1 -source __lib.sh +. ./__lib.sh # check for required perl stuff perl -e "use Net::DAV::Server;" > /dev/null 2>&1