| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 '''Generates a test suite from NIST PKITS test descriptions. | 5 '''Generates a test suite from NIST PKITS test descriptions. |
| 6 | 6 |
| 7 The output is a set of Type Parameterized Tests which are included by | 7 The output is a set of Type Parameterized Tests which are included by |
| 8 pkits_unittest.h. See pkits_unittest.h for information on using the tests. | 8 pkits_unittest.h. See pkits_unittest.h for information on using the tests. |
| 9 GoogleTest has a limit of 50 tests per type parameterized testcase, so the tests | 9 GoogleTest has a limit of 50 tests per type parameterized testcase, so the tests |
| 10 are split up by section number (this also makes it possible to easily skip | 10 are split up by section number (this also makes it possible to easily skip |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 %(certs_formatted)s | 64 %(certs_formatted)s |
| 65 }; | 65 }; |
| 66 const char* const crls[] = { | 66 const char* const crls[] = { |
| 67 %(crls_formatted)s | 67 %(crls_formatted)s |
| 68 }; | 68 }; |
| 69 ''' % vars()) | 69 ''' % vars()) |
| 70 | 70 |
| 71 default_info = TestInfo(None) | 71 default_info = TestInfo(None) |
| 72 | 72 |
| 73 output.write('''PkitsTestInfo info; | 73 output.write('''PkitsTestInfo info; |
| 74 info.test_number = "%s"; |
| 74 info.should_validate = %s; | 75 info.should_validate = %s; |
| 75 ''' % (bool_to_str(info.should_validate))) | 76 ''' % (test_number, bool_to_str(info.should_validate))) |
| 76 | 77 |
| 77 # Output any non-default inputs/outputs. Only properties that differ from | 78 # Output any non-default inputs/outputs. Only properties that differ from |
| 78 # the defaults are written, so as to keep the generated file more readable. | 79 # the defaults are written, so as to keep the generated file more readable. |
| 79 if info.initial_policy_set != default_info.initial_policy_set: | 80 if info.initial_policy_set != default_info.initial_policy_set: |
| 80 output.write(''' info.SetInitialPolicySet(%s); | 81 output.write(''' info.SetInitialPolicySet(%s); |
| 81 ''' % make_policies_string(info.initial_policy_set)) | 82 ''' % make_policies_string(info.initial_policy_set)) |
| 82 | 83 |
| 83 if info.initial_explicit_policy != default_info.initial_explicit_policy: | 84 if info.initial_explicit_policy != default_info.initial_explicit_policy: |
| 84 output.write(''' info.SetInitialExplicitPolicy(%s); | 85 output.write(''' info.SetInitialExplicitPolicy(%s); |
| 85 ''' % bool_to_str(info.initial_explicit_policy)) | 86 ''' % bool_to_str(info.initial_explicit_policy)) |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 continue | 1221 continue |
| 1221 i, parse_test(lines, i, test_case_name, test_number, | 1222 i, parse_test(lines, i, test_case_name, test_number, |
| 1222 test_name, sanitized_test_names, output) | 1223 test_name, sanitized_test_names, output) |
| 1223 | 1224 |
| 1224 if test_case_name: | 1225 if test_case_name: |
| 1225 finalize_test_case(test_case_name, sanitized_test_names, output) | 1226 finalize_test_case(test_case_name, sanitized_test_names, output) |
| 1226 | 1227 |
| 1227 | 1228 |
| 1228 if __name__ == '__main__': | 1229 if __name__ == '__main__': |
| 1229 main() | 1230 main() |
| OLD | NEW |