ssl_des/lib/openssl/test
2019-04-06 16:42:39 +03:00
..
certs add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ct add openssl 1.1.1 2019-04-06 16:42:39 +03:00
d2i-tests add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ocsp-tests add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ossl_shim add openssl 1.1.1 2019-04-06 16:42:39 +03:00
recipes add openssl 1.1.1 2019-04-06 16:42:39 +03:00
smime-certs add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl-tests add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testutil add openssl 1.1.1 2019-04-06 16:42:39 +03:00
aborttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
afalgtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asn1_decode_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asn1_encode_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asn1_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asn1_string_table_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asn1_time_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asynciotest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
asynctest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bad_dtls_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bftest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bio_callback_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bio_enc_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bio_memleak_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bioprinttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bntest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
bntests.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
build.info add openssl 1.1.1 2019-04-06 16:42:39 +03:00
CAss.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
CAssdh.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
CAssdsa.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
CAssrsa.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
casttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
CAtsa.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
chacha_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
cipher_overhead_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
cipherbytes_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
cipherlist_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ciphername_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
clienthellotest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
cms-examples.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
cmsapitest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
conf_include_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
constant_time_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
crltest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ct_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ctype_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
curve448_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
d2i_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
danetest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
danetest.in add openssl 1.1.1 2019-04-06 16:42:39 +03:00
danetest.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
destest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dhtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
drbg_cavs_data.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
drbg_cavs_data.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
drbg_cavs_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
drbgtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
drbgtest.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dsa_no_digest_size_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dsatest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dtls_mtu_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dtlstest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
dtlsv1listentest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ec_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ecdsatest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ecdsatest.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ecstresstest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ectest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
enginetest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
errtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
evp_extra_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
evp_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
evp_test.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
exdatatest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
exptest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
fatalerrtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
generate_buildtest.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
generate_ssl_tests.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
gmdifftest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
gosttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
handshake_helper.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
handshake_helper.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
hmactest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ideatest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
igetest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
lhash_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
md2test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
mdc2_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
mdc2test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
memleaktest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
modes_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ocspapitest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
P1ss.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
P2ss.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
packettest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pbelutest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pemtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pkcs7-1.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pkcs7.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pkey_meth_kdf_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pkey_meth_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
pkits-test.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
poly1305_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rc2test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rc4test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rc5test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rdrand_sanitytest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
README add openssl 1.1.1 2019-04-06 16:42:39 +03:00
README.external add openssl 1.1.1 2019-04-06 16:42:39 +03:00
README.ssltest.md add openssl 1.1.1 2019-04-06 16:42:39 +03:00
recordlentest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rsa_complex.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rsa_mp_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
rsa_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
run_tests.pl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sanitytest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
secmemtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
serverinfo.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
serverinfo2.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
servername_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
session.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
shibboleth.pfx add openssl 1.1.1 2019-04-06 16:42:39 +03:00
shlibloadtest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
siphash_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sm2_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sm4_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
smcont.txt add openssl 1.1.1 2019-04-06 16:42:39 +03:00
srptest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_cert_table_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test.tmpl add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test_ctx.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test_ctx.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test_ctx_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssl_test_ctx_test.conf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sslapitest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sslbuffertest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sslcorrupttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssltest_old.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssltestlib.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
ssltestlib.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
Sssdsa.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
Sssrsa.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
stack_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sysdefault.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
sysdefaulttest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
test.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
test_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testcrl.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testdsa.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testdsapub.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testec-p256.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testecpub-p256.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testp7.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testreq2.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testrsa.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testrsapub.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testsid.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testutil.h add openssl 1.1.1 2019-04-06 16:42:39 +03:00
testx509.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
threadstest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
time_offset_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
tls13ccstest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
tls13encryptiontest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
tls13secretstest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
uitest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
Uss.cnf add openssl 1.1.1 2019-04-06 16:42:39 +03:00
v3-cert1.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
v3-cert2.pem add openssl 1.1.1 2019-04-06 16:42:39 +03:00
v3ext.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
v3nametest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
verify_extra_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
versions.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
wpackettest.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
x509_check_cert_pkey_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
x509_dup_cert_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
x509_internal_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
x509_time_test.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00
x509aux.c add openssl 1.1.1 2019-04-06 16:42:39 +03:00

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.