Allow to easily run individual test modules and add instructions to README (#39)

Allow to easily run individual test modules and add instructions to README
This commit is contained in:
Douglas Stebila 2019-02-18 08:48:13 -05:00 committed by GitHub
commit c6dd00c6fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 2 deletions

View File

@ -34,8 +34,8 @@ _The checking of items on this list is still being developed. Checked items shou
* [x] API functions do not write outside provided buffers * [x] API functions do not write outside provided buffers
* [x] Compiles with `-Wall -Wextra -Wpedantic -Werror` with `gcc` and `clang` * [x] Compiles with `-Wall -Wextra -Wpedantic -Werror` with `gcc` and `clang`
* [x] Consistent test vectors across runs * [x] Consistent test vectors across runs
* [ ] Consistent test vectors on big-endian and little-endian machines * [x] Consistent test vectors on big-endian and little-endian machines
* [ ] Consistent test vectors on 32-bit and 64-bit machines * [x] Consistent test vectors on 32-bit and 64-bit machines
* [x] No errors/warnings reported by valgrind * [x] No errors/warnings reported by valgrind
* [x] No errors/warnings reported by address sanitizer * [x] No errors/warnings reported by address sanitizer
* [ ] Only dependencies: * [ ] Only dependencies:
@ -131,3 +131,19 @@ Regarding #2, adding the files to your project's build system, each implementati
Each subdirectory containing implementations contains a LICENSE file stating under what license Each subdirectory containing implementations contains a LICENSE file stating under what license
that specific implementation is released. All other code for testing etc. in this repository that specific implementation is released. All other code for testing etc. in this repository
is released under the conditions of [CC0](http://creativecommons.org/publicdomain/zero/1.0/). is released under the conditions of [CC0](http://creativecommons.org/publicdomain/zero/1.0/).
## Running tests locally
While we run extensive automatic testing on [Travis CI][travis-pqc] and [Appveyor][appveyor-pqc], most tests can also be run locally.
To do this, make sure the following is installed:
* Python 3.5+
* `nosetests` or `nose2` (either for Python 3)
Run the Python-based tests by going into the `test` directory and running `nosetests -v` or `nose2 -B -v`, depending on what you installed.
If you have the `rednose` plugin for `nosetests` installed, run `nosetests --rednose` to get colored output.
You may also run `python <testmodule>` where `<testmodule>` is any of the files starting with `test_` in the `test/` folder.
[travis-pqc]: https://travis-ci.com/PQClean/PQClean/
[appveyor-pqc]: https://ci.appveyor.com/project/PQClean/pqclean

View File

@ -24,3 +24,12 @@ def check_compile_lib(scheme_name, implementation_name):
['make'], ['make'],
implementation.path() implementation.path()
) )
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()

View File

@ -28,3 +28,12 @@ def check_functest(scheme_name, implementation_name):
['./functest_{}_{}'.format(scheme_name, implementation_name)], ['./functest_{}_{}'.format(scheme_name, implementation_name)],
os.path.join('..', 'bin'), os.path.join('..', 'bin'),
) )
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()

View File

@ -19,3 +19,12 @@ def check_license(scheme_name, implementation_name):
p1 = os.path.join(implementation.path(), 'LICENSE') p1 = os.path.join(implementation.path(), 'LICENSE')
p2 = os.path.join(implementation.path(), 'LICENSE.txt') p2 = os.path.join(implementation.path(), 'LICENSE.txt')
assert(os.path.isfile(p1) or os.path.isfile(p2)) assert(os.path.isfile(p1) or os.path.isfile(p2))
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()

View File

@ -123,3 +123,12 @@ def check_element(field, element, props):
if type_ == dict: if type_ == dict:
check_spec(element, props['spec'].items()) check_spec(element, props['spec'].items())
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()

View File

@ -49,3 +49,12 @@ def check_symbol_namespace(scheme_name, implementation_name):
for symbol in non_namespaced: for symbol in non_namespaced:
print("\ttype: {}, symbol: {}".format(symtype, symbol)) print("\ttype: {}, symbol: {}".format(symtype, symbol))
assert(False) assert(False)
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()