diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-04-15 13:46:15 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2010-04-15 16:24:09 +0200 |
commit | b1c58bd2124922a6f33d6e617dfe9a9a309210d3 (patch) | |
tree | 579f5fec41e832d362d34aad6f12498f136d146c /tests/preserve-mode-and-timestamp | |
parent | 57d468b7a4e9b0506ff1fc88b02f6bdbb689c4a2 (diff) | |
download | patch-b1c58bd2124922a6f33d6e617dfe9a9a309210d3.tar.gz |
Portability fixes in the test suite
* tests/merge: Use the sed commands i, a, and c in their standard form
instead of relying on a GNU extension, and pass sed a script (-f)
instead of a list of commands via -e.
Some versions of sed don't support expressions like /^\(\|foo\)$/.
* tests/corrupt-reject-files: Use the more widely available -e switch
instead of -A.
* tests/crlf-handling: Likewise.
* tests/preserve-mode-and-timestamp: Use touch -t instead of touch -d.
Some non-GNU versions of date can't show a file's timestamp.
Diffstat (limited to 'tests/preserve-mode-and-timestamp')
-rw-r--r-- | tests/preserve-mode-and-timestamp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/preserve-mode-and-timestamp b/tests/preserve-mode-and-timestamp index 24dd96f..7019675 100644 --- a/tests/preserve-mode-and-timestamp +++ b/tests/preserve-mode-and-timestamp @@ -31,7 +31,12 @@ one three EOF -touch -d "$timestamp1" f +# touch -d "$timestamp1" f +# Some non-GNU versions of touch don't support the -d option +sed_expr='s,\(....\)-\(..\)-\(..\) \(..\):\(..\):\(..\) +\(....\),\1\2\3\4\5.\6,' +timestamp1_touch=`echo "$timestamp1" | sed -e "$sed_expr"` +TZ=UTC touch -t $timestamp1_touch f + chmod 644 f touch f.orig @@ -41,9 +46,13 @@ check 'patch -p1 --backup --set-utc < f.diff' <<EOF patching file f EOF -check 'date -u "+%Y-%m-%d %H:%M:%S %z" -r f' <<EOF -$timestamp2 -EOF +#check 'date -u "+%Y-%m-%d %H:%M:%S %z" -r f' +#$timestamp2 +#EOF +# Some non-GNU versions of date can't show a file's timestamp +timestamp2_touch=`echo "$timestamp2" | sed -e "$sed_expr"` +TZ=UTC touch -t $timestamp2_touch f.compare +ncheck 'test ! \( f -ot f.compare -o f -nt f.compare \) || echo "timstamp differs"' # POSIX allows a byte like '+' or '.' in position 11 to indicate the # presence of extended permissions like ACLs. |