mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
Kris Kwiatkowski
77ca982b4c
The test programs use googletest and google-benchmark libraries in order to ensure right level of optimizations and proper unit testing. Those two libraries are written in C++ and they use C++ standard library. If you want MemorySanitizer to work properly and not produce any false positives, you must ensure that all the code in your program and in libraries it uses is instrumented. That includes C++ standard library. (see here: https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo) With this change, the Memory Sanitizer build (enabled by -DMEMSAN=1) will also build MSan-instrumented libc++ from LLVM and will use it as a standard C++ library when building unit tests and benchmarks. In particular what I do is this: 1. Clone LLVM project and build libcxx and libcxxabi with MSan enabled 2. Build GTEST and GBENCH with -fsanitize=memory and -stdlib=libc++. Additionally link against -lc++abi 3. Then use this special version of libc++ and GTEST/GBENCH in order to build final binaries containing unit/benchmark tests The actuall tests with memory sanitizer are disabled, as I'm getting some errors which need to be investigated first. Additionally I've splitted single build into multiple, for release,debug,clang,gcc and AddressSanitizer. On unrelated note, I've also added flags to ignore some errors which I'm getting when using newer GCC (see GH#10 GH#11).
105 lines
2.6 KiB
YAML
105 lines
2.6 KiB
YAML
name: PQC
|
|
|
|
on:
|
|
- push
|
|
- pull_request
|
|
|
|
jobs:
|
|
unit-test:
|
|
name: Unit tests
|
|
runs-on: [ubuntu-20.04]
|
|
env:
|
|
CC: ${{ matrix.cc }}
|
|
CXX: ${{ matrix.cxx }}
|
|
CMAKE_FLAGS: ${{matrix.flags}}
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 4
|
|
matrix:
|
|
name: [
|
|
gcc-release-build,
|
|
clang-release-build,
|
|
gcc-debug-build,
|
|
clang-debug-build,
|
|
clang-release-asan-build,
|
|
]
|
|
|
|
include:
|
|
- name: gcc-release-build
|
|
cc: gcc
|
|
cxx: g++
|
|
flags: -DCMAKE_BUILD_TYPE=Release
|
|
- name: gcc-debug-build
|
|
cc: gcc
|
|
cxx: g++
|
|
flags: -DCMAKE_BUILD_TYPE=Debug
|
|
- name: clang-release-build
|
|
cc: clang
|
|
cxx: clang++
|
|
flags: -DCMAKE_BUILD_TYPE=Release
|
|
- name: clang-debug-build
|
|
cc: /usr/bin/clang
|
|
cxx: /usr/bin/clang++
|
|
flags: -DCMAKE_BUILD_TYPE=Debug
|
|
- name: clang-release-asan-build
|
|
cc: clang
|
|
cxx: clang++
|
|
flags: -DCMAKE_BUILD_TYPE=Release -DADDRSAN=1
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
with:
|
|
submodules: true
|
|
- name: build
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
CC=${CC} CXX=${CXX} cmake ${CMAKE_FLAGS} ..
|
|
make
|
|
- name: run tests
|
|
run: |
|
|
cd build && ./ut
|
|
- name: Build Rust bindings
|
|
run: |
|
|
cd src/rustapi/pqc-sys && cargo build
|
|
KAT:
|
|
name: Known Answer Tests
|
|
runs-on: [ubuntu-20.04]
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
with:
|
|
submodules: true
|
|
- name: build
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
make
|
|
- name: run tests
|
|
run: |
|
|
cd build && ./ut ${FILTER_TESTS}
|
|
- name: Build Rust bindings
|
|
run: |
|
|
cd src/rustapi/pqc-sys && cargo build
|
|
- name: Run KAT tests
|
|
run: |
|
|
cd test/katrunner &&
|
|
curl http://amongbytes.com/~flowher/permalinks/kat.zip --output kat.zip
|
|
unzip kat.zip
|
|
cargo run --release -- --katdir KAT
|
|
# MEMSAN:
|
|
# name: Memory Sanitizer build
|
|
# runs-on: [ubuntu-20.04]
|
|
# steps:
|
|
# - uses: actions/checkout@v1
|
|
# with:
|
|
# submodules: true
|
|
# - name: build
|
|
# run: |
|
|
# mkdir -p build
|
|
# cd build
|
|
# CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DMEMSAN=1 ..
|
|
# make
|
|
# - name: run tests
|
|
# run: |
|
|
# cd build && ./ut --gtest_filter="NONE"
|