VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/pr/tests/runy2ktests.ksh@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1#!/bin/ksh
2#
3# ***** BEGIN LICENSE BLOCK *****
4# Version: MPL 1.1/GPL 2.0/LGPL 2.1
5#
6# The contents of this file are subject to the Mozilla Public License Version
7# 1.1 (the "License"); you may not use this file except in compliance with
8# the License. You may obtain a copy of the License at
9# http://www.mozilla.org/MPL/
10#
11# Software distributed under the License is distributed on an "AS IS" basis,
12# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13# for the specific language governing rights and limitations under the
14# License.
15#
16# The Original Code is the Netscape Portable Runtime (NSPR).
17#
18# The Initial Developer of the Original Code is
19# Netscape Communications Corporation.
20# Portions created by the Initial Developer are Copyright (C) 1999-2000
21# the Initial Developer. All Rights Reserved.
22#
23# Contributor(s):
24#
25# Alternatively, the contents of this file may be used under the terms of
26# either the GNU General Public License Version 2 or later (the "GPL"), or
27# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28# in which case the provisions of the GPL or the LGPL are applicable instead
29# of those above. If you wish to allow use of your version of this file only
30# under the terms of either the GPL or the LGPL, and not to allow others to
31# use your version of this file under the terms of the MPL, indicate your
32# decision by deleting the provisions above and replace them with the notice
33# and other provisions required by the GPL or the LGPL. If you do not delete
34# the provisions above, a recipient may use your version of this file under
35# the terms of any one of the MPL, the GPL or the LGPL.
36#
37# ***** END LICENSE BLOCK *****
38
39#
40# runy2ktests.ksh
41# Set system clock to Y2K dates of interest and run the Y2K tests.
42# Needs root/administrator privilege
43#
44# WARNING: Because this script needs to be run with root/administrator
45# privilege, thorough understanding of the script and extreme
46# caution are urged.
47#
48
49#
50# SECTION I
51# Define variables
52#
53
54SYSTEM_INFO=`uname -a`
55OS_ARCH=`uname -s`
56if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "Windows_95" ]
57then
58 NULL_DEVICE=nul
59else
60 NULL_DEVICE=/dev/null
61fi
62
63#
64# Test dates for NSPR Y2K tests
65#
66Y2KDATES=" 123123591998.55
67 090923591999.55
68 123123591999.55
69 022823592000.55
70 022923592000.55
71 123123592000.55"
72
73Y2KDATES_AIX=" 12312359.5598
74 09092359.5599
75 12312359.5599
76 02282359.5500
77 02292359.5500
78 12312359.5500"
79
80Y2KDATES_HPUX=" 123123591998
81 090923591999
82 123123591999
83 022823592000
84 022923592000
85 123123592000"
86
87Y2KDATES_MKS=" 1231235998.55
88 0909235999.55
89 1231235999.55
90 0228235900.55
91 0229235900.55
92 1231235900.55"
93
94#
95# NSPR Y2K tests
96#
97Y2KTESTS="
98y2k \n
99y2ktmo \n
100y2k \n
101../runtests.ksh"
102
103Y2KTESTS_HPUX="
104y2k \n
105y2ktmo -l 60\n
106y2k \n
107../runtests.ksh"
108
109#
110# SECTION II
111# Define functions
112#
113
114save_date()
115{
116 case $OS_ARCH in
117 AIX)
118 SAVED_DATE=`date "+%m%d%H%M.%S%y"`
119 ;;
120 HP-UX)
121 SAVED_DATE=`date "+%m%d%H%M%Y"`
122 ;;
123 Windows_NT)
124 SAVED_DATE=`date "+%m%d%H%M%y.%S"`
125 ;;
126 Windows_95)
127 SAVED_DATE=`date "+%m%d%H%M%y.%S"`
128 ;;
129 *)
130 SAVED_DATE=`date "+%m%d%H%M%Y.%S"`
131 ;;
132 esac
133}
134
135set_date()
136{
137 case $OS_ARCH in
138 Windows_NT)
139#
140# The date command in MKS Toolkit releases 5.1 and 5.2
141# uses the current DST status for the date we want to
142# set the system clock to. However, the DST status for
143# that date may be different from the current DST status.
144# We can work around this problem by invoking the date
145# command with the same date twice.
146#
147 date "$1" > $NULL_DEVICE
148 date "$1" > $NULL_DEVICE
149 ;;
150 *)
151 date "$1" > $NULL_DEVICE
152 ;;
153 esac
154}
155
156restore_date()
157{
158 set_date "$SAVED_DATE"
159}
160
161savedate()
162{
163 case $OS_ARCH in
164 AIX)
165 SAVED_DATE=`date "+%m%d%H%M.%S%y"`
166 ;;
167 HP-UX)
168 SAVED_DATE=`date "+%m%d%H%M%Y"`
169 ;;
170 Windows_NT)
171 SAVED_DATE=`date "+%m%d%H%M%y.%S"`
172 ;;
173 Windows_95)
174 SAVED_DATE=`date "+%m%d%H%M%y.%S"`
175 ;;
176 *)
177 SAVED_DATE=`date "+%m%d%H%M%Y.%S"`
178 ;;
179 esac
180}
181
182set_y2k_test_parameters()
183{
184#
185# set dates
186#
187 case $OS_ARCH in
188 AIX)
189 DATES=$Y2KDATES_AIX
190 ;;
191 HP-UX)
192 DATES=$Y2KDATES_HPUX
193 ;;
194 Windows_NT)
195 DATES=$Y2KDATES_MKS
196 ;;
197 Windows_95)
198 DATES=$Y2KDATES_MKS
199 ;;
200 *)
201 DATES=$Y2KDATES
202 ;;
203 esac
204
205#
206# set tests
207#
208 case $OS_ARCH in
209 HP-UX)
210 TESTS=$Y2KTESTS_HPUX
211 ;;
212 *)
213 TESTS=$Y2KTESTS
214 ;;
215 esac
216}
217
218#
219# runtests:
220# - runs each test in $TESTS after setting the
221# system clock to each date in $DATES
222#
223
224runtests()
225{
226for newdate in ${DATES}
227do
228 set_date $newdate
229 echo $newdate
230 echo "BEGIN\t\t\t`date`"
231 echo "Date\t\t\t\t\tTest\t\t\tResult"
232 echo $TESTS | while read prog
233 do
234 echo "`date`\t\t\c"
235 echo "$prog\c"
236 ./$prog >> ${LOGFILE} 2>&1
237 if [ 0 = $? ] ; then
238 echo "\t\t\tPassed";
239 else
240 echo "\t\t\tFAILED";
241 fi;
242 done
243 echo "END\t\t\t`date`\n"
244done
245
246}
247
248#
249# SECTION III
250# Run tests
251#
252
253LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
254OBJDIR=`basename $PWD`
255echo "\nNSPR Year 2000 Test Results - $OBJDIR\n"
256echo "SYSTEM:\t\t\t${SYSTEM_INFO}"
257echo "NSPR_TEST_LOGFILE:\t${LOGFILE}\n"
258
259
260save_date
261
262#
263# Run NSPR Y2k and standard tests
264#
265
266set_y2k_test_parameters
267runtests
268
269restore_date
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette