]>
git.saurik.com Git - apple/security.git/blob - keychain/ckks/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
16 test_dir
= sys
.argv
[1]
19 test_plist
= Foundation
.NSMutableDictionary
.dictionary()
20 test_plist
['BATSConfigVersion'] = '0.1.0'
21 test_plist
['Project'] = 'Security'
22 test_list
= Foundation
.NSMutableArray
.array()
24 test_files
= glob(test_dir
+ '/*.m') + glob(test_dir
+ '/*.h')
26 def get_class_names():
27 test_classes
= ['CKKSLaunchSequenceTests']
28 for filename
in test_files
:
29 f
= open(filename
, 'r')
31 match
= re
.search('@interface ([a-zA-Z0-9_]+) ?: ?CloudKitKeychain[a-zA-Z0-9_]*TestsBase', line
)
32 #match = re.search('class (([a-zA-Z0-9_]+Tests)|(OctagonTests[a-zA-Z0-9_]*(?<!Base))): ', line)
34 test_classes
.append(match
.group(1))
36 # And pick up everything that's a default xctest, too
37 match
= re
.search('@interface ([a-zA-Z0-9_]+) ?: ?XCTestCase', line
)
39 test_classes
.append(match
.group(1))
41 # or based on CloudKitMockXCTest
42 match
= re
.search('@interface ([a-zA-Z0-9_]+) ?: ?CloudKitMockXCTest', line
)
44 test_classes
.append(match
.group(1))
47 # But we don't want any helper classes
48 base_classes
= ['CloudKitMockXCTest', 'CloudKitKeychainSyncingMockXCTest', 'CKKSCloudKitTests']
49 for base_class
in base_classes
:
50 test_classes
= [x
for x
in test_classes
if base_class
!= x
]
53 for x
in get_class_names():
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')
64 test_command
.append('{}'.format(x
))
65 test_command
.append('CKKSTests.xctest')
66 test_dictionary
['Command'] = test_command
68 test_list
.append(test_dictionary
)
70 test_plist
['Tests'] = test_list
72 out_dir
= os
.path
.dirname(outfile
)
73 if not os
.path
.exists(out_dir
):
75 success
= test_plist
.writeToFile_atomically_(outfile
, 1)
77 print "test plist failed to write, error!"