Martin Prikryl ba9d9a320c OpenSSL 1.1.1n 3 years ago
..
certs 803f5d540d OpenSSL 1.1.1m 3 years ago
ct 34f444bad9 OpenSSL 1.1.1a 6 years ago
d2i-tests 34f444bad9 OpenSSL 1.1.1a 6 years ago
ocsp-tests 34f444bad9 OpenSSL 1.1.1a 6 years ago
ossl_shim 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
recipes ba9d9a320c OpenSSL 1.1.1n 3 years ago
smime-certs 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssl-tests 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
testutil 803f5d540d OpenSSL 1.1.1m 3 years ago
CAss.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
CAssdh.cnf 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
CAssdsa.cnf 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
CAssrsa.cnf 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
CAtsa.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
P1ss.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
P2ss.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
README 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
README.external 37ce136ef1 OpenSSL 1.1.1b 6 years ago
README.ssltest.md 34f444bad9 OpenSSL 1.1.1a 6 years ago
Sssdsa.cnf 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
Sssrsa.cnf 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
Uss.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
aborttest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
afalgtest.c 803f5d540d OpenSSL 1.1.1m 3 years ago
asn1_decode_test.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
asn1_encode_test.c 844857bdb7 OpenSSL 1.1.1i 4 years ago
asn1_internal_test.c ba9d9a320c OpenSSL 1.1.1n 3 years ago
asn1_string_table_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
asn1_time_test.c d269acd797 OpenSSL 1.1.1d 6 years ago
asynciotest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
asynctest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
bad_dtls_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
bftest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
bio_callback_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
bio_enc_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
bio_memleak_test.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
bioprinttest.c 7394d17c4f OpenSSL 1.1.1h 5 years ago
bntest.c ba9d9a320c OpenSSL 1.1.1n 3 years ago
bntests.pl 34f444bad9 OpenSSL 1.1.1a 6 years ago
build.info ba9d9a320c OpenSSL 1.1.1n 3 years ago
casttest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
chacha_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
cipher_overhead_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
cipherbytes_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
cipherlist_test.c 37ce136ef1 OpenSSL 1.1.1b 6 years ago
ciphername_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
clienthellotest.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
cmactest.c 7394d17c4f OpenSSL 1.1.1h 5 years ago
cms-examples.pl 34f444bad9 OpenSSL 1.1.1a 6 years ago
cmsapitest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
conf_include_test.c d269acd797 OpenSSL 1.1.1d 6 years ago
constant_time_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
crltest.c 37ce136ef1 OpenSSL 1.1.1b 6 years ago
ct_test.c d269acd797 OpenSSL 1.1.1d 6 years ago
ctype_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
curve448_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
d2i_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
dane-cross.in 803f5d540d OpenSSL 1.1.1m 3 years ago
danetest.c 803f5d540d OpenSSL 1.1.1m 3 years ago
danetest.in 34f444bad9 OpenSSL 1.1.1a 6 years ago
danetest.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
data.bin 803f5d540d OpenSSL 1.1.1m 3 years ago
destest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
dhtest.c d269acd797 OpenSSL 1.1.1d 6 years ago
drbg_cavs_data.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
drbg_cavs_data.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
drbg_cavs_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
drbgtest.c 7394d17c4f OpenSSL 1.1.1h 5 years ago
drbgtest.h 34f444bad9 OpenSSL 1.1.1a 6 years ago
dsa_no_digest_size_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
dsatest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
dtls_mtu_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
dtlstest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
dtlsv1listentest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ec_internal_test.c 803f5d540d OpenSSL 1.1.1m 3 years ago
ecdsatest.c 198d2a39e9 OpenSSL 1.1.1c 6 years ago
ecdsatest.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ecstresstest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ectest.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
enginetest.c d269acd797 OpenSSL 1.1.1d 6 years ago
errtest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
evp_extra_test.c ba9d9a320c OpenSSL 1.1.1n 3 years ago
evp_test.c 803f5d540d OpenSSL 1.1.1m 3 years ago
evp_test.h 34f444bad9 OpenSSL 1.1.1a 6 years ago
exdatatest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
exptest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
fatalerrtest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
generate_buildtest.pl 34f444bad9 OpenSSL 1.1.1a 6 years ago
generate_ssl_tests.pl 34f444bad9 OpenSSL 1.1.1a 6 years ago
gmdifftest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
gosttest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
handshake_helper.c 7394d17c4f OpenSSL 1.1.1h 5 years ago
handshake_helper.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
hmactest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ideatest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
igetest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
lhash_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
md2test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
mdc2_internal_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
mdc2test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
memleaktest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
modes_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ocspapitest.c 198d2a39e9 OpenSSL 1.1.1c 6 years ago
packettest.c 803f5d540d OpenSSL 1.1.1m 3 years ago
pbelutest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
pemtest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
pkcs7-1.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
pkcs7.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
pkey_meth_kdf_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
pkey_meth_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
pkits-test.pl 34f444bad9 OpenSSL 1.1.1a 6 years ago
poly1305_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
rc2test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rc4test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rc5test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rdrand_sanitytest.c 37ce136ef1 OpenSSL 1.1.1b 6 years ago
recordlentest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rsa_complex.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rsa_mp_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
rsa_test.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
run_tests.pl 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
sanitytest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
secmemtest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
serverinfo.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
serverinfo2.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
servername_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
session.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
shibboleth.pfx 34f444bad9 OpenSSL 1.1.1a 6 years ago
shlibloadtest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
siphash_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
sm2_internal_test.c 803f5d540d OpenSSL 1.1.1m 3 years ago
sm4_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
smcont.txt 34f444bad9 OpenSSL 1.1.1a 6 years ago
srptest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssl_cert_table_internal_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ssl_ctx_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ssl_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssl_test.tmpl 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssl_test_ctx.c 37ce136ef1 OpenSSL 1.1.1b 6 years ago
ssl_test_ctx.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
ssl_test_ctx_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssl_test_ctx_test.conf 34f444bad9 OpenSSL 1.1.1a 6 years ago
sslapitest.c 803f5d540d OpenSSL 1.1.1m 3 years ago
sslbuffertest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
sslcorrupttest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
ssltest_old.c ba9d9a320c OpenSSL 1.1.1n 3 years ago
ssltestlib.c d269acd797 OpenSSL 1.1.1d 6 years ago
ssltestlib.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
stack_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
sysdefault.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
sysdefaulttest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
test.cnf 34f444bad9 OpenSSL 1.1.1a 6 years ago
test_test.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
testcrl.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
testdsa.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
testdsapub.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
testec-p256.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
testecpub-p256.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
tested25519.pem 7394d17c4f OpenSSL 1.1.1h 5 years ago
tested25519pub.pem 7394d17c4f OpenSSL 1.1.1h 5 years ago
tested448.pem 7394d17c4f OpenSSL 1.1.1h 5 years ago
tested448pub.pem 7394d17c4f OpenSSL 1.1.1h 5 years ago
testp7.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
testreq2.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
testrsa.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
testrsa_withattrs.der 45efc038b0 OpenSSL 1.1.1l 4 years ago
testrsa_withattrs.pem 45efc038b0 OpenSSL 1.1.1l 4 years ago
testrsapub.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
testsid.pem 34f444bad9 OpenSSL 1.1.1a 6 years ago
testutil.h 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
testx509.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
threadstest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
time_offset_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
tls13ccstest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
tls13encryptiontest.c 7394d17c4f OpenSSL 1.1.1h 5 years ago
tls13secretstest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
uitest.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
v3-cert1.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
v3-cert2.pem 0a21ebf166 Putting complete OpenSSL repository to the Thirdparty branch 6 years ago
v3ext.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
v3nametest.c e44744da1b OpenSSL 1.1.1j 4 years ago
verify_extra_test.c ba9d9a320c OpenSSL 1.1.1n 3 years ago
versions.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
wpackettest.c 40bf5d88f3 OpenSSL 1.1.1e 5 years ago
x509_check_cert_pkey_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
x509_dup_cert_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
x509_internal_test.c 34f444bad9 OpenSSL 1.1.1a 6 years ago
x509_time_test.c 45efc038b0 OpenSSL 1.1.1l 4 years ago
x509aux.c e44744da1b OpenSSL 1.1.1j 4 years ago

README

How to add recipes
==================

For any test that you want to perform, you write a script located in
test/recipes/, named {nn}-test_{name}.t, where {nn} is a two digit number and
{name} is a unique name of your choice.

Please note that if a test involves a new testing executable, you will need to
do some additions in test/Makefile. More on this later.


Naming conventions
=================

A test executable is named test/{name}test.c

A test recipe is named test/recipes/{nn}-test_{name}.t, where {nn} is a two
digit number and {name} is a unique name of your choice.

The number {nn} is (somewhat loosely) grouped as follows:

00-04 sanity, internal and essential API tests
05-09 individual symmetric cipher algorithms
10-14 math (bignum)
15-19 individual asymmetric cipher algorithms
20-24 openssl commands (some otherwise not tested)
25-29 certificate forms, generation and verification
30-35 engine and evp
60-79 APIs
70 PACKET layer
80-89 "larger" protocols (CA, CMS, OCSP, SSL, TSA)
90-98 misc
99 most time consuming tests [such as test_fuzz]


A recipe that just runs a test executable
=========================================

A script that just runs a program looks like this:

#! /usr/bin/perl

use OpenSSL::Test::Simple;

simple_test("test_{name}", "{name}test", "{name}");

{name} is the unique name you have chosen for your test.

The second argument to `simple_test' is the test executable, and `simple_test'
expects it to be located in test/

For documentation on OpenSSL::Test::Simple, do
`perldoc util/perl/OpenSSL/Test/Simple.pm'.


A recipe that runs a more complex test
======================================

For more complex tests, you will need to read up on Test::More and
OpenSSL::Test. Test::More is normally preinstalled, do `man Test::More' for
documentation. For OpenSSL::Test, do `perldoc util/perl/OpenSSL/Test.pm'.

A script to start from could be this:

#! /usr/bin/perl

use strict;
use warnings;
use OpenSSL::Test;

setup("test_{name}");

plan tests => 2; # The number of tests being performed

ok(test1, "test1");
ok(test2, "test1");

sub test1
{
# test feature 1
}

sub test2
{
# test feature 2
}


Changes to test/build.info
==========================

Whenever a new test involves a new test executable you need to do the
following (at all times, replace {NAME} and {name} with the name of your
test):

* add {name} to the list of programs under PROGRAMS_NO_INST

* create a three line description of how to build the test, you will have
to modify the include paths and source files if you don't want to use the
basic test framework:

SOURCE[{name}]={name}.c
INCLUDE[{name}]=.. ../include
DEPEND[{name}]=../libcrypto libtestutil.a

Generic form of C test executables
==================================

#include "testutil.h"

static int my_test(void)
{
int testresult = 0; /* Assume the test will fail */
int observed;

observed = function(); /* Call the code under test */
if (!TEST_int_eq(observed, 2)) /* Check the result is correct */
goto end; /* Exit on failure - optional */

testresult = 1; /* Mark the test case a success */
end:
cleanup(); /* Any cleanup you require */
return testresult;
}

int setup_tests(void)
{
ADD_TEST(my_test); /* Add each test separately */
return 1; /* Indicate success */
}

You should use the TEST_xxx macros provided by testutil.h to test all failure
conditions. These macros produce an error message in a standard format if the
condition is not met (and nothing if the condition is met). Additional
information can be presented with the TEST_info macro that takes a printf
format string and arguments. TEST_error is useful for complicated conditions,
it also takes a printf format string and argument. In all cases the TEST_xxx
macros are guaranteed to evaluate their arguments exactly once. This means
that expressions with side effects are allowed as parameters. Thus,

if (!TEST_ptr(ptr = OPENSSL_malloc(..)))

works fine and can be used in place of:

ptr = OPENSSL_malloc(..);
if (!TEST_ptr(ptr))

The former produces a more meaningful message on failure than the latter.