]>
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')
47 test_command
.append('{}.xctest'.format(x
))
48 test_dictionary
['Command'] = test_command
50 test_list
.append(test_dictionary
)
53 for x
in ['OctagonTrustTests']:
55 test_dictionary
= Foundation
.NSMutableDictionary
.dictionary()
56 test_dictionary
['TestName'] = x
57 test_dictionary
['Timeout']= 1200
58 test_dictionary
['ShowSubtestResults']= True
59 test_dictionary
['WorkingDirectory'] = '/AppleInternal/XCTests/com.apple.security/'
61 test_command
= Foundation
.NSMutableArray
.array()
62 test_command
.append('BATS_XCTEST_CMD')
63 test_command
.append('{}.xctest'.format(x
))
64 test_dictionary
['Command'] = test_command
66 test_list
.append(test_dictionary
)
69 for x
in get_class_names():
71 test_dictionary
= Foundation
.NSMutableDictionary
.dictionary()
72 test_dictionary
['TestName'] = x
73 test_dictionary
['Timeout']= 1200
74 test_dictionary
['ShowSubtestResults']= True
75 test_dictionary
['WorkingDirectory'] = '/AppleInternal/XCTests/com.apple.security/'
77 test_command
= Foundation
.NSMutableArray
.array()
78 test_command
.append('BATS_XCTEST_CMD')
79 test_command
.append('-XCTest')
80 test_command
.append('{}'.format(x
))
81 test_command
.append('OctagonTests.xctest')
82 test_dictionary
['Command'] = test_command
84 test_list
.append(test_dictionary
)
86 test_plist
['Tests'] = test_list
88 out_dir
= os
.path
.dirname(outfile
)
89 if not os
.path
.exists(out_dir
):
91 success
= test_plist
.writeToFile_atomically_(outfile
, 1)
93 print "test plist failed to write, error!"