]>
git.saurik.com Git - apple/security.git/blob - tests/TrustTests/gen_test_plist.py
11 test_plist
= Foundation
.NSMutableDictionary
.dictionary()
12 test_plist
['Project'] = 'Security'
13 test_list
= Foundation
.NSMutableArray
.array()
15 test_files
= glob(test_dir
+ '/*/*.m')
17 for filename
in test_files
:
18 f
= open(filename
, 'r')
20 match
= re
.search('@interface ([a-zA-Z0-9_]+) ?: ?Trust[a-zA-Z0-9_]+TestCase', line
)
22 regex_string
= test_dir
+ '/([a-zA-Z0-9_]+/)'
23 test_dir_match
= re
.search(regex_string
, filename
)
24 if not test_dir_match
:
25 print 'failed to find test dir name for ' + filename
+ " with regex " + regex_string
27 test_dictionary
= Foundation
.NSMutableDictionary
.dictionary()
28 test_dictionary
['TestName'] = test_dir_match
.group(1) + match
.group(1)
29 test_dictionary
['ShowSubtestResults']= True
30 test_dictionary
['WorkingDirectory'] = '/AppleInternal/XCTests/com.apple.security/'
31 test_dictionary
['AsRoot'] = True
33 test_command
= Foundation
.NSMutableArray
.array()
34 test_command
.append('/AppleInternal/CoreOS/tests/Security/TrustTests')
35 test_command
.append('-c')
36 test_command
.append(match
.group(1))
37 test_command
.append('-t')
38 test_command
.append('TrustTests')
40 test_dictionary
['Command'] = test_command
42 test_list
.append(test_dictionary
)
45 test_plist
['Tests'] = test_list
47 out_dir
= os
.path
.dirname(outfile
)
48 if not os
.path
.exists(out_dir
):
50 success
= test_plist
.writeToFile_atomically_(outfile
, 1)
52 print "test plist failed to write, error!"