From 96bf8be098b434ec19146d5724b60179ae56e00a Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Thu, 20 Nov 2014 08:46:02 -0600 Subject: update and mask unit tests when running on win32 Update pq_test to ignore changes in whitespace. Update for new testssl params, specify absolute paths to test binaries. Fork-based tests do not make sense on Windows. Disable building biotest, since it is too specific to OpenBSD's behavior to be useful on other platforms. --- tests/aeadtest.sh | 6 +++++- tests/evptest.sh | 6 +++++- tests/pq_test.sh | 6 +++++- tests/ssltest.sh | 20 +++++++++++++++++--- update.sh | 30 +++++++++++++++++++++++++----- 5 files changed, 57 insertions(+), 11 deletions(-) diff --git a/tests/aeadtest.sh b/tests/aeadtest.sh index d51dd29..132b1fd 100755 --- a/tests/aeadtest.sh +++ b/tests/aeadtest.sh @@ -1,3 +1,7 @@ #!/bin/sh set -e -./aeadtest $srcdir/aeadtests.txt +TEST=./aeadtest +if [ -e ./aeadtest.exe ]; then + TEST=./aeadtest.exe +fi +$TEST $srcdir/aeadtests.txt diff --git a/tests/evptest.sh b/tests/evptest.sh index 8e1d106..ba44d75 100755 --- a/tests/evptest.sh +++ b/tests/evptest.sh @@ -1,3 +1,7 @@ #!/bin/sh set -e -./evptest $srcdir/evptests.txt +TEST=./evptest +if [ -e ./evptest.exe ]; then + TEST=./evptest.exe +fi +$TEST $srcdir/evptests.txt diff --git a/tests/pq_test.sh b/tests/pq_test.sh index b6b9f5e..ab87bc7 100755 --- a/tests/pq_test.sh +++ b/tests/pq_test.sh @@ -1,3 +1,7 @@ #!/bin/sh set -e -./pq_test | cmp $srcdir/pq_expected.txt - +TEST=./pq_test +if [ -e ./pq_test.exe ]; then + TEST=./pq_test.exe +fi +$TEST | diff -b $srcdir/pq_expected.txt - diff --git a/tests/ssltest.sh b/tests/ssltest.sh index 476a258..1b4c9c7 100755 --- a/tests/ssltest.sh +++ b/tests/ssltest.sh @@ -1,5 +1,19 @@ #!/bin/sh set -e -PATH=../apps:$PATH -export PATH -$srcdir/testssl $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem + +ssltest_bin=./ssltest +if [ -e ./ssltest.exe ]; then + ssltest_bin=./ssltest.exe +fi + +openssl_bin=../apps/openssl +if [ -e ../apps/openssl.exe ]; then + openssl_bin=../apps/openssl.exe +fi + +if [ -z $srcdir ]; then + srcdir=. +fi + +$srcdir/testssl $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem \ + $ssltest_bin $openssl_bin diff --git a/update.sh b/update.sh index 80842cf..cda2766 100755 --- a/update.sh +++ b/update.sh @@ -289,7 +289,7 @@ for i in $openssl_cmd_src/*; do done for i in aead/aeadtest.c aeswrap/aes_wrap.c base64/base64test.c bf/bftest.c \ - bio/biotest.c bn/general/bntest.c bn/mont/mont.c \ + bn/general/bntest.c bn/mont/mont.c \ cast/casttest.c chacha/chachatest.c cts128/cts128test.c \ des/destest.c dh/dhtest.c dsa/dsatest.c ec/ectest.c ecdh/ecdhtest.c \ ecdsa/ecdsatest.c engine/enginetest.c evp/evptest.c exp/exptest.c \ @@ -310,7 +310,6 @@ done # do not directly run all test programs test_drivers=( - biotest aeadtest evptest pq_test @@ -322,21 +321,34 @@ test_drivers=( tests_disabled=( biotest ) +tests_posix_only=( + arc4randomforktest + explicit_bzero + pidwraptest +) $CP $libc_src/string/memmem.c tests/ (cd tests $CP Makefile.am.tpl Makefile.am for i in `ls -1 *.c|sort|grep -v memmem.c`; do TEST=`echo $i|sed -e "s/\.c//"` + if [[ ${tests_posix_only[*]} =~ "$TEST" ]]; then + echo "if !HOST_WIN" >> Makefile.am + fi if ! [[ ${test_drivers[*]} =~ "$TEST" ]]; then echo "TESTS += $TEST" >> Makefile.am fi echo "check_PROGRAMS += $TEST" >> Makefile.am echo "${TEST}_SOURCES = $i" >> Makefile.am + if [[ ${TEST} = "explicit_bzero" ]]; then + echo "if !HAVE_MEMMEM" >> Makefile.am + echo "explicit_bzero_SOURCES += memmem.c" >> Makefile.am + echo "endif" >> Makefile.am + fi + if [[ ${tests_posix_only[*]} =~ "$TEST" ]]; then + echo "endif" >> Makefile.am + fi done - echo "if !HAVE_MEMMEM" >> Makefile.am - echo "explicit_bzero_SOURCES += memmem.c" >> Makefile.am - echo "endif" >> Makefile.am ) $CP $libcrypto_regress/evp/evptests.txt tests $CP $libcrypto_regress/aead/aeadtests.txt tests @@ -344,8 +356,16 @@ $CP $libcrypto_regress/pqueue/expected.txt tests/pq_expected.txt chmod 755 tests/testssl for i in "${test_drivers[@]}"; do if [ -e tests/${i}.sh ]; then + if [[ ${tests_posix_only[*]} =~ "$i" ]]; then + echo "if !HOST_WIN" >> tests/Makefile.am + fi if ! [[ ${tests_disabled[*]} =~ "$i" ]]; then echo "TESTS += ${i}.sh" >> tests/Makefile.am + else + rm -f tests/$i* + fi + if [[ ${tests_posix_only[*]} =~ "$i" ]]; then + echo "endif" >> tests/Makefile.am fi echo "EXTRA_DIST += ${i}.sh" >> tests/Makefile.am fi -- cgit v1.2.3-55-g6feb