From: Howard Chu Date: Tue, 11 Oct 2022 14:14:54 +0000 (+0100) Subject: ITS#9931 test scripts: fix BSD vs GNU date syntax X-Git-Tag: OPENLDAP_REL_ENG_2_6_4~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03076cba896673c81ae19d339783eea54428f91f;p=thirdparty%2Fopenldap.git ITS#9931 test scripts: fix BSD vs GNU date syntax --- diff --git a/tests/scripts/all b/tests/scripts/all index a4808f4358..c9528ee0a4 100755 --- a/tests/scripts/all +++ b/tests/scripts/all @@ -25,6 +25,15 @@ FAILCOUNT=0 SKIPCOUNT=0 SLEEPTIME=10 +# check for BSD vs GNU date +date -j >/dev/null 2>&1 +RC=$? +if [ $RC -ne 0 ]; then + DATEOPT="-d @" +else + DATEOPT="-r " +fi + echo ">>>>> $(timer) Executing all LDAP tests for $BACKEND" if [ -n "$NOEXIT" ]; then diff --git a/tests/scripts/functions.sh b/tests/scripts/functions.sh index c10dfebc44..7e6615fff9 100755 --- a/tests/scripts/functions.sh +++ b/tests/scripts/functions.sh @@ -15,6 +15,8 @@ timer() { if [ -n "$STARTTIME" ]; then - date -u -d "now - $STARTTIME sec" +%T + now=`date +%s` + delta=`expr $now - $STARTTIME` + date -u $DATEOPT$delta +%T fi }