Skip to content

Latest commit

 

History

History
executable file
·
982 lines (851 loc) · 38.7 KB

run_niscc.sh

File metadata and controls

executable file
·
982 lines (851 loc) · 38.7 KB
 
Nov 9, 2009
Nov 9, 2009
1
#!/bin/bash
May 1, 2006
May 1, 2006
2
#
Mar 20, 2012
Mar 20, 2012
3
4
5
# 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/.
Dec 11, 2006
Dec 11, 2006
6
Jul 13, 2012
Jul 13, 2012
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# PRIOR TO RUNNING THIS SCRIPT
# you should adjust MAIL_COMMAND and QA_LIST
#
# External dependencies:
# - install the NISCC test files, e.g. at /niscc (readonly OK)
# - libfaketimeMT because the test certificates have expired
# - build environment for building NSS
# - gdb to analyze core files
# - a command line mail tool (e.g. mailx)
# - openssl to combine input PEM files into pkcs#12
# - curl for obtaining version information from the web
#
################################################################################
# Print script usage
################################################################################
usage()
Jul 13, 2012
Jul 13, 2012
26
27
28
29
30
31
32
33
34
35
36
37
38
cat << EOF
Usage: $0 [options]
Test NSS library against NISCC SMIME and TLS testcases.
Options:
-h, --help print this help message and exit
-v, --verbose enable extra verbose output
--niscc-home DIR use NISCC testcases from directory DIR (default /niscc)
--host HOST use host HOST (default '127.0.0.1')
--threads X set thread number to X (max. 10, default 10)
--out DIR set DIR as output directory (default '/out')
--mail ADDRESS send mail with test result to ADDRESS
Nov 20, 2013
Nov 20, 2013
39
40
--nss DIR set NSS directory to DIR (default '~/niscc-hg/nss')
--nss-hack DIR set hacked NSS directory to DIR (default '~/niscc-hg/nss_hack')
Jul 13, 2012
Jul 13, 2012
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
--log-store store all the logs (only summary by default)
--no-build-test don't pull and build tested NSS
--no-build-hack don't pull and build hacked NSS
--test-system test system installed NSS
--date DATE use DATE in log archive name and outgoing email
--libfaketime path.so use faketime library with LD_PRELOAD=path.so
--smallset test only a very small subset
All options are optional.
All options (and possibly more) can be also set through environment variables.
Commandline options have higher priority than environment variables.
For more information please refer to the source code of this script.
For a successfull run the script NEEDS the core file pattern to be 'core.*',
e.g. 'core.%t'. You can check the current pattern in
'/proc/sys/kernel/core_pattern'. Otherwise the test will be unable to detect
any failures and will pass every time.
It is recommended to use hacked and tested binaries in a location, where their
absolute path is max. 80 characters. If their path is longer and a core file is
generated, its properties may be incomplete.
Return value of the script indicates how many failures it experienced.
EOF
exit $1
Jul 13, 2012
Jul 13, 2012
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
################################################################################
# Process command-line arguments
################################################################################
process_args()
{
HELP="false"
args=`getopt -u -l "niscc-home:,host:,threads:,out:,verbose,mail:,nss:,nss-hack:,log-store,no-build-test,no-build-hack,help,test-system,date:,libfaketime:,smallset" -- "hv" $*`
[ "$?" != "0" ] && usage 1
set -- $args
for i; do
case "$i" in
-v|--verbose)
shift
VERBOSE="-v"
;;
--niscc-home)
shift
NISCC_HOME="$1"
shift
;;
--host)
shift
HOST="$1"
shift
;;
--threads)
shift
THREADS="$1"
shift
;;
--out)
shift
TEST_OUTPUT="$1"
shift
;;
--mail)
shift
USE_MAIL="true"
QA_LIST="$1"
shift
;;
--nss)
shift
LOCALDIST="$1"
shift
;;
--nss-hack)
shift
NSS_HACK="$1"
shift
;;
--log-store)
shift
LOG_STORE="true"
;;
--no-build-test)
shift
NO_BUILD_TEST="true"
;;
--no-build-hack)
shift
NO_BUILD_HACK="true"
;;
-h|--help)
shift
HELP="true"
;;
--test-system)
shift
TEST_SYSTEM="true"
;;
--date)
shift
DATE="$1"
shift
;;
--libfaketime)
shift
FAKETIMELIB="$1"
shift
;;
--smallset)
shift
SMALLSET="true"
;;
--)
;;
*)
;;
esac
done
[ $HELP = "true" ] && usage 0
}
Jul 13, 2012
Jul 13, 2012
163
164
165
166
################################################################################
# Create and set needed and useful environment variables
################################################################################
create_environment()
Jul 13, 2012
Jul 13, 2012
168
169
# Base location of NISCC testcases
export NISCC_HOME=${NISCC_HOME:-/niscc}
May 1, 2006
May 1, 2006
170
Jul 13, 2012
Jul 13, 2012
171
# Base location of NSS
Nov 20, 2013
Nov 20, 2013
172
export HG=${HG:-"$HOME/niscc-hg"}
Jul 13, 2012
Jul 13, 2012
174
# NSS being tested
Nov 20, 2013
Nov 20, 2013
175
export LOCALDIST=${LOCALDIST:-"${HG}/nss"}
Jul 13, 2012
Jul 13, 2012
177
# Hacked NSS - built with "NISCC_TEST=1"
Nov 20, 2013
Nov 20, 2013
178
export NSS_HACK=${NSS_HACK:-"${HG}/nss_hack"}
Jul 13, 2012
Jul 13, 2012
180
181
# Hostname of the testmachine
export HOST=${HOST:-127.0.0.1}
Jul 13, 2012
Jul 13, 2012
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
238
239
# Whether to store logfiles
export LOG_STORE=${LOG_STORE:-"false"}
# Whether to mail the summary
export USE_MAIL=${USE_MAIL:-"false"}
# How to mail summary
export MAIL_COMMAND=${MAIL_COMMAND:-"mailx -S smtp=smtp://your.smtp.server:25 -r your+niscc@email.address"}
# List of mail addresses where to send summary
export QA_LIST=${QA_LIST:-"result@recipient.address"}
# Whether to use 64b build
export USE_64=${USE_64:-1}
# Directory where to write all the output data (around 650MiB for each run)
export TEST_OUTPUT=${TEST_OUTPUT:-"$HOME/out"}
# How many threads to use in selfserv and strsclnt (max. 10)
export THREADS=${THREADS:-10}
# If true, do not build tthe tested version of NSS
export NO_BUILD_TEST=${NO_BUILD_TEST:-"false"}
# If true, do not build the special NSS version for NISCC
export NO_BUILD_HACK=${NO_BUILD_HACK:-"false"}
# If true, do not rebuild client and server directories
export NO_SETUP=${NO_SETUP:-"false"}
# Location of NISCC SSL/TLS testcases
export TEST=${TEST:-"${NISCC_HOME}/NISCC_SSL_testcases"}
# If true, then be extra verbose
export VERBOSE=${VERBOSE:-""}
# If true, test the system installed NSS
export TEST_SYSTEM=${TEST_SYSTEM:-"false"}
[ "$TEST_SYSTEM" = "true" ] && export NO_BUILD_TEST="true"
[ ! -z "$VERBOSE" ] && set -xv
# Real date for naming of archives (system date must be 2002-11-18 .. 2007-11-18 due to certificate validity
DATE=${DATE:-`date`}
export DATE=`date -d "$DATE" +%Y%m%d`
FAKETIMELIB=${FAKETIMELIB:-""}
export DATE=`date -d "$DATE" +%Y%m%d`
# Whether to test only a very small subset
export SMALLSET=${SMALLSET:-"false"}
# Create output dir if it doesn't exist
mkdir -p ${TEST_OUTPUT}
}
################################################################################
Nov 20, 2013
Nov 20, 2013
240
# Do a HG pull of NSS
Jul 13, 2012
Jul 13, 2012
241
################################################################################
Nov 20, 2013
Nov 20, 2013
242
hg_pull()
Nov 20, 2013
Nov 20, 2013
244
# Tested NSS - by default using HG default tip
Jul 13, 2012
Jul 13, 2012
245
if [ "$NO_BUILD_TEST" = "false" ]; then
Nov 20, 2013
Nov 20, 2013
246
echo "cloning NSS sources to be tested from HG"
Jul 13, 2012
Jul 13, 2012
247
248
[ ! -d "$LOCALDIST" ] && mkdir -p "$LOCALDIST"
cd "$LOCALDIST"
Nov 20, 2013
Nov 20, 2013
249
250
251
252
[ ! -d "$LOCALDIST/nspr" ] && hg clone --noupdate https://hg.mozilla.org/projects/nspr
cd nspr; hg pull; hg update -C -r default; cd ..
[ ! -d "$LOCALDIST/nss" ] && hg clone --noupdate https://hg.mozilla.org/projects/nss
cd nss; hg pull; hg update -C -r default; cd ..
Jul 13, 2012
Jul 13, 2012
253
254
255
256
257
258
#find . -exec touch {} \;
fi
# Hacked NSS - by default using some RTM version.
# Do not use HEAD for hacked NSS - it needs to be stable and bug-free
if [ "$NO_BUILD_HACK" = "false" ]; then
Nov 20, 2013
Nov 20, 2013
259
echo "cloning NSS sources for a hacked build from HG"
Jul 13, 2012
Jul 13, 2012
260
261
[ ! -d "$NSS_HACK" ] && mkdir -p "$NSS_HACK"
cd "$NSS_HACK"
Nov 20, 2013
Nov 20, 2013
262
263
264
265
266
267
NSPR_TAG=`curl --silent http://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/nsprpub/TAG-INFO | head -1 | sed --regexp-extended 's/[[:space:]]//g' | awk '{print $1}'`
NSS_TAG=`curl --silent http://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/TAG-INFO | head -1 | sed --regexp-extended 's/[[:space:]]//g' | awk '{print $1}'`
[ ! -d "$NSS_HACK/nspr" ] && hg clone --noupdate https://hg.mozilla.org/projects/nspr
cd nspr; hg pull; hg update -C -r "$NSPR_TAG"; cd ..
[ ! -d "$NSS_HACK/nss" ] && hg clone --noupdate https://hg.mozilla.org/projects/nss
cd nss; hg pull; hg update -C -r "$NSS_TAG"; cd ..
Jul 13, 2012
Jul 13, 2012
268
269
270
#find . -exec touch {} \;
fi
}
May 1, 2006
May 1, 2006
271
Jul 13, 2012
Jul 13, 2012
272
273
274
275
276
277
278
279
280
281
################################################################################
# Build NSS after setting make variable NISCC_TEST
################################################################################
build_NSS()
{
# Tested NSS
if [ "$NO_BUILD_TEST" = "false" ]; then
echo "building NSS to be tested"
cd "$LOCALDIST"
unset NISCC_TEST
Nov 20, 2013
Nov 20, 2013
282
cd nss
Jul 13, 2012
Jul 13, 2012
283
284
285
286
287
288
289
290
291
gmake nss_clean_all &>> $TEST_OUTPUT/nisccBuildLog
gmake nss_build_all &>> $TEST_OUTPUT/nisccBuildLog
fi
# Hacked NSS
if [ "$NO_BUILD_HACK" = "false" ]; then
echo "building hacked NSS"
cd "$NSS_HACK"
export NISCC_TEST=1
Nov 20, 2013
Nov 20, 2013
292
cd nss
Jul 13, 2012
Jul 13, 2012
293
294
295
296
297
298
gmake nss_clean_all &>> $TEST_OUTPUT/nisccBuildLogHack
gmake nss_build_all &>> $TEST_OUTPUT/nisccBuildLogHack
fi
unset NISCC_TEST
}
Jul 13, 2012
Jul 13, 2012
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
################################################################################
# Set build dir, bin and lib directories
################################################################################
init()
{
# Enable useful core files to be generated in case of crash
ulimit -c unlimited
# Pattern of core files, they should be created in current directory
echo "core_pattern $(cat /proc/sys/kernel/core_pattern)" > "$TEST_OUTPUT/nisccLog00"
# gmake is needed in the path for this suite to run
echo "PATH $PATH" >> "$TEST_OUTPUT/nisccLog00"
# Find out hacked NSS version
Nov 20, 2013
Nov 20, 2013
315
DISTTYPE=`cd "$NSS_HACK/nss/tests/common"; gmake objdir_name`
Jul 13, 2012
Jul 13, 2012
316
echo "NSS_HACK DISTTYPE $DISTTYPE" >> "$TEST_OUTPUT/nisccLog00"
Nov 20, 2013
Nov 20, 2013
317
318
export HACKBIN="$NSS_HACK/dist/$DISTTYPE/bin"
export HACKLIB="$NSS_HACK/dist/$DISTTYPE/lib"
Jul 13, 2012
Jul 13, 2012
319
320
321
if [ "$TEST_SYSTEM" = "false" ]; then
# Find out nss version
Nov 20, 2013
Nov 20, 2013
322
DISTTYPE=`cd "$LOCALDIST/nss/tests/common"; gmake objdir_name`
Jul 13, 2012
Jul 13, 2012
323
echo "NSS DISTTYPE $DISTTYPE" >> "$TEST_OUTPUT/nisccLog00"
Nov 20, 2013
Nov 20, 2013
324
325
export TESTBIN="$LOCALDIST/dist/$DISTTYPE/bin"
export TESTLIB="$LOCALDIST/dist/$DISTTYPE/lib"
Jul 13, 2012
Jul 13, 2012
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
export TESTTOOLS="$TESTBIN"
else
# Using system installed NSS
echo "USING SYSTEM NSS" >> "$TEST_OUTPUT/nisccLog00"
export TESTBIN="/usr/bin"
if [ `uname -m` = "x86_64" ]; then
export TESTLIB="/usr/lib64"
export TESTTOOLS="/usr/lib64/nss/unsupported-tools"
else
export TESTLIB="/usr/lib"
export TESTTOOLS="/usr/lib/nss/unsupported-tools"
fi
fi
# Verify NISCC_TEST was set in the proper library
if strings "$HACKLIB/libssl3.so" | grep NISCC_TEST > /dev/null 2>&1; then
echo "$HACKLIB/libssl3.so contains NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
else
echo "$HACKLIB/libssl3.so does NOT contain NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
fi
if strings "$TESTLIB/libssl3.so" | grep NISCC_TEST > /dev/null 2>&1; then
echo "$TESTLIB/libssl3.so contains NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
else
echo "$TESTLIB/libssl3.so does NOT contain NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
fi
}
Jul 13, 2012
Jul 13, 2012
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
################################################################################
# Setup simple client and server directory
################################################################################
ssl_setup_dirs_simple()
{
[ "$NO_SETUP" = "true" ] && return
echo "Setting up working directories for SSL simple tests"
CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
# Generate .p12 files
openssl pkcs12 -export -inkey "$TEST/client_key.pem" -in "$TEST/client_crt.pem" -out "$TEST_OUTPUT/client_crt.p12" -passout pass:testtest1 -name "client_crt"
openssl pkcs12 -export -inkey "$TEST/server_key.pem" -in "$TEST/server_crt.pem" -out "$TEST_OUTPUT/server_crt.p12" -passout pass:testtest1 -name "server_crt"
# Setup simple client directory
rm -rf "$CLIENT"
mkdir -p "$CLIENT"
echo test > "$CLIENT/password-is-test.txt"
export LD_LIBRARY_PATH="$TESTLIB"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "$CLIENT" -f "$CLIENT/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$CLIENT" -n rootca -i "$TEST/rootca.crt" -t "C,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i "$TEST_OUTPUT/client_crt.p12" -d "$CLIENT" -k "$CLIENT/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -L -d "$CLIENT" >> "$TEST_OUTPUT/nisccLog00" 2>&1
# File containg message used for terminating the server
echo "GET /stop HTTP/1.0" > "$CLIENT/stop.txt"
echo "" >> "$CLIENT/stop.txt"
# Setup simple server directory
rm -rf "$SERVER"
mkdir -p "$SERVER"
echo test > "$SERVER/password-is-test.txt"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "$SERVER" -f "$SERVER/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SERVER" -n rootca -i "$TEST/rootca.crt" -t "TC,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i "$TEST_OUTPUT/server_crt.p12" -d "$SERVER" -k "$SERVER/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -L -d "$SERVER" >> "$TEST_OUTPUT/nisccLog00" 2>&1
unset LD_LIBRARY_PATH
Jul 13, 2012
Jul 13, 2012
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
################################################################################
# Setup resigned client and server directory
################################################################################
ssl_setup_dirs_resigned()
{
[ "$NO_SETUP" = "true" ] && return
echo "Setting up working directories for SSL resigned tests"
CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
# Setup resigned client directory
rm -rf "$CLIENT"
mkdir -p "$CLIENT"
echo test > "$CLIENT/password-is-test.txt"
export LD_LIBRARY_PATH="$TESTLIB"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "$CLIENT" -f "$CLIENT/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$CLIENT" -n rootca -i "$TEST/rootca.crt" -t "C,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i "$TEST_OUTPUT/client_crt.p12" -d "$CLIENT" -k "$CLIENT/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -L -d "$CLIENT" >> "$TEST_OUTPUT/nisccLog00" 2>&1
echo "GET /stop HTTP/1.0" > "$CLIENT/stop.txt"
echo "" >> "$CLIENT/stop.txt"
# Setup resigned server directory
rm -rf "$SERVER"
mkdir -p "$SERVER"
echo test > "$SERVER/password-is-test.txt"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "$SERVER" -f "$SERVER/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SERVER" -n rootca -i "$TEST/rootca.crt" -t "TC,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i "$TEST_OUTPUT/server_crt.p12" -d "$SERVER" -k "$SERVER/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -L -d "$SERVER" >> "$TEST_OUTPUT/nisccLog00" 2>&1
unset LD_LIBRARY_PATH
}
Jul 13, 2012
Jul 13, 2012
449
################################################################################
Jul 13, 2012
Jul 13, 2012
451
################################################################################
Jul 13, 2012
Jul 13, 2012
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
cd "$TEST_OUTPUT"
DATA="$NISCC_HOME/NISCC_SMIME_testcases"
[ ! -d niscc_smime ] && mkdir -p niscc_smime
export SMIME_CERT_DB_DIR=envDB
export NSS_STRICT_SHUTDOWN=1
export NSS_DISABLE_ARENA_FREE_LIST=1
export LD_LIBRARY_PATH="$TESTLIB"
# Generate .p12 files
openssl pkcs12 -export -inkey "$DATA/Client.key" -in "$DATA/Client.crt" -out Client.p12 -passout pass:testtest1 &>/dev/null
openssl pkcs12 -export -inkey "$DATA/CA.key" -in "$DATA/CA.crt" -out CA.p12 -passout pass:testtest1 &>/dev/null
# Generate envDB if needed
if [ ! -d "$SMIME_CERT_DB_DIR" ]; then
mkdir -p "$SMIME_CERT_DB_DIR"
echo testtest1 > password-is-testtest1.txt
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "./$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt > /dev/null 2>&1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt -i "$DATA/CA.crt" -n CA -t "TC,C,"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt -i "$DATA/Client.crt" -n Client -t "TC,C,"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i ./CA.p12 -d "$SMIME_CERT_DB_DIR" -k password-is-testtest1.txt -W testtest1
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/pk12util" -i ./Client.p12 -d "$SMIME_CERT_DB_DIR" -k password-is-testtest1.txt -W testtest1
fi
# if p7m-ed-m-files.txt does not exist, then generate it.
[ -f "$DATA/p7m-ed-m-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-ed-m-files.txt" > p7m-ed-m-files.txt
export P7M_ED_M_FILES=p7m-ed-m-files.txt
if [ "$SMALLSET" = "true" ]; then
[ ! -f "$P7M_ED_M_FILES" ] && find "$DATA"/p7m-ed-m-0* -type f -print | head -10 >> "$P7M_ED_M_FILES"
else
[ ! -f "$P7M_ED_M_FILES" ] && find "$DATA"/p7m-ed-m-0* -type f -print >> "$P7M_ED_M_FILES"
fi
# Test "p7m-ed-m*" testcases
echo "Testing SMIME enveloped data testcases"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -p testtest1 -b -i "$P7M_ED_M_FILES" > niscc_smime/p7m-ed-m-results.txt 2>&1
export SMIME_CERT_DB_DIR=sigDB
# Generate sigDB if needed
if [ ! -d "$SMIME_CERT_DB_DIR" ]; then
mkdir -p "$SMIME_CERT_DB_DIR"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -N -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -i "$DATA/CA.crt" -n CA -t "TC,C,"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -i "$DATA/Client.crt" -n Client -t "TC,C,"
fi
# if p7m-sd-dt-files.txt does not exist, then generate it.
[ -f "$DATA/p7m-sd-dt-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-sd-dt-files.txt" > p7m-sd-dt-files.txt
export P7M_SD_DT_FILES=p7m-sd-dt-files.txt
if [ "$SMALLSET" = "true" ]; then
[ ! -f "$P7M_SD_DT_FILES" ] && find "$DATA"/p7m-sd-dt-[cm]-* -type f -print | head -10 >> "$P7M_SD_DT_FILES"
else
[ ! -f "$P7M_SD_DT_FILES" ] && find "$DATA"/p7m-sd-dt-[cm]-* -type f -print >> "$P7M_SD_DT_FILES"
fi
[ ! -f detached.txt ] && touch detached.txt
# Test "p7m-sd-dt*" testcases
echo "Testing SMIME detached signed data testcases"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -c detached.txt -b -i "$P7M_SD_DT_FILES" > niscc_smime/p7m-sd-dt-results.txt 2>&1
# if p7m-sd-op-files.txt does not exist, then generate it.
[ -f "$DATA/p7m-sd-op-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-sd-op-files.txt" > p7m-sd-op-files.txt
export P7M_SD_OP_FILES=p7m-sd-op-files.txt
if [ "$SMALLSET" = "true" ]; then
[ ! -f "$P7M_SD_OP_FILES" ] && find "$DATA"/p7m-sd-op-[cm]-* -type f -print | head -10 >> "$P7M_SD_OP_FILES"
else
[ ! -f "$P7M_SD_OP_FILES" ] && find "$DATA"/p7m-sd-op-[cm]-* -type f -print >> "$P7M_SD_OP_FILES"
fi
# Test "p7m-sd-op*" testcases
echo "Testing SMIME opaque signed data testcases"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -b -i "$P7M_SD_OP_FILES" > niscc_smime/p7m-sd-op-results.txt 2>&1
unset LD_LIBRARY_PATH
Jul 13, 2012
Jul 13, 2012
543
544
545
################################################################################
# Set env variables for NISCC SSL tests
################################################################################
Jul 13, 2012
Jul 13, 2012
548
549
550
export NSS_STRICT_SHUTDOWN=1
export NSS_DISABLE_ARENA_FREE_LIST=1
cd "$TEST_OUTPUT"
Jul 13, 2012
Jul 13, 2012
553
554
555
556
557
558
force_crash()
{
echo "int main(int argc, char *argv[]) { int *i; i = (int*)(void*)1; *i = 1; }" > "$TEST_OUTPUT/crashme.c"
gcc -g -o "$TEST_OUTPUT/crashme" "$TEST_OUTPUT/crashme.c"
"$TEST_OUTPUT/crashme"
}
Jul 13, 2012
Jul 13, 2012
560
561
################################################################################
# Do simple client auth tests
May 1, 2006
May 1, 2006
562
# Use an altered client against the server
Jul 13, 2012
Jul 13, 2012
563
################################################################################
564
565
ssl_simple_client_auth()
{
Jul 13, 2012
Jul 13, 2012
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
echo "Testing SSL simple client auth testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
export PORT=8443
export START_AT=1
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=10
else
export STOP_AT=106160
fi
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -rr -t $THREADS -w test > "$TEST_OUTPUT/nisccLog01" 2>&1 &
export NISCC_TEST="$TEST/simple_client"
export LD_LIBRARY_PATH="$HACKLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
START_AT=$START \
STOP_AT=$(($START+$THREADS)) \
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/strsclnt" $VERBOSE -d "$CLIENT" -n client_crt -p $PORT -t $THREADS -c $THREADS -o -N -w test $HOST >> "$TEST_OUTPUT/nisccLog02" 2>&1
done
unset NISCC_TEST
echo "starting tstclnt to shutdown simple client selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog02" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
603
604
################################################################################
# Do simple server auth tests
May 1, 2006
May 1, 2006
605
# Use an altered server against the client
Jul 13, 2012
Jul 13, 2012
606
################################################################################
607
608
ssl_simple_server_auth()
{
Jul 13, 2012
Jul 13, 2012
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
echo "Testing SSL simple server auth testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
export PORT=8444
export START_AT=00000001
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=00000010
else
export STOP_AT=00106167
fi
export LD_LIBRARY_PATH="$HACKLIB"
export NISCC_TEST="$TEST/simple_server"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog03" 2>&1 &
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog04" 2>&1
done
echo "starting tstclnt to shutdown simple server selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog04" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
642
643
################################################################################
# Do simple rootCA tests
May 1, 2006
May 1, 2006
644
# Use an altered server against the client
Jul 13, 2012
Jul 13, 2012
645
################################################################################
646
647
ssl_simple_rootca()
{
Jul 13, 2012
Jul 13, 2012
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
echo "Testing SSL simple rootCA testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
export PORT=8445
export START_AT=1
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=10
else
export STOP_AT=106190
fi
export LD_LIBRARY_PATH="$HACKLIB"
export NISCC_TEST="$TEST/simple_rootca"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog05" 2>&1 &
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog06" 2>&1
done
echo "starting tstclnt to shutdown simple rootca selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog06" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
681
682
################################################################################
# Do resigned client auth tests
May 1, 2006
May 1, 2006
683
# Use an altered client against the server
Jul 13, 2012
Jul 13, 2012
684
################################################################################
685
686
ssl_resigned_client_auth()
{
Jul 13, 2012
Jul 13, 2012
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
echo "Testing SSL resigned client auth testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
export PORT=8446
export START_AT=0
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=9
else
export STOP_AT=99981
fi
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -rr -t $THREADS -w test > "$TEST_OUTPUT/nisccLog07" 2>&1 &
export NISCC_TEST="$TEST/resigned_client"
export LD_LIBRARY_PATH="$HACKLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
START_AT=$START \
STOP_AT=$(($START+$THREADS)) \
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/strsclnt" $VERBOSE -d "$CLIENT" -n client_crt -p $PORT -t $THREADS -c $THREADS -o -N -w test $HOST >> "$TEST_OUTPUT/nisccLog08" 2>&1
done
unset NISCC_TEST
echo "starting tstclnt to shutdown resigned client selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog08" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
724
725
################################################################################
# Do resigned server auth tests
May 1, 2006
May 1, 2006
726
# Use an altered server against the client
Jul 13, 2012
Jul 13, 2012
727
################################################################################
728
729
ssl_resigned_server_auth()
{
Jul 13, 2012
Jul 13, 2012
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
echo "Testing SSL resigned server auth testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
export PORT=8447
export START_AT=0
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=9
else
export STOP_AT=100068
fi
export LD_LIBRARY_PATH="$HACKLIB"
export NISCC_TEST="$TEST/resigned_server"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog09" 2>&1 &
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog10" 2>&1
done
echo "starting tstclnt to shutdown resigned server selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog10" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
763
764
################################################################################
# Do resigned rootCA tests
May 1, 2006
May 1, 2006
765
# Use an altered server against the client
Jul 13, 2012
Jul 13, 2012
766
################################################################################
767
768
ssl_resigned_rootca()
{
Jul 13, 2012
Jul 13, 2012
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
echo "Testing SSL resigned rootCA testcases"
export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
export PORT=8448
export START_AT=0
if [ "$SMALLSET" = "true" ]; then
export STOP_AT=9
else
export STOP_AT=99959
fi
export LD_LIBRARY_PATH="$HACKLIB"
export NISCC_TEST="$TEST/resigned_rootca"
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog11" 2>&1 &
unset NISCC_TEST
export LD_LIBRARY_PATH="$TESTLIB"
for START in `seq $START_AT $THREADS $STOP_AT`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog12" 2>&1
done
echo "starting tstclnt to shutdown resigned rootca selfserv process"
for i in `seq 5`; do
LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
"${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog12" 2>&1
done
unset LD_LIBRARY_PATH
sleep 1
Jul 13, 2012
Jul 13, 2012
802
803
804
################################################################################
# Email the test logfile, and if core found, notify of failure
################################################################################
Jul 13, 2012
Jul 13, 2012
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
pushd "$TEST_OUTPUT"
# remove mozilla nss build false positives and core stored in previous runs
find . -name "core*" -print | grep -v coreconf | grep -v core_watch | grep -v archive >> crashLog
export SIZE=`cat crashLog | wc -l`
[ "$USE_MAIL" = "false" ] && return
# mail text
MT=mailText
rm -f $MT
if [ "$SIZE" -ne 1 ]; then
echo "### FAILED ###" >> $MT
echo "### Exactly one crash is expected." >> $MT
echo "### Zero means: crash detection is broken, fix the script!" >> $MT
echo "### > 1 means: robustness test failure, fix the bug! (check the logs)" >> $MT
cat crashLog >> nisccLogSummary
SUBJ="FAILED: NISCC TESTS (check file: crashLog)"
else
echo ":) PASSED :)" >> $MT
SUBJ="PASSED: NISCC tests"
fi
echo "Date used during test run: $DATE" >> $MT
echo "Count of lines in files:" >> $MT
wc -l crashLog nisccBuildLog nisccBuildLogHack nisccLog[0-9]* p7m-* |grep -vw total >> $MT
NUM=`cat nisccLog0[123456789] nisccLog1[12] | egrep -ic "success/passed"`
echo "Number of times the SSL tests reported success/passed (low expected): $NUM" >> $MT
NUM=`cat nisccLog0[123456789] nisccLog1[12] | egrep -ic "problem|failed|error"`
echo "Number of times the SSL tests reported problem/failed/error (high expected): $NUM" >> $MT
NUM=`cat niscc_smime/p7m*results.txt | egrep -ic "success/passed"`
echo "Number of times the S/MIME tests reported success/passed (low expected): $NUM" >> $MT
NUM=`cat niscc_smime/p7m*results.txt | egrep -ic "problem|failed|error"`
echo "Number of times the S/MIME tests reported problem/failed/error (high expected): $NUM" >> $MT
echo "==== tail of nisccBuildLog ====" >> $MT
tail -20 nisccBuildLog >> $MT
echo "===============================" >> $MT
echo "==== tail of nisccBuildLogHack ====" >> $MT
tail -20 nisccBuildLogHack >> $MT
echo "===================================" >> $MT
#NUM=``
#echo "Number of : $NUM" >> $MT
cat $MT | $MAIL_COMMAND -s "$SUBJ" $QA_LIST
popd
Jul 13, 2012
Jul 13, 2012
858
859
860
################################################################################
# Summarize all logs
################################################################################
Jul 13, 2012
Jul 13, 2012
863
864
865
866
867
868
869
870
871
872
873
874
875
876
echo "Summarizing all logs"
# Move old logs
[ -f "$TEST_OUTPUT/nisccLogSummary" ] && mv nisccLogSummary nisccLogSummary.old
[ -f "$TEST_OUTPUT/crashLog" ] && mv crashLog crashLog.old
for a in $TEST_OUTPUT/nisccLog[0-9]*; do
echo ================================== "$a"
grep -v using "$a" | sort | uniq -c | sort -b -n +0 -1
done > $TEST_OUTPUT/nisccLogSummary
for a in $TEST_OUTPUT/niscc_smime/p7m-*-results.txt; do
echo ================================== "$a"
grep -v using "$a" | sort | uniq -c | sort -b -n +0 -1
done >> $TEST_OUTPUT/nisccLogSummary
Jul 13, 2012
Jul 13, 2012
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
################################################################################
# Process core files
################################################################################
core_process()
{
echo "Processing core files"
cd "$TEST_OUTPUT"
for CORE in `cat crashLog`; do
FILE=`file "$CORE" | sed "s/.* from '//" | sed "s/'.*//"`
BINARY=`strings "$CORE" | grep "^${FILE}" | tail -1`
gdb "$BINARY" "$CORE" << EOF_GDB > "$CORE.details"
where
quit
EOF_GDB
done
}
Jul 13, 2012
Jul 13, 2012
897
898
899
################################################################################
# Move the old log files to save them, delete extra log files
################################################################################
Jul 13, 2012
Jul 13, 2012
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
echo "Moving and deleting log files"
cd "$TEST_OUTPUT"
rm -rf TRASH
mkdir TRASH
if [ "$LOG_STORE" = "true" ]; then
BRANCH=`echo $LOCALDIST | sed "s:.*/\(security.*\)/builds/.*:\1:"`
if [ "$BRANCH" = "$LOCALDIST" ]; then
ARCHIVE="$TEST_OUTPUT/archive"
else
ARCHIVE="$TEST_OUTPUT/archive/$BRANCH"
fi
# Check for archive directory
if [ ! -d "$ARCHIVE" ]; then
mkdir -p "$ARCHIVE"
fi
# Determine next log storage point
slot=`ls -1 "$ARCHIVE" | grep $DATE | wc -l`
slot=`expr $slot + 1`
location="$ARCHIVE/$DATE.$slot"
mkdir -p "$location"
# Archive the logs
mv nisccBuildLog "$location" 2> /dev/null
mv nisccBuildLogHack "$location" 2> /dev/null
mv nisccLogSummary "$location"
mv nisccLog* "$location"
mv niscc_smime/p7m-ed-m-results.txt "$location"
mv niscc_smime/p7m-sd-dt-results.txt "$location"
mv niscc_smime/p7m-sd-op-results.txt "$location"
# Archive any core files produced
for core in `cat "$TEST_OUTPUT/crashLog"`; do
mv "$core" "$location"
mv "$core.details" "$location"
done
mv crashLog "$location"
else
# Logs not stored => summaries, crashlog and corefiles not moved, other logs deleted
mv nisccLog00 nisccLog01 nisccLog02 nisccLog03 nisccLog04 nisccLog05 nisccLog06 nisccLog07 nisccLog08 nisccLog09 nisccLog10 nisccLog11 nisccLog12 TRASH/
mv niscc_smime/p7m-ed-m-results.txt niscc_smime/p7m-sd-dt-results.txt niscc_smime/p7m-sd-op-results.txt TRASH/
fi
mv envDB sigDB niscc_smime niscc_ssl TRASH/
mv CA.p12 Client.p12 client_crt.p12 server_crt.p12 TRASH/
mv p7m-ed-m-files.txt p7m-sd-dt-files.txt p7m-sd-op-files.txt password-is-testtest1.txt detached.txt TRASH/
mv crashme.c crashme TRASH/
Jul 13, 2012
Jul 13, 2012
953
954
955
956
957
################################################################################
# Main
################################################################################
process_args $*
create_environment
Nov 20, 2013
Nov 20, 2013
958
hg_pull
Jul 13, 2012
Jul 13, 2012
959
build_NSS
May 1, 2006
May 1, 2006
961
niscc_smime
Jul 13, 2012
Jul 13, 2012
963
force_crash
May 1, 2006
May 1, 2006
964
ssl_setup_dirs_simple
Jul 13, 2012
Jul 13, 2012
965
966
967
ssl_simple_client_auth
ssl_simple_server_auth
ssl_simple_rootca
May 1, 2006
May 1, 2006
968
ssl_setup_dirs_resigned
Jul 13, 2012
Jul 13, 2012
969
970
971
972
973
974
975
976
977
ssl_resigned_client_auth
ssl_resigned_server_auth
ssl_resigned_rootca
# no idea what these commented-out lines are supposed to be!
#ssl_setup_dirs_update
# ssl_update_server_auth der
# ssl_update_client_auth der
# ssl_update_server_auth resigned-der
# ssl_update_client_auth resigned-der
978
979
log_summary
mail_testLog
Jul 13, 2012
Jul 13, 2012
980
core_process
Jul 13, 2012
Jul 13, 2012
982
exit $SIZE