diff --git a/tests/Makefile.am b/tests/Makefile.am index 1744ea79..eee24faa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,67 +1,67 @@ # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is part of Libgcrypt. # # Libgcrypt is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of # the License, or (at your option) any later version. # # Libgcrypt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA ## Process this file with automake to produce Makefile.in tests_bin = \ version t-secmem mpitests t-sexp t-convert \ t-mpi-bit t-mpi-point curves t-lock \ prime basic keygen pubkey hmac hashtest t-kdf keygrip \ fips186-dsa aeswrap pkcs1v2 random dsa-rfc6979 t-ed25519 t-cv25519 tests_bin_last = benchmark bench-slope tests_sh = basic-disable-all-hwf tests_sh_last = hashtest-256g TESTS = $(tests_bin) $(tests_sh) $(tests_bin_last) $(tests_sh_last) # Force sequential run of some tests. bench-slope.log: benchmark.log hashtest-256g.log: bench-slope.log TESTS_ENVIRONMENT = GCRYPT_IN_REGRESSION_TEST=1 # Need to include ../src in addition to top_srcdir because gcrypt.h is # a built header. AM_CPPFLAGS = -I../src -I$(top_srcdir)/src AM_CFLAGS = $(GPG_ERROR_CFLAGS) AM_LDFLAGS = -no-install standard_ldadd = \ ../src/libgcrypt.la $(DL_LIBS) \ ../compat/libcompat.la EXTRA_PROGRAMS = testapi pkbench noinst_PROGRAMS = $(tests_bin) $(tests_bin_last) fipsdrv rsacvt genhashdata \ gchash noinst_HEADERS = t-common.h EXTRA_DIST = README rsa-16k.key cavs_tests.sh cavs_driver.pl \ pkcs1v2-oaep.h pkcs1v2-pss.h pkcs1v2-v15c.h pkcs1v2-v15s.h \ t-ed25519.inp stopwatch.h hashtest-256g.in \ sha3-224.h sha3-256.h sha3-384.h sha3-512.h \ blake2b.h blake2s.h \ - basic-disable-all-hwf.in + basic-disable-all-hwf.in basic_all_hwfeature_combinations.sh LDADD = $(standard_ldadd) $(GPG_ERROR_LIBS) t_lock_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS) diff --git a/tests/basic_all_hwfeature_combinations.sh b/tests/basic_all_hwfeature_combinations.sh new file mode 100755 index 00000000..8ec97bf8 --- /dev/null +++ b/tests/basic_all_hwfeature_combinations.sh @@ -0,0 +1,111 @@ +#!/bin/bash +# Run basic tests with all HW feature combinations +# Copyright 2017 Jussi Kivilinna +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# + +# Use BINEXT to set executable extension +# For example for Windows executables: BINEXT=.exe +if [ "x$BINEXT" != "x" ] && [ -e "tests/version$BINEXT" ]; then + binext="$BINEXT" +else + binext="" +fi + +# Use BINPRE to set executable prefix +# For example to run Windows executable with WINE: BINPRE="wine " +if [ "x$BINPRE" != "x" ]; then + binpre="$BINPRE" +else + binpre="" +fi + +# Use NJOBS to define number of parallel tasks +if [ "x$NJOBS" != "x" ]; then + njobs="$NJOBS" +else + # default to cpu count + ncpus=$(nproc --all) + if [ "x@cpus" != "x" ]; then + njobs=$ncpus + else + # could not get cpu count, use 4 parallel tasks instead + njobs=4 + fi +fi + +get_supported_hwfeatures() { + $binpre "tests/version$binext" 2>&1 | \ + grep "hwflist" | \ + sed -e 's/hwflist://' -e 's/:/ /g' -e 's/\x0d/\x0a/g' +} + +hwfs=($(get_supported_hwfeatures)) +retcodes=() +optslist=() +echo "Total HW-feature combinations: $((1<<${#hwfs[@]}))" +for ((cbits=0; cbits < (1<<${#hwfs[@]}); cbits++)); do + for ((mask=0; mask < ${#hwfs[@]}; mask++)); do + match=$(((1<