-
Notifications
You must be signed in to change notification settings - Fork 7
/
AAFSystemTest.ksh
493 lines (377 loc) · 10.5 KB
/
AAFSystemTest.ksh
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
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
353
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
402
403
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
448
449
450
451
452
453
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
#! C:/mksnt/sh.exe
###############################################################################
#
# $Id$ $Name$
#
# The contents of this file are subject to the AAF SDK Public Source
# License Agreement Version 2.0 (the "License"); You may not use this
# file except in compliance with the License. The License is available
# in AAFSDKPSL.TXT, or you may obtain a copy of the License from the
# Advanced Media Workflow Association, Inc., or its successor.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License. Refer to Section 3.3 of the License for proper use
# of this Exhibit.
#
# WARNING: Please contact the Advanced Media Workflow Association,
# Inc., for more information about any additional licenses to
# intellectual property covering the AAF Standard that may be required
# to create and distribute AAF compliant products.
# (http://www.amwa.tv/policies).
#
# Copyright Notices:
# The Original Code of this file is Copyright 1998-2009, licensor of the
# Advanced Media Workflow Association. All rights reserved.
#
# The Initial Developer of the Original Code of this file and the
# licensor of the Advanced Media Workflow Association is
# Avid Technology.
# All rights reserved.
#
###############################################################################
ROOT_DIR="`PWD`"
LOGFILE=${ROOT_DIR}/SystemTest.log
AAF_FILES_DIR="${ROOT_DIR}/TestAAFFiles"
SCRIPT_FILES_DIR="${ROOT_DIR}/TestScriptFiles"
OMF_FILES_DIR="${ROOT_DIR}/TestOMFFiles"
OLD_PATH=""
CLEAN=0
RELEASE=0
DEBUG=0
MODTESTS_AND_EXAMPLES=0
Status=0
AAFDumpStatus=0
GenStatus=0
ValStatus=0
dumpStatus=0
#####################
# Parse Command Line
#####################
until [ $# = 0 ]
do
case $1 in
-clean ) CLEAN=1 ;;
-r ) RELEASE=1 ;;
-d ) DEBUG=1 ;;
-e ) MODTESTS_AND_EXAMPLES=1 ;;
-h ) echo "\n-clean = clean output dirs"
echo "-r = system tests the Release sdk"
echo "-d = system tests the Debug sdk"
echo "-e = will call RunModTestsAndExamples.ksh before running system tests"
exit 1 ;;
esac
shift
done
if [ RELEASE -ne 1 ] && [ DEBUG -ne 1 ] && [ CLEAN -ne 1 ]; then
print "Use -h for help"
exit 1
fi
DirectoryTest ()
{
Directory=$1
MAKE_DIR_IF_NOT_FOUND=1
VERBOSE=1
Result=0
EMPTY=1
NOT_FOUND=2
until [ $# = 0 ]
do
case $1 in
-m ) MAKE_DIR_IF_NOT_FOUND=0 ;;
-v ) VERBOSE=0;;
esac
shift
done
Result=0
EMPTY=1
NOT_FOUND=2
vprint ()
{
string=$1
if [ $VERBOSE -eq 0 ]; then print "$string"; fi
}
if [ -d $Directory ]; then
LSF="`ls $Directory`"
if [ -z "$LSF" ]; then
Result=$EMPTY
vprint "\n\tDirectory is Empty: $Directory\n"
fi
else
vprint "\n\tDirectory Not Found: $Directory\n"
Result=$NOT_FOUND
if [ $MAKE_DIR_IF_NOT_FOUND -eq 0 ]; then
if mkdir $Directory; then
print "Created $Directory\n"
Result=0
else
print "\n\tAttempt to Create Directory Failed! $Directory\n"
fi
fi
fi
return $Result
}
Clean ()
{
CleanTarget=$1
EMPTY=1
NOT_FOUND=2
print -n "Checking for directory: ${CleanTarget}TestResults \t"
DirectoryTest ${ROOT_DIR}/${CleanTarget}TestResults
TestResult=$?
if [ $TestResult -eq 0 ]; then
print "Deleted Contents"
rm ${ROOT_DIR}/${CleanTarget}TestResults/*
elif [ $TestResult -eq $EMPTY ]; then
print "Directory is Empty"
elif [ $TestResult -eq $NOT_FOUND ]; then
print "Directory Not Found"
fi
}
SetPath ()
{
Target=$1
print "\nSetting PATH $Target \n"
OLD_PATH=$PATH
PATH="`PWD`/AAFWinSDK/${Target}/RefImpl;$PATH"
}
ResetPath ()
{
print "\nResetting PATH\n"
PATH=$OLD_PATH
}
RunThruTimsDump ()
{
AAFFileName=$1
FileDir=$2
STATUS=-1
if ${DUMP_DIR}/dump.exe -a -s ${FileDir}/$AAFFileName > ${AAFFileName}.dmp.log
then
print " RunThruTimsDump... ok" | tee -a $LOGFILE
STATUS=0
else
print " RunThruTimsDump... FAILED" | tee -a $LOGFILE
fi
return $STATUS
}
RunThruDumper ()
{
AAFFileName=$1
FileDir=$2
STATUS=-1
if ${UTILS_DIR}/AAFDump.exe -vp -i ${FileDir}/${AAFFileName} -o ${AAFFileName}.scrpt > ${AAFFileName}.scrpt.log
then
print " RunThruDumper... ok" | tee -a $LOGFILE
STATUS=0
else
print " RunThruDumper... FAILED" | tee -a $LOGFILE
fi
return $STATUS
}
RunThruValidator ()
{
AAFFileName=$1
FileDir=$2
STATUS=-1
cd $OUTPUT_DIR
if ${UTILS_DIR}/AAFValidate.exe -v -e -E -l -M -p -r -s -S -i ${FileDir}/$AAFFileName > ${AAFFileName}.val.log
then
print " RunThruValidator... ok" | tee -a $LOGFILE
STATUS=0
else
print " RunThruValidator... FAILED" | tee -a $LOGFILE
fi
return $STATUS
}
RunThruGenerator ()
{
ScriptFileName=$1
FileDir=$2
STATUS=-1
cd $OUTPUT_DIR
if ${UTILS_DIR}/MakeAAFFile.exe -p -i ${FileDir}/$ScriptFileName -o ${ScriptFileName}.aaf > ${ScriptFileName}.aaf.fg.log
then
print " RunThruGenerator... ok" | tee -a $LOGFILE
STATUS=0
else
print " RunThruGenerator... FAILED" | tee -a $LOGFILE
fi
return $STATUS
}
RunOMFThruAafOmf ()
{
OMFFileName=$1
FileDir=$2
STATUS=-1
cd $OUTPUT_DIR
if ${UTILS_DIR}/AafOmf.exe ${FileDir}/${OMFFileName} ${OMFFileName}.aaf > ${OMFFileName}.aaf.AafOmf.log
then
print " RunOMFThruAafOmf... ok" | tee -a $LOGFILE
STATUS=0
else
print " RunOMFThruAafOmf... FAILED" | tee -a $LOGFILE
fi
return $STATUS
}
DiffDumperLogFiles ()
{
DmpFileName=$1
cd $OUTPUT_DIR
DiffFiles ()
{
DmpFileA=$1
DmpFileB=$2
if [ -a $DmpFileA ] && [ -a $DmpFileB ]; then
print " diff'ing: $DmpFileA" >> ${DmpFileName}.diff.log
print " $DmpFileB" >> ${DmpFileName}.diff.log
print "*************************************************************************************\n" >> ${DmpFileName}.diff.log
if diff -C 1 $DmpFileA $DmpFileB >> ${DmpFileName}.diff.log; then
print " DumpDiff... ok" | tee -a $LOGFILE
else
print " DumpDiff... FAILED" | tee -a $LOGFILE
fi
print "\n\n" >> ${DmpFileName}.diff.log
fi
}
DiffFiles ${DmpFileName}.dmp.log ${DmpFileName}.scrpt.aaf.dmp.log
DiffFiles ${DmpFileName}.scrpt.aaf.dmp.log ${DmpFileName}.scrpt.aaf.scrpt.aaf.dmp.log
}
RunCreateSequence ()
{
Target=$1
RCSLOG="${OUTPUT_DIR}/CreateSequenceOpenClose.log"
date > $RCSLOG
let Max=8
let Multiplier=2
print "\n---------------------------------------------------------------------" | tee -a $LOGFILE
print "Creating AAF Files with CreateSequence.ksh\n" | tee -a $LOGFILE
let Count=1
while [ Count -le $Max ];
do
print "CreateSequence${Count}.aaf" | tee -a $RCSLOG
${ROOT_DIR}/AAFWinSDK/${Target}/Test/CreateSequence $Count ${OUTPUT_DIR}/CreateSequence${Count}.aaf >> $RCSLOG
let Count=Count*$Multiplier
done
}
RunThroughTestSuite ()
{
TITLE=$1
FILE_TYPE=$2
FILE_LIST_LOCATION=$3
SECONDARY_LOCATION=$4
if [ $# -eq 3 ]; then
SECONDARY_LOCATION=$FILE_LIST_LOCATION
fi
print "\n\n\n---------------------------------------------------------------------" | tee -a $LOGFILE
print "Running $TITLE through System Test Suite \n" | tee -a $LOGFILE
DirectoryTest $FILE_LIST_LOCATION -v
if [ $? -eq 0 ]; then
cd $FILE_LIST_LOCATION
FILE_LIST="`ls ${FILE_TYPE}`"
DirectoryTest $SECONDARY_LOCATION -v -m
else
FILE_LIST=""
fi
for File in $FILE_LIST; do
print "\n $File\n" | tee -a $LOGFILE
## If script file, first run thru generator
if echo "$File" | grep -q "\.scrpt$" ; then
if RunThruGenerator $File ${FILE_LIST_LOCATION}; then
File="${File}.aaf"
FILE_LIST_LOCATION=$SECONDARY_LOCATION
else
return -1
fi
## If omf file, first run thru converter
elif echo "$File" | grep -q "\.omf$" ; then
if RunOMFThruAafOmf $File ${FILE_LIST_LOCATION}; then
File="${File}.aaf"
FILE_LIST_LOCATION=$SECONDARY_LOCATION
else
return -1
fi
fi
cd ${OUTPUT_DIR}
## This test suite assumes $File is an AAF file
RunThruTimsDump $File ${FILE_LIST_LOCATION}
RunThruValidator $File ${SECONDARY_LOCATION}
if RunThruDumper $File ${SECONDARY_LOCATION}; then
if RunThruGenerator ${File}.scrpt ${OUTPUT_DIR}; then
RunThruTimsDump ${File}.scrpt.aaf ${OUTPUT_DIR}
RunThruValidator ${File}.scrpt.aaf ${OUTPUT_DIR}
if RunThruDumper ${File}.scrpt.aaf ${OUTPUT_DIR}; then
if RunThruGenerator ${File}.scrpt.aaf.scrpt ${OUTPUT_DIR}; then
RunThruTimsDump ${File}.scrpt.aaf.scrpt.aaf ${OUTPUT_DIR}
RunThruValidator ${File}.scrpt.aaf.scrpt.aaf ${OUTPUT_DIR}
RunThruDumper ${File}.scrpt.aaf.scrpt.aaf ${OUTPUT_DIR}
fi
fi
fi
fi
DiffDumperLogFiles $AAFfile
done
}
RunSystemTest ()
{
TARGET=$1
AAF_MODTEST_DIR=${ROOT_DIR}/AAFWinSDK/${TARGET}/Test
AAF_EXAMPLE_DIR=${ROOT_DIR}/AAFWinSDK/${TARGET}/Examples/Com
UTILS_DIR=${ROOT_DIR}/AAFWinSDK/${TARGET}/Utilities
DUMP_DIR=${ROOT_DIR}/AAFWinSDK/${TARGET}/DevUtils
OUTPUT_DIR="${ROOT_DIR}/${TARGET}TestResults"
SetPath $TARGET
#############################################
# Get test file lists
#############################################
DirectoryTest ${OUTPUT_DIR} -m
RunCreateSequence $TARGET
RunThroughTestSuite "CreateSequence AAF Files" "CreateSequence*.aaf" $OUTPUT_DIR
RunThroughTestSuite "Module Test AAF Files" "*.aaf" $AAF_MODTEST_DIR
RunThroughTestSuite "Examples AAF Files" "*.aaf" $AAF_EXAMPLE_DIR
RunThroughTestSuite "TestAAFFiles" "*.aaf" $AAF_FILES_DIR
RunThroughTestSuite "TestScriptFiles" "*.scrpt" $SCRIPT_FILES_DIR $OUTPUT_DIR
RunThroughTestSuite "TestOMFFiles" "*.omf" $OMF_FILES_DIR $OUTPUT_DIR
print "\n\n\n"
ResetPath
cd $ROOT_DIR
print "\nGenerating Efficiency and File Size spreadsheet\n"
EfficiencyStats $TARGET
}
############################################
# Check for CLEAN
############################################
if [ CLEAN -eq 1 ]; then
if [ RELEASE -eq 1 ]; then
Clean Release
fi
if [ DEBUG -eq 1 ]; then
Clean Debug
fi
if [ RELEASE -eq 0 ] && [ DEBUG -eq 0 ]; then
Clean Release
Clean Debug
fi
exit 1
fi
############################################
# Run the System Tests
############################################
print "AAF System Test" >> $LOGFILE
date >> $LOGFILE
if [ RELEASE -eq 1 ]; then
if [ MODTESTS_AND_EXAMPLES -eq 1 ]; then
print "\n\nRunning Script: RunModTestAndExamples.ksh -r\n\n"
RunModTestAndExamples -r
fi
RunSystemTest Release
fi
if [ DEBUG -eq 1 ]; then
if [ MODTESTS_AND_EXAMPLES -eq 1 ]; then
print "\n\nRunning Script: RunModTestAndExamples.ksh -d\n\n"
RunModTestAndExamples -d
fi
RunSystemTest Debug
fi
cd $ROOT_DIR
exit $Status