| 1 | #! /usr/bin/env python |
| 2 | # |
| 3 | # __main__.py : Stand-along loader for PyCryptodome test suite |
| 4 | # |
| 5 | # =================================================================== |
| 6 | # The contents of this file are dedicated to the public domain. To |
| 7 | # the extent that dedication to the public domain is not available, |
| 8 | # everyone is granted a worldwide, perpetual, royalty-free, |
| 9 | # non-exclusive license to exercise all rights associated with the |
| 10 | # contents of this file for any purpose whatsoever. |
| 11 | # No rights are reserved. |
| 12 | # |
| 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 16 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 17 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 18 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 19 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | # SOFTWARE. |
| 21 | # =================================================================== |
| 22 | |
| 23 | from __future__ import print_function |
| 24 | |
| 25 | import sys |
| 26 | |
| 27 | from Crypto import SelfTest |
| 28 | |
| 29 | slow_tests = not ("--skip-slow-tests" in sys.argv) |
| 30 | if not slow_tests: |
| 31 | print("Skipping slow tests") |
| 32 | |
| 33 | wycheproof_warnings = "--wycheproof-warnings" in sys.argv |
| 34 | if wycheproof_warnings: |
| 35 | print("Printing Wycheproof warnings") |
| 36 | |
| 37 | if "-v" in sys.argv: |
| 38 | verbosity=2 |
| 39 | else: |
| 40 | verbosity=1 |
| 41 | |
| 42 | config = {'slow_tests': slow_tests, 'wycheproof_warnings': wycheproof_warnings} |
| 43 | SelfTest.run(stream=sys.stdout, verbosity=verbosity, config=config) |