blob: 56f7d3c5e342c6a1755d02cede476f766da56981 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
#!/bin/ksh
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# runy2ktests.ksh
# Set system clock to Y2K dates of interest and run the Y2K tests.
# Needs root/administrator privilege
#
# WARNING: Because this script needs to be run with root/administrator
# privilege, thorough understanding of the script and extreme
# caution are urged.
#
#
# SECTION I
# Define variables
#
SYSTEM_INFO=`uname -a`
OS_ARCH=`uname -s`
if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "Windows_95" ]
then
NULL_DEVICE=nul
else
NULL_DEVICE=/dev/null
fi
#
# Test dates for NSPR Y2K tests
#
Y2KDATES=" 123123591998.55
090923591999.55
123123591999.55
022823592000.55
022923592000.55
123123592000.55"
Y2KDATES_AIX=" 12312359.5598
09092359.5599
12312359.5599
02282359.5500
02292359.5500
12312359.5500"
Y2KDATES_HPUX=" 123123591998
090923591999
123123591999
022823592000
022923592000
123123592000"
Y2KDATES_MKS=" 1231235998.55
0909235999.55
1231235999.55
0228235900.55
0229235900.55
1231235900.55"
#
# NSPR Y2K tests
#
Y2KTESTS="
y2k \n
y2ktmo \n
y2k \n
../runtests.ksh"
Y2KTESTS_HPUX="
y2k \n
y2ktmo -l 60\n
y2k \n
../runtests.ksh"
#
# SECTION II
# Define functions
#
save_date()
{
case $OS_ARCH in
AIX)
SAVED_DATE=`date "+%m%d%H%M.%S%y"`
;;
HP-UX)
SAVED_DATE=`date "+%m%d%H%M%Y"`
;;
Windows_NT)
SAVED_DATE=`date "+%m%d%H%M%y.%S"`
;;
Windows_95)
SAVED_DATE=`date "+%m%d%H%M%y.%S"`
;;
*)
SAVED_DATE=`date "+%m%d%H%M%Y.%S"`
;;
esac
}
set_date()
{
case $OS_ARCH in
Windows_NT)
#
# The date command in MKS Toolkit releases 5.1 and 5.2
# uses the current DST status for the date we want to
# set the system clock to. However, the DST status for
# that date may be different from the current DST status.
# We can work around this problem by invoking the date
# command with the same date twice.
#
date "$1" > $NULL_DEVICE
date "$1" > $NULL_DEVICE
;;
*)
date "$1" > $NULL_DEVICE
;;
esac
}
restore_date()
{
set_date "$SAVED_DATE"
}
savedate()
{
case $OS_ARCH in
AIX)
SAVED_DATE=`date "+%m%d%H%M.%S%y"`
;;
HP-UX)
SAVED_DATE=`date "+%m%d%H%M%Y"`
;;
Windows_NT)
SAVED_DATE=`date "+%m%d%H%M%y.%S"`
;;
Windows_95)
SAVED_DATE=`date "+%m%d%H%M%y.%S"`
;;
*)
SAVED_DATE=`date "+%m%d%H%M%Y.%S"`
;;
esac
}
set_y2k_test_parameters()
{
#
# set dates
#
case $OS_ARCH in
AIX)
DATES=$Y2KDATES_AIX
;;
HP-UX)
DATES=$Y2KDATES_HPUX
;;
Windows_NT)
DATES=$Y2KDATES_MKS
;;
Windows_95)
DATES=$Y2KDATES_MKS
;;
*)
DATES=$Y2KDATES
;;
esac
#
# set tests
#
case $OS_ARCH in
HP-UX)
TESTS=$Y2KTESTS_HPUX
;;
*)
TESTS=$Y2KTESTS
;;
esac
}
#
# runtests:
# - runs each test in $TESTS after setting the
# system clock to each date in $DATES
#
runtests()
{
for newdate in ${DATES}
do
set_date $newdate
echo $newdate
echo "BEGIN\t\t\t`date`"
echo "Date\t\t\t\t\tTest\t\t\tResult"
echo $TESTS | while read prog
do
echo "`date`\t\t\c"
echo "$prog\c"
./$prog >> ${LOGFILE} 2>&1
if [ 0 = $? ] ; then
echo "\t\t\tPassed";
else
echo "\t\t\tFAILED";
fi;
done
echo "END\t\t\t`date`\n"
done
}
#
# SECTION III
# Run tests
#
LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
OBJDIR=`basename $PWD`
echo "\nNSPR Year 2000 Test Results - $OBJDIR\n"
echo "SYSTEM:\t\t\t${SYSTEM_INFO}"
echo "NSPR_TEST_LOGFILE:\t${LOGFILE}\n"
save_date
#
# Run NSPR Y2k and standard tests
#
set_y2k_test_parameters
runtests
restore_date
|