From 8c736f34d93446eef6a40fce971d13d43cb24ceb Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Thu, 24 Sep 2015 15:23:19 -0700 Subject: [PATCH] Bug 1208243 - Enable ssl_gtest if built, r=ekr --HG-- extra : amend_source : 5e545e34d5d6e7d3be9ca7adbd9c41383bc3b039 --- external_tests/README | 32 ++++--------- tests/all.sh | 6 +-- tests/cert/cert.sh | 57 ---------------------- tests/common/init.sh | 2 +- tests/ssl_gtests/parsereport.sed | 8 ++++ tests/ssl_gtests/ssl_gtests.sh | 82 ++++++++++++++++++++++++++++---- 6 files changed, 94 insertions(+), 93 deletions(-) create mode 100644 tests/ssl_gtests/parsereport.sed mode change 100644 => 100755 tests/ssl_gtests/ssl_gtests.sh diff --git a/external_tests/README b/external_tests/README index 45d3b1f706..30e69d1ee5 100644 --- a/external_tests/README +++ b/external_tests/README @@ -1,31 +1,15 @@ GTest-based Unit Tests -This directory contains GTest-based unit tests for NSS. +This directory contains GTest-based unit tests for NSS libssl. -Currently, these are only loopback-type tests of libsssl, -but could be expanded to other types of tests. To make these -work do: +These aren't built by default, because they require C++. +To build them, set ``NSS_BUILD_GTESTS=1'' -- Set NSS_BUILD_GTESTS=1 before starting your build +Once built, they are run as part of running ``test/all.sh'' +You can run just the GTests by running ``tests/ssl_gtests/ssl_gtests.sh'' -- cd tests/ - -- Set NSS_TESTS=ssl_gtests and NSS_CYCLES=standard - -- run ./all.sh - -This will run the certutil tests (generating a test db) and -will finalize with a call to the ssl_gtest - -You should be able to run the unit tests manually as: - - ssl_gtest -d ${SSLGTESTDIR} - -Where $SSLGTESTDIR is a directory with a database containing: - - an RSA certificate called server (with its private key) - - an ECDSA certificate called ecdsa (with its private key) - -A directory like this is created by ./all.sh and can be found -in a directory named something like +They can be run standalone or under a debugger by invoking the ssl_gtest +executable with a ``-d'' option pointing to the directory created by either +of the above options. You can find that in tests_results/security/${hostname}.${NUMBER}/ssl_gtests diff --git a/tests/all.sh b/tests/all.sh index 1170bc1bac..819789c93b 100755 --- a/tests/all.sh +++ b/tests/all.sh @@ -202,7 +202,7 @@ run_cycle_upgrade_db() # run the subset of tests with the upgraded database TESTS="${ALL_TESTS}" - TESTS_SKIP="cipher libpkix cert dbtests sdr ocsp pkits chains" + TESTS_SKIP="cipher libpkix cert dbtests sdr ocsp pkits chains ssl_gtests" echo "${NSS_SSL_TESTS}" | grep "_" > /dev/null RET=$? @@ -233,7 +233,7 @@ run_cycle_shared_db() # run the tests for native sharedb support TESTS="${ALL_TESTS}" - TESTS_SKIP="cipher libpkix dbupgrade sdr ocsp pkits" + TESTS_SKIP="cipher libpkix dbupgrade sdr ocsp pkits ssl_gtests" echo "${NSS_SSL_TESTS}" | grep "_" > /dev/null RET=$? @@ -274,7 +274,7 @@ run_cycles() cycles="standard pkix upgradedb sharedb" CYCLES=${NSS_CYCLES:-$cycles} -tests="cipher lowhash libpkix cert dbtests tools fips sdr crmf smime ssl ocsp merge pkits chains" +tests="cipher lowhash libpkix cert dbtests tools fips sdr crmf smime ssl ocsp merge pkits chains ssl_gtests" TESTS=${NSS_TESTS:-$tests} ALL_TESTS=${TESTS} diff --git a/tests/cert/cert.sh b/tests/cert/cert.sh index e19cb6b564..114369f6bf 100755 --- a/tests/cert/cert.sh +++ b/tests/cert/cert.sh @@ -1201,62 +1201,6 @@ cert_ssl() pk12u -i ${R_STAPLINGDIR}/ca.p12 -k ${R_PWFILE} -w ${R_PWFILE} -d ${R_STAPLINGDIR} } -############################# ssl_gtest ########################## -# local shell function to create serve certs for SSL gtests -################################################################## -cert_ssl_gtests() -{ - CERTFAILED=0 - echo "$SCRIPTNAME: Creating ssl_gtest DB dir" - cert_init_cert ${SSLGTESTDIR} "server" 1 ${D_EXT_SERVER} - echo "$SCRIPTNAME: Creating database for ssl_gtests" - certu -N -d "${SSLGTESTDIR}" --empty-password 2>&1 - # the ssl server used here is special: is a self-signed server - # certificate with name server. - echo "$SCRIPTNAME: Creating certs for ssl_gtests" - certu -S -z ${R_NOISE_FILE} -g 2048 -d ${SSLGTESTDIR} -n server -s "CN=server" \ - -t C,C,C -x -m 1 -w -2 -v 120 -Z SHA256 -1 -2 <&1 + html_msg $? 0 "create ssl_gtest database" + + ${BINDIR}/certutil -S -z ${R_NOISE_FILE} -d "${PROFILEDIR}" \ + -n server -s "CN=server" -t C,C,C -x -m 1 -w -2 -v 120 \ + -k rsa -g 1024 -Z SHA256 -1 -2 < /dev/null + else + html_failed "$name" + fi + done } ################## main #################################################