mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-12-04 00:03:41 -05:00
adding memory leak testing (#1234)
* adding memory leak testing for x86_64 on ubuntu * document test exclusion of Classic-McEliece-8192128
This commit is contained in:
parent
fbb34be899
commit
a8dad8d305
@ -350,25 +350,27 @@ workflows:
|
||||
context: openquantumsafe
|
||||
CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest
|
||||
CMAKE_ARGS: -DCMAKE_C_COMPILER=gcc-8 -DOQS_USE_OPENSSL=OFF
|
||||
PYTEST_ARGS: --ignore=tests/test_leaks.py
|
||||
- linux_oqs:
|
||||
<<: *require_buildcheck
|
||||
name: ubuntu-focal-shared-noopenssl
|
||||
context: openquantumsafe
|
||||
CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest
|
||||
CMAKE_ARGS: -DCMAKE_C_COMPILER=gcc-7 -DOQS_DIST_BUILD=ON -DOQS_USE_OPENSSL=OFF -DBUILD_SHARED_LIBS=ON
|
||||
PYTEST_ARGS: --ignore=tests/test_namespace.py --numprocesses=auto
|
||||
PYTEST_ARGS: --ignore=tests/test_namespace.py --ignore=tests/test_leaks.py --numprocesses=auto
|
||||
- linux_oqs:
|
||||
<<: *require_buildcheck
|
||||
name: ubuntu-focal-clang14
|
||||
context: openquantumsafe
|
||||
CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest
|
||||
CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-14
|
||||
CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-14 -DOQS_OPT_TARGET=skylake
|
||||
- linux_oqs:
|
||||
<<: *require_buildcheck
|
||||
name: ubuntu-bionic-i386
|
||||
context: openquantumsafe
|
||||
CONTAINER: openquantumsafe/ci-ubuntu-bionic-i386:latest
|
||||
CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_x86.cmake
|
||||
PYTEST_ARGS: --ignore=tests/test_leaks.py
|
||||
- arm_machine:
|
||||
<<: *require_buildcheck
|
||||
name: arm64
|
||||
|
||||
@ -109,6 +109,8 @@ Are implementations chosen based on runtime CPU feature detection? **Yes**.
|
||||
|
||||
Are implementations chosen based on runtime CPU feature detection? **Yes**.
|
||||
|
||||
*Note: This algorithm is known to fail memory leak testing on x86_64.*
|
||||
|
||||
## Classic-McEliece-8192128f implementation characteristics
|
||||
|
||||
| Implementation source | Identifier in upstream | Supported architecture(s) | Supported operating system(s) | CPU extension(s) used | No branching-on-secrets claimed? | No branching-on-secrets checked by valgrind? | Large stack usage? |
|
||||
@ -120,4 +122,4 @@ Are implementations chosen based on runtime CPU feature detection? **Yes**.
|
||||
|
||||
## Explanation of Terms
|
||||
|
||||
- **Large Stack Usage**: Implementations identified as having such may cause failures when running in threads or in constrained environments.
|
||||
- **Large Stack Usage**: Implementations identified as having such may cause failures when running in threads or in constrained environments.
|
||||
|
||||
@ -10,8 +10,8 @@ if [ $? -ne 1 ]; then
|
||||
rv=-1
|
||||
fi
|
||||
|
||||
# check _all_ source files for CRLF line endings:
|
||||
find . -name '*.[chS]' -exec file "{}" ";" | grep CRLF
|
||||
# check _all_ source files for CRLF line endings (except in repos directory):
|
||||
find . \( -type d -name repos -prune \) -o -name '*.[chS]' -exec file "{}" ";" | grep CRLF
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "Error: Files found with non-UNIX line endings."
|
||||
echo "To fix, consider running \"find src tests -name '*.[chS]' | xargs sed -i 's/\r//' \"."
|
||||
|
||||
30
tests/test_leaks.py
Normal file
30
tests/test_leaks.py
Normal file
@ -0,0 +1,30 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import helpers
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
@helpers.filtered_test
|
||||
@pytest.mark.parametrize('kem_name', helpers.available_kems_by_name())
|
||||
def test_kem_leak(kem_name):
|
||||
if not(helpers.is_kem_enabled_by_name(kem_name)): pytest.skip('Not enabled')
|
||||
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
||||
if kem_name == "Classic-McEliece-8192128": pytest.skip("Classic-McEliece-8192128 known to fail memory leak testing")
|
||||
helpers.run_subprocess(
|
||||
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_kem'), kem_name],
|
||||
)
|
||||
|
||||
@helpers.filtered_test
|
||||
@pytest.mark.parametrize('sig_name', helpers.available_sigs_by_name())
|
||||
def test_sig_leak(sig_name):
|
||||
if not(helpers.is_sig_enabled_by_name(sig_name)): pytest.skip('Not enabled')
|
||||
if sys.platform != "linux" or os.system("grep ubuntu /etc/os-release") != 0 or os.system("uname -a | grep x86_64") != 0: pytest.skip('Leak testing not supported on this platform')
|
||||
helpers.run_subprocess(
|
||||
["valgrind", "-s", "--error-exitcode=1", "--leak-check=full", "--show-leak-kinds=all", helpers.path_to_executable('test_sig'), sig_name],
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
pytest.main(sys.argv)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user