--- src/sanity.sh Sat Oct 22 15:35:07 2016 +++ src/sanity.sh Sat Oct 22 15:40:12 2016 @@ -1,5 +1,7 @@ #! /bin/sh : +# $MirOS: src/gnu/usr.bin/cvs/src/sanity.sh,v 1.4 2016/10/22 15:40:12 tg Exp $ +#- # set DISABLE_ANY_RSH=1 to skip rsh and ssh calls # # sanity.sh -- a growing testsuite for cvs. @@ -92,6 +94,23 @@ checklongoptarg() fi } +do_save_TZ() +{ + saveset_TZ=${TZ+false} + save_TZ=$TZ + TZ=UTC0; export TZ +} + +do_restore_TZ() +{ + if $saveset_TZ :; then + unset TZ + else + TZ=$save_TZ + export TZ + fi +} + # See TODO list at end of file. # required to make this script work properly. @@ -9376,8 +9395,7 @@ add # Also the -d option. # Set a predictable time zone for these tests. - save_TZ=$TZ - TZ=UTC0; export TZ + do_save_TZ mkdir 1; cd 1 mkdir adir bdir cdir @@ -9500,7 +9518,7 @@ import-it dotest_fail importc-12 "test -d ${TESTDIR}/other" "" dokeep - TZ=$save_TZ + do_restore_TZ cd .. rm -r 1 2 modify_repo rm -rf $CVSROOT_DIRNAME/first-dir @@ -22119,8 +22137,7 @@ ${SPROG} update: Updating crerepos-dir" # Save the timezone and set it to UTC for these tests to make the # value more predicatable. - save_TZ=$TZ - TZ=UTC0; export TZ + do_save_TZ modify_repo mkdir $CVSROOT_DIRNAME/first-dir @@ -22597,7 +22614,7 @@ revision 1\.5 revision 1\.4" dokeep - TZ=$save_TZ + do_restore_TZ cd .. rm -r first-dir modify_repo rm -rf $CVSROOT_DIRNAME/first-dir @@ -22787,8 +22804,7 @@ EOF # revisions 1.1 and 1.1.1.1 differ by 1 second. # Need a predictable time zone. - save_TZ=$TZ - TZ=UTC0; export TZ + do_save_TZ mkdir rcs4 cd rcs4 @@ -22846,7 +22862,7 @@ File: file1 Status: Up-to-da Sticky Options: (none)' dokeep - TZ=$save_TZ + do_restore_TZ cd ../.. rm -r rcs4 modify_repo rm -rf $CVSROOT_DIRNAME/rcs4-dir @@ -25438,8 +25454,7 @@ done" # for checkout and update as well. # mkdir 1; cd 1 - save_TZ=$TZ - TZ=UTC0; export TZ + do_save_TZ dotest tagdate-1 "${testcvs} -q co -l ." '' mkdir first-dir dotest tagdate-2 "${testcvs} add first-dir" \ @@ -25903,7 +25918,7 @@ File: file3 Status: Up-to-da unset date_T1 date_T2 date_T3 date_T4 date_T5 unset date_T6 date_T7 date_T8 date_T9 - TZ=$save_TZ + do_restore_TZ dokeep rm -r 1 2 3 4