[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AT_INIT: date +%s not portable
From: |
Paul Eggert |
Subject: |
Re: AT_INIT: date +%s not portable |
Date: |
Fri, 01 Apr 2005 02:42:22 -0500 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> On solaris2.8, `date +%s' returns 0 and outputs '%s\n'.
Thanks for reporting that. I installed the following
slightly-different patch:
2005-04-01 Paul Eggert <address@hidden>
* lib/autotest/general.m4 (AT_INIT): Don't assume that "date +%s"
fails if %s isn't supported. Problem reported by Ralf Wildenhues.
--- general.m4.~1.173.~ 2005-03-22 15:58:40 -0500
+++ general.m4 2005-04-01 02:03:47 -0500
@@ -577,7 +577,7 @@ done
} >&AS_MESSAGE_LOG_FD
at_start_date=`date`
-at_start_time=`date +%s 2>/dev/null || echo 0`
+at_start_time=`date +%s 2>/dev/null`
echo "$as_me: starting at: $at_start_date" >&AS_MESSAGE_LOG_FD
at_xpass_list=
at_xfail_list=
@@ -756,17 +756,19 @@ cd "$at_dir"
# Compute the duration of the suite.
at_stop_date=`date`
-at_stop_time=`date +%s 2>/dev/null || echo 0`
+at_stop_time=`date +%s 2>/dev/null`
echo "$as_me: ending at: $at_stop_date" >&AS_MESSAGE_LOG_FD
-at_duration_s=`expr $at_stop_time - $at_start_time`
-at_duration_m=`expr $at_duration_s / 60`
-at_duration_h=`expr $at_duration_m / 60`
-at_duration_s=`expr $at_duration_s % 60`
-at_duration_m=`expr $at_duration_m % 60`
-at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
-if test "$at_duration" != "h m s"; then
- echo "$as_me: test suite duration: $at_duration" >&AS_MESSAGE_LOG_FD
-fi
+case $at_start_time,$at_stop_time in
+ [[0-9]*,[0-9]*])
+ at_duration_s=`expr $at_stop_time - $at_start_time`
+ at_duration_m=`expr $at_duration_s / 60`
+ at_duration_h=`expr $at_duration_m / 60`
+ at_duration_s=`expr $at_duration_s % 60`
+ at_duration_m=`expr $at_duration_m % 60`
+ at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
+ echo "$as_me: test suite duration: $at_duration" >&AS_MESSAGE_LOG_FD
+ ;;
+esac
# Wrap up the test suite with summary statistics.
at_skip_count=`set dummy $at_skip_list; shift; echo address@hidden:@]`
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: AT_INIT: date +%s not portable,
Paul Eggert <=