]>
git.saurik.com Git - apple/security.git/blob - keychain/ot/tests/gen_test_plist.py
3 # TODO(kirk or SEAR/QA) after radar 53867279 is fixed, please delete this script
5 # WARNING: if you add new tests to the swift octagon tests, it is possible that
6 # this script will not find them and then your new tests will not get executed
15 test_dir
= sys
.argv
[1]
18 test_plist
= Foundation
.NSMutableDictionary
.dictionary()
19 test_plist
['BATSConfigVersion'] = '0.1.0'
20 test_plist
['Project'] = 'Security'
21 test_list
= Foundation
.NSMutableArray
.array()
23 test_files
= glob(test_dir
+ '/octagon/*.swift') + glob(test_dir
+ '/octagon/*/*.swift')
25 def get_class_names():
26 test_classes
= ['OTFollowupTests']
27 for filename
in test_files
:
28 f
= open(filename
, 'r')
30 match
= re
.search('class (([a-zA-Z0-9_]+Tests)|(OctagonTests[a-zA-Z0-9_]*(?<!Base))): ', line
)
32 test_classes
.append('OctagonTests.{}'.format(match
.group(1)))
37 for x
in ['TrustedPeersTests', 'TrustedPeersHelperUnitTests']:
39 test_dictionary
= Foundation
.NSMutableDictionary
.dictionary()
40 test_dictionary
['TestName'] = x
41 test_dictionary
['Timeout']= 1200
42 test_dictionary
['ShowSubtestResults']= True
43 test_dictionary
['WorkingDirectory'] = '/AppleInternal/XCTests/com.apple.security/'
45 test_command
= Foundation
.NSMutableArray
.array()
46 test_command
.append('BATS_XCTEST_CMD {}.xctest'.format(x
))
47 test_dictionary
['Command'] = test_command
49 test_list
.append(test_dictionary
)
52 for x
in get_class_names():
54 test_dictionary
= Foundation
.NSMutableDictionary
.dictionary()
55 test_dictionary
['TestName'] = x
56 test_dictionary
['Timeout']= 1200
57 test_dictionary
['ShowSubtestResults']= True
58 test_dictionary
['WorkingDirectory'] = '/AppleInternal/XCTests/com.apple.security/'
60 test_command
= Foundation
.NSMutableArray
.array()
61 test_command
.append('BATS_XCTEST_CMD -XCTest {} OctagonTests.xctest'.format(x
))
62 test_dictionary
['Command'] = test_command
64 test_list
.append(test_dictionary
)
66 test_plist
['Tests'] = test_list
68 out_dir
= os
.path
.dirname(outfile
)
69 if not os
.path
.exists(out_dir
):
71 success
= test_plist
.writeToFile_atomically_(outfile
, 1)
73 print "test plist failed to write, error!"