Matt Caswell d8434cf856 Validate legacy_version 5 years ago
..
certs d02d80b2e8 Limit scope of CN name constraints 6 years ago
ct 8c6afbc55c Verify SCT signatures 8 years ago
d2i-tests a378a46985 add test for CVE-2016-7053 7 years ago
ocsp-tests 121738d1cb Fix OCSP_basic_verify() cert chain construction in case bs->certs is NULL 6 years ago
ossl_shim c3114a7732 Set the ossl_shim to auto retry if not running asynchronously 6 years ago
recipes d8434cf856 Validate legacy_version 5 years ago
smime-certs 1aee92bf0f Add alternative CMS P-256 cert 6 years ago
ssl-tests 6cc0b3c217 Respect SSL_OP_NO_TICKET in TLSv1.3 5 years ago
testutil 12bd4e141e testutil/driver.c: Fix function prototype warning [-Wstrict-prototypes] 5 years ago
CAss.cnf a7be5759cf RT3809: basicConstraints is critical 8 years ago
CAssdh.cnf 58964a4922 Import of old SSLeay release: SSLeay 0.9.0b 25 years ago
CAssdsa.cnf 58964a4922 Import of old SSLeay release: SSLeay 0.9.0b 25 years ago
CAssrsa.cnf 58964a4922 Import of old SSLeay release: SSLeay 0.9.0b 25 years ago
CAtsa.cnf f0ef20bf38 Added support for ESSCertIDv2 7 years ago
P1ss.cnf fec669388c Use 2K RSA and SHA256 in tests 9 years ago
P2ss.cnf fec669388c Use 2K RSA and SHA256 in tests 9 years ago
README f90486f4de Fix test documentation. 6 years ago
README.external 46f4e1bec5 Many spelling fixes/typo's corrected. 6 years ago
README.ssltest.md a84e5c9aa8 Session resume broken switching contexts 6 years ago
Sssdsa.cnf 58964a4922 Import of old SSLeay release: SSLeay 0.9.0b 25 years ago
Sssrsa.cnf 58964a4922 Import of old SSLeay release: SSLeay 0.9.0b 25 years ago
Uss.cnf cb0585c2cb Create DSA and ECDSA certificates. 8 years ago
aborttest.c 440e5d805f Copyright consolidation 02/10 8 years ago
afalgtest.c c517ac4c3f Revert "Modify test/afalgtest to fail if the afalg engine couldn't be loaded" 6 years ago
asn1_encode_test.c 0d66475908 Update copyright year 6 years ago
asn1_internal_test.c 899e62d186 Fix AppVeyor/VC build failure 6 years ago
asn1_string_table_test.c 31a80694d4 [Win] Fix some test method signatures ... 6 years ago
asn1_time_test.c f5e3115361 test/asn1_time_test.c: make it work on 64-bit HP-UX. 6 years ago
asynciotest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
asynctest.c 83cf7abf8e Update copyright year 6 years ago
bad_dtls_test.c d68a0eaf45 Remove unicode characters from source 6 years ago
bftest.c cbe2964821 Consistent formatting for sizeof(foo) 6 years ago
bio_callback_test.c c911e5da3c Fix bio callback backward compatibility 6 years ago
bio_enc_test.c 0139ce7c92 Fix no-chacha and no-poly1305 6 years ago
bioprinttest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
bntest.c 7d79d13a56 Fixed range of random produced in BN_is_prime_fasttest_ex() to be 1 < rand < w-1. It was using 1<= rand < w (which is wrong by 1 on both ends) 5 years ago
bntests.pl 8d1ebff41c Make bntest be (mostly) file-based. 7 years ago
build.info 1e83954580 Add a GOST test 5 years ago
casttest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
chacha_internal_test.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
cipher_overhead_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
cipherbytes_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
cipherlist_test.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ciphername_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
clienthellotest.c 7d7f6834e5 Enhance ssltestlib's create_ssl_ctx_pair to take min and max proto version 6 years ago
cms-examples.pl e0a651945c Copyright consolidation: perl files 8 years ago
cmsapitest.c e15e92dbd5 Add a CMS API test 6 years ago
conf_include_test.c c9ecb13191 NCONF_get_number refix. 5 years ago
constant_time_test.c 0d66475908 Update copyright year 6 years ago
crltest.c 4483fbae10 Factorise duplicated code. 6 years ago
ct_test.c b9d1ad3203 test/ct_test.c: remove dependency on -lm. 6 years ago
ctype_internal_test.c b0edda11cb Update copyright year 6 years ago
curve448_internal_test.c 0d66475908 Update copyright year 6 years ago
d2i_test.c cbe2964821 Consistent formatting for sizeof(foo) 6 years ago
danetest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
danetest.in 5ae4ceb92c Perform DANE-EE(3) name checks by default 7 years ago
danetest.pem 170b735820 DANE support for X509_verify_cert() 8 years ago
destest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
dhtest.c 83cf7abf8e Update copyright year 6 years ago
drbg_cavs_data.c c4d3c19b4c Update copyright year 6 years ago
drbg_cavs_data.h c4d3c19b4c Update copyright year 6 years ago
drbg_cavs_test.c c4d3c19b4c Update copyright year 6 years ago
drbgtest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
drbgtest.h 12fb8c3d2d Add DRBG random method 6 years ago
dsatest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
dtls_mtu_test.c 83cf7abf8e Update copyright year 6 years ago
dtlstest.c 1aac20f509 Fix no-ec in combination with no-dh 6 years ago
dtlsv1listentest.c 83cf7abf8e Update copyright year 6 years ago
ecdsatest.c b0edda11cb Update copyright year 6 years ago
ecstresstest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
ectest.c 66b0bca887 [test] test some important ladder corner cases 5 years ago
enginetest.c e3662075c3 Add EVP_PKEY_METHOD redirection test 6 years ago
errtest.c 2de108dfa3 Save and restore the Windows error around TlsGetValue. 6 years ago
evp_extra_test.c fd38836ba8 Update copyright year 5 years ago
evp_test.c c86acc9f83 Fix no-sm2 5 years ago
evp_test.h c3fc7d9ac5 Add support for multiple update calls in evp_test 7 years ago
exdatatest.c 83cf7abf8e Update copyright year 6 years ago
exptest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
fatalerrtest.c b0edda11cb Update copyright year 6 years ago
generate_buildtest.pl 83cf7abf8e Update copyright year 6 years ago
generate_ssl_tests.pl cb6afcd6ee Consolidate the locations where we have our internal perl modules 6 years ago
gmdifftest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
gosttest.c 1e83954580 Add a GOST test 5 years ago
handshake_helper.c 6cc0b3c217 Respect SSL_OP_NO_TICKET in TLSv1.3 5 years ago
handshake_helper.h b0edda11cb Update copyright year 6 years ago
hmactest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
ideatest.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
igetest.c cbe2964821 Consistent formatting for sizeof(foo) 6 years ago
lhash_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
md2test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
mdc2_internal_test.c 83cf7abf8e Update copyright year 6 years ago
mdc2test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
memleaktest.c 789dfc478e Update secmemtest and memeleaktest to use the test infrastructure. 7 years ago
modes_internal_test.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ocspapitest.c cb091295a9 Wrap more of ocspapitest.c in OPENSSL_NO_OCSP 6 years ago
packettest.c b0edda11cb Update copyright year 6 years ago
pbelutest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
pemtest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
pkcs7-1.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
pkcs7.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
pkey_meth_kdf_test.c 83cf7abf8e Update copyright year 6 years ago
pkey_meth_test.c 83cf7abf8e Update copyright year 6 years ago
pkits-test.pl 46f4e1bec5 Many spelling fixes/typo's corrected. 6 years ago
poly1305_internal_test.c 6738bf1417 Update copyright year 6 years ago
rc2test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
rc4test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
rc5test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
rdrand_sanitytest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
recordlentest.c b0edda11cb Update copyright year 6 years ago
rsa_mp_test.c 3bded9cd35 rsa/rsa_gen.c: harmonize keygen's ability with RSA_security_bits. 6 years ago
rsa_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
run_tests.pl 6ec5fce25e Update copyright year 6 years ago
sanitytest.c cbe2964821 Consistent formatting for sizeof(foo) 6 years ago
secmemtest.c 44e6995155 Fix some Typos and indents 6 years ago
serverinfo.pem c655f40ed2 Require ServerInfo PEMs to be named "BEGIN SERVERINFO FOR"... 10 years ago
serverinfo2.pem b878afae4b Add a SERVERINFOV2 format test file 7 years ago
servername_test.c 176db6dc51 Use "" not <> for internal/ includes 6 years ago
session.pem 6cf2dbd9fa Don't store the ticket nonce in the session 6 years ago
shibboleth.pfx 70bf33d182 Add PKCS#12 UTF-8 interoperability test. 7 years ago
shlibloadtest.c 26db32469f Fix a gcc-8 warning -Wcast-function-type 6 years ago
siphash_internal_test.c 6738bf1417 Update copyright year 6 years ago
sm2_internal_test.c 09fb65d5e4 Fix negative test result in sm2 test 5 years ago
sm4_internal_test.c f19a5ff9ab SM4: Add SM4 block cipher to EVP 6 years ago
smcont.txt 382bb0b294 test/smcont.txt: trigger assertion in bio_enc.c. 7 years ago
srptest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
ssl_cert_table_internal_test.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ssl_test.c dbabc86296 Add a config option to disable automatic config loading 6 years ago
ssl_test.tmpl f4941736a9 test/ssl_test.tmpl: make it work with elderly perl. 7 years ago
ssl_test_ctx.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ssl_test_ctx.h df0fed9aab Session Ticket app data 6 years ago
ssl_test_ctx_test.c b0edda11cb Update copyright year 6 years ago
ssl_test_ctx_test.conf cf72c75792 Implement Maximum Fragment Length TLS extension. 6 years ago
sslapitest.c 0efa0ba4e6 Test early_data sent after a second ClientHello causes a failure 5 years ago
sslbuffertest.c b0edda11cb Update copyright year 6 years ago
sslcorrupttest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ssltest_old.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
ssltestlib.c c748834ff7 Add a bi-directional shutdown test 5 years ago
ssltestlib.h c748834ff7 Add a bi-directional shutdown test 5 years ago
stack_test.c 1b3e2bbf64 Add a reserve call to the stack data structure. 6 years ago
sysdefault.cnf 8a5ed9dce8 Apply system_default configuration on SSL_CTX_new(). 6 years ago
sysdefaulttest.c b0edda11cb Update copyright year 6 years ago
test.cnf fec669388c Use 2K RSA and SHA256 in tests 9 years ago
test_test.c c4d3c19b4c Update copyright year 6 years ago
testcrl.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
testdsa.pem 79a578b902 Add private/public key conversion tests 9 years ago
testdsapub.pem 79a578b902 Add private/public key conversion tests 9 years ago
testec-p256.pem 79a578b902 Add private/public key conversion tests 9 years ago
testecpub-p256.pem 79a578b902 Add private/public key conversion tests 9 years ago
testp7.pem dcb1ef5c22 Change PKCS#7 test data to take account of removal of 24 years ago
testreq2.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
testrsa.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
testrsapub.pem 79a578b902 Add private/public key conversion tests 9 years ago
testsid.pem 45f55f6a5b Remove SSLv2 support 9 years ago
testutil.h b7af3f1433 Test support for time_t comparisons. 6 years ago
testx509.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
threadstest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
time_offset_test.c 83cf7abf8e Update copyright year 6 years ago
tls13ccstest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
tls13encryptiontest.c d6ce9da49b Update the TLSv1.3 test vectors 5 years ago
tls13secretstest.c d6ce9da49b Update the TLSv1.3 test vectors 5 years ago
uitest.c 31a80694d4 [Win] Fix some test method signatures ... 6 years ago
v3-cert1.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
v3-cert2.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 25 years ago
v3ext.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
v3nametest.c 3cb7c5cfef Use void in all function definitions that do not take any arguments 6 years ago
verify_extra_test.c 6ec5fce25e Update copyright year 6 years ago
versions.c efe749c840 Refuse to run test_cipherlist unless shared library matches build 6 years ago
wpackettest.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
x509_check_cert_pkey_test.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
x509_dup_cert_test.c ad887416f1 Update the test framework so that the need for test_main is removed. Everything 6 years ago
x509_internal_test.c 83cf7abf8e Update copyright year 6 years ago
x509_time_test.c 83cf7abf8e Update copyright year 6 years ago
x509aux.c fd38836ba8 Update copyright year 5 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_equal(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.