liboqs/tests/test_distbuild.py
John Schanck b36ff9f17c
Replace OQS_PORTABLE_BUILD and OQS_USE_CPU_EXTENSIONS (#951)
* Replace OQS_PORTABLE_BUILD with OQS_DIST_BUILD

Also introduces OQS_OPT_TARGET and removes OQS_USE_CPU_EXTENSIONS

* Only compile sha3 avx2 code on Linux|Darwin

* Use new ARCH_ARM[X] flags in SIKE CMakeLists

* Update test_portability and rename to test_distbuild

* Update documentation for building Windows AMD64 from Ubuntu Bionic

* Update scripts/build-android.sh

* More specific CMAKE_SYSTEM_PROCESSOR for rasppi toolchain

* CI: Use OQS_DIST_BUILD in some jobs

* Replace OQS_get_available_CPU_extensions by OQS_CPU_has_extension

* ARM64v8/ARM32v7 runtime cpu feature detection

* Compile-time detection of some ARM features

* Toolchain files to cross compile for ARM32v7 and ARM64v8

* Remove unnecessary references to CMAKE_BUILD_TYPE=Release

* Use OQS_DIST_BUILD=ON on Windows
2021-03-31 16:30:54 -04:00

44 lines
1.4 KiB
Python

# SPDX-License-Identifier: MIT
import helpers
import pytest
import platform
from pathlib import Path
# TODO: We shouldn't use platform.machine() to select the qemu binary directly,
# since platform.machine() might return, say, AMD64 instead of x86_64.
if platform.machine() == 'x86_64':
MINCPU = "Westmere"
elif platform.machine() == 'aarch64':
MINCPU = "cortex-a53"
else:
MINCPU = "max"
@helpers.filtered_test
@pytest.mark.parametrize('kem_name', helpers.available_kems_by_name())
@helpers.test_requires_build_options("OQS_DIST_BUILD")
@helpers.test_requires_qemu(platform.machine(), MINCPU)
def test_kem(kem_name):
if not(helpers.is_kem_enabled_by_name(kem_name)):
pytest.skip('Not enabled')
helpers.run_subprocess(["qemu-"+platform.machine()+"-static", "-cpu", MINCPU,
helpers.path_to_executable('test_kem'), kem_name])
@helpers.filtered_test
@pytest.mark.parametrize('sig_name', helpers.available_sigs_by_name())
@helpers.test_requires_build_options("OQS_DIST_BUILD")
@helpers.test_requires_qemu(platform.machine(), MINCPU)
def test_sig(sig_name):
if not(helpers.is_sig_enabled_by_name(sig_name)):
pytest.skip('Not enabled')
helpers.run_subprocess(["qemu-"+platform.machine()+"-static", "-cpu", MINCPU,
helpers.path_to_executable('test_sig'), sig_name])
if __name__ == "__main__":
import sys
pytest.main(sys.argv)