From 5ed1f3f15acb12617dc7da25ec2642a0f70cbf12 Mon Sep 17 00:00:00 2001 From: J08nY Date: Sat, 10 Apr 2021 14:54:57 +0200 Subject: Test the presence of submodules when running tests. Fixes #11. --- README.md | 8 +++++++- test/Makefile | 2 +- test/common.sh | 2 +- test/criterion.sh | 12 ++++++++++++ test/ecgen.sh | 9 +++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 test/criterion.sh diff --git a/README.md b/README.md index 4f11a35..a710dfc 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,13 @@ Four different EC curve parameters generation methods are implemented. ### Build -ecgen can be built using Make or CMake. +ecgen can be built using Make or CMake. ecgen uses git submodules for testing at: + + - `test/lib/assert.sh` pointing at + - `test/lib/JSON.sh` pointing at + - `test/lib/criterion` pointing at + +these need to be initialized for `make test` to work. #### Make diff --git a/test/Makefile b/test/Makefile index 4f495d9..e5fdfd3 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,7 +10,7 @@ test: ecgen unittest: unit ecgen unit: - cd lib/criterion && mkdir -p build && cd build && cmake .. >/dev/null && cmake --build . >/dev/null + ./criterion.sh +$(MAKE) -C src all ecgen: diff --git a/test/common.sh b/test/common.sh index c7fbb6e..42978a3 100644 --- a/test/common.sh +++ b/test/common.sh @@ -40,4 +40,4 @@ strip_num() { canonical_num() { num=$(strip_num "$1") echo "ibase=16;${num^^}" | bc -} \ No newline at end of file +} diff --git a/test/criterion.sh b/test/criterion.sh new file mode 100755 index 0000000..c5c1f04 --- /dev/null +++ b/test/criterion.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ! -f "lib/criterion/CMakeLists.txt" ]; then + echo "lib/criterion is missing. It is a git submodule from https://github.com/Snaipe/Criterion at a64b860."; + exit 1; +fi + +cd lib/criterion +mkdir -p build +cd build +cmake .. >/dev/null +cmake --build . >/dev/null diff --git a/test/ecgen.sh b/test/ecgen.sh index e9a1d85..0adf90d 100755 --- a/test/ecgen.sh +++ b/test/ecgen.sh @@ -185,6 +185,15 @@ function secg() { test_order secp160k1 fp 160 } +if [ ! -f $ASSERT ]; then + echo "$ASSERT not found. It is a git submodule from https://github.com/J08nY/assert.sh @679ed66 that should be at $(dirname $ASSERT)." + exit 1 +fi +if [ ! -f $JSON ]; then + echo "$JSON not found. It is a git submodule from https://github.com/jimklimov/JSON.sh @679ed66 that should be at $(dirname $JSON)." + exit 1 +fi + . ${ASSERT} -v start_suite runs -- cgit v1.2.3-70-g09d2