Veres Lajos 79c44b4e30 Fix some typos 5 rokov pred
..
certs 39d9ea5e50 Add Restricted PSS certificate and key 5 rokov pred
ct 8c6afbc55c Verify SCT signatures 8 rokov pred
d2i-tests a378a46985 add test for CVE-2016-7053 8 rokov pred
ocsp-tests 121738d1cb Fix OCSP_basic_verify() cert chain construction in case bs->certs is NULL 7 rokov pred
ossl_shim 3d48457478 Replace BUF_ string function calls with OPENSSL_ ones 5 rokov pred
recipes ef1e59ed83 More testing for sign/verify through `dgst` and `pkeyutl` 4 rokov pred
smime-certs 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
ssl-tests 20946b9465 Add TLS tests for RSA-PSS Restricted certificates 5 rokov pred
testutil e74b5dcf16 testutil/init.c rename to testutil/testutil_init.c 5 rokov pred
CAss.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
CAssdh.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
CAssdsa.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
CAssrsa.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
CAtsa.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
P1ss.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
P2ss.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
README 7a5f5fd32a Update test/README 5 rokov pred
README.external df4439186f Remove unnecessary trailing whitespace 5 rokov pred
README.ssltest.md a84e5c9aa8 Session resume broken switching contexts 7 rokov pred
Sssdsa.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
Sssrsa.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
Uss.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
aborttest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
aesgcmtest.c dc64dc2edd Add EVP_CIPHER_CTX_tag_length() 5 rokov pred
afalgtest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
asn1_decode_test.c 936c2b9e93 Update source files for deprecation at 3.0 5 rokov pred
asn1_dsa_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
asn1_encode_test.c 936c2b9e93 Update source files for deprecation at 3.0 5 rokov pred
asn1_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
asn1_string_table_test.c 275a7b9e5e typo ANS1 -> ASN1 5 rokov pred
asn1_time_test.c c2969ff6e7 Fix Typos 5 rokov pred
asynciotest.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
asynctest.c 9f5a87fd66 add an additional async notification communication method based on callback 5 rokov pred
bad_dtls_test.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
bftest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
bio_callback_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
bio_enc_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
bio_memleak_test.c 8b7b32921e Fix and document BIO_FLAGS_NONCLEAR_RST behavior on memory BIO 5 rokov pred
bioprinttest.c 98f29466dc fix truncation of integers on 32bit AIX 5 rokov pred
bn_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
bn_rand_range.h 5d2f3e4a6c Test of uniformity of BN_rand_range output. 5 rokov pred
bntest.c 79c44b4e30 Fix some typos 4 rokov pred
bntests.pl 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
build.info 79c44b4e30 Fix some typos 4 rokov pred
casttest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
chacha_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
cipher_overhead_test.c 706457b7bd Reorganize local header files 5 rokov pred
cipherbytes_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
cipherlist_test.c 3c83c5ba4f Ignore cipher suites when setting cipher list 5 rokov pred
ciphername_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
clienthellotest.c 5bf2eade55 Test SSL_set_ciphersuites 5 rokov pred
cmp_asn_test.c 4dde554c6a chunk 5 of CMP contribution to OpenSSL 5 rokov pred
cmp_ctx_test.c 4dde554c6a chunk 5 of CMP contribution to OpenSSL 5 rokov pred
cmp_hdr_test.c 4dde554c6a chunk 5 of CMP contribution to OpenSSL 5 rokov pred
cmp_status_test.c 4dde554c6a chunk 5 of CMP contribution to OpenSSL 5 rokov pred
cmp_testlib.c 7960dbec68 Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL 5 rokov pred
cmp_testlib.h ae4186b004 Fix header file include guard names 5 rokov pred
cms-examples.pl 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
cmsapitest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
conf_include_test.c 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
confdump.c 9386303086 Make sure we free the CONF structure allocated by confdump 5 rokov pred
constant_time_test.c 706457b7bd Reorganize local header files 5 rokov pred
context_internal_test.c 1aedc35fd6 Instead of global data store it in an OPENSSL_CTX 5 rokov pred
crltest.c a727627922 Fix a memory leak with di2_X509_CRL reuse 5 rokov pred
ct_test.c 1a2a3a4206 Extend tests of SSL_check_chain() 5 rokov pred
ctype_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
curve448_internal_test.c 706457b7bd Reorganize local header files 5 rokov pred
d2i_test.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
danetest.c 573e4bf0ba Adapt two test programs that were using now deprecated functions 5 rokov pred
danetest.in 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
danetest.pem 170b735820 DANE support for X509_verify_cert() 8 rokov pred
default-and-fips.cnf 7bb82f92d9 Add fips module integrity check 5 rokov pred
default-and-legacy.cnf e2f72313cc test/recipes/30-test_evp.t: Modify to test with different providers 5 rokov pred
default.cnf e2f72313cc test/recipes/30-test_evp.t: Modify to test with different providers 5 rokov pred
destest.c 4b6ae3c3c2 add missing const 5 rokov pred
dhtest.c feeb7ecd2f Check the DH modulus bit length 5 rokov pred
drbg_cavs_data.h ae4186b004 Fix header file include guard names 5 rokov pred
drbg_cavs_data_ctr.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
drbg_cavs_data_hash.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
drbg_cavs_data_hmac.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
drbg_cavs_test.c 706457b7bd Reorganize local header files 5 rokov pred
drbgtest.c d318389eff Document "get/set-app-data" macros. 5 rokov pred
drbgtest.h 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
dsa_no_digest_size_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
dsatest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
dtls_mtu_test.c 706457b7bd Reorganize local header files 5 rokov pred
dtlstest.c c2969ff6e7 Fix Typos 5 rokov pred
dtlsv1listentest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
ec_internal_test.c 706457b7bd Reorganize local header files 5 rokov pred
ecdsatest.c 10c25644e3 EC only uses approved curves in FIPS mode. 5 rokov pred
ecdsatest.h ae4186b004 Fix header file include guard names 5 rokov pred
ecstresstest.c dd6b270618 Remove tab characters from C source files. 5 rokov pred
ectest.c 35ed029b5a Add self-test for EC_POINT_hex2point 5 rokov pred
enginetest.c 5800ba7610 test/enginetest.c: Make sure no config file is loaded 5 rokov pred
errtest.c b13342e933 Modernise the ERR functionality further (new functions and deprecations) 5 rokov pred
evp_extra_test.c b4be6937f2 Add a test for NULL chunks in encrypt/decrypt 5 rokov pred
evp_fetch_prov_test.c 7bb82f92d9 Add fips module integrity check 5 rokov pred
evp_kdf_test.c 726ad13c4e Fix no-cmac and no-camellia 5 rokov pred
evp_pkey_dparams_test.c 10c25644e3 EC only uses approved curves in FIPS mode. 5 rokov pred
evp_pkey_provided_test.c 6ae5543c5f TEST: add tests of text and PEM printout of a provider made key 5 rokov pred
evp_test.c f75abcc0f0 Fix Use after free when copying cipher ctx 5 rokov pred
evp_test.h 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
exdatatest.c e17f5b6a6b Add CRYPTO_alloc_ex_data() 5 rokov pred
exptest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
fatalerrtest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
fips.cnf 7bb82f92d9 Add fips module integrity check 5 rokov pred
generate_buildtest.pl 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
generate_ssl_tests.pl 1935a5861c Rework the perl fallback functionality 5 rokov pred
gmdifftest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
gosttest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
handshake_helper.c 12a765a523 Explicitly test against NULL; do not use !p or similar 5 rokov pred
handshake_helper.h ae4186b004 Fix header file include guard names 5 rokov pred
hmactest.c 1057c2c39f Cleaner disposal of ephemeral engine ids and names 5 rokov pred
ideatest.c 9b34028187 Eliminate NOP cast 5 rokov pred
igetest.c 7573fe1af5 Deprecate the AES_ige_*() functions 4 rokov pred
keymgmt_internal_test.c 1640d48c5b CORE & PROV: make export of key data leaner through callback 5 rokov pred
legacy.cnf e2f72313cc test/recipes/30-test_evp.t: Modify to test with different providers 5 rokov pred
lhash_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
md2test.c d030892312 Add a legacy provider and put MD2 in it 5 rokov pred
mdc2_internal_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
mdc2test.c 50cd4768c6 Reorganize public header files (part 1) 5 rokov pred
memleaktest.c ea7a952c8a test/memleaktest.c: Modify for use with address/leak sanitizer 4 rokov pred
modes_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
namemap_internal_test.c 3d83c73536 CORE: ossl_namemap_add_names(): new function to add multiple names 5 rokov pred
ocspapitest.c 5b3accde60 OCSP: fix memory leak in OCSP_url_svcloc_new method. 5 rokov pred
ossl_test_endian.h ae4186b004 Fix header file include guard names 5 rokov pred
p_test.c dca97d0062 Rename provider and core get_param_types functions 5 rokov pred
packettest.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
param_build_test.c 7312ef3fc4 Add param builder free function. 5 rokov pred
params_api_test.c 2c99372dbd test/params_api_test.c: Correct the checks of OSSL_PARAM_set_BN() 5 rokov pred
params_conversion_test.c 4e7991b497 Change OSSL_PARAM return size to not be a pointer. 5 rokov pred
params_test.c c2969ff6e7 Fix Typos 5 rokov pred
pbelutest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
pemtest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
pkcs7-1.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
pkcs7.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
pkey_meth_kdf_test.c 5a285addbf Added new EVP/KDF API. 5 rokov pred
pkey_meth_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
pkits-test.pl 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
poly1305_internal_test.c 3d5a7578e0 Add ChaCha related ciphers to default provider 5 rokov pred
property_test.c bdbf2df2e6 Properties: make query cache reference count aware. 5 rokov pred
provider_internal_test.c 29dc6e00f2 Load the config file by default 5 rokov pred
provider_internal_test.conf.in 6d872a838d Add test for the provider configuration module 5 rokov pred
provider_test.c 4e7991b497 Change OSSL_PARAM return size to not be a pointer. 5 rokov pred
rc2test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
rc4test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
rc5test.c 9a131ad747 Change RC5_32_set_key to return an int type 5 rokov pred
rdrand_sanitytest.c 24fd8541d4 Remove extern declarations of OPENSSL_ia32cap_P 5 rokov pred
recordlentest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
rsa_complex.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
rsa_mp_test.c c3a4fa4cb8 Added internal functions for easy getting and setting all RSA parameters. 5 rokov pred
rsa_sp800_56b_test.c fd4a6e7d1e RSA generation: Use more bits of 1/sqrt(2) 5 rokov pred
rsa_test.c 8240d5fa65 FIPS 186-4 RSA Generation & Validation 5 rokov pred
run_tests.pl e3d9a6b5f0 Rework test/run_tests.pl to support selective verbosity and TAP copy 5 rokov pred
sanitytest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
secmemtest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
serverinfo.pem c655f40ed2 Require ServerInfo PEMs to be named "BEGIN SERVERINFO FOR"... 11 rokov pred
serverinfo2.pem b878afae4b Add a SERVERINFOV2 format test file 7 rokov pred
servername_test.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
session.pem 6cf2dbd9fa Don't store the ticket nonce in the session 6 rokov pred
shibboleth.pfx 70bf33d182 Add PKCS#12 UTF-8 interoperability test. 8 rokov pred
shlibloadtest.c 50cd4768c6 Reorganize public header files (part 1) 5 rokov pred
siphash_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
sm2_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
sm4_internal_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
smcont.txt 382bb0b294 test/smcont.txt: trigger assertion in bio_enc.c. 8 rokov pred
sparse_array_test.c 25f2138b0a Reorganize private crypto header files 5 rokov pred
srptest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
ssl_cert_table_internal_test.c 706457b7bd Reorganize local header files 5 rokov pred
ssl_ctx_test.c 310553591c Add ssl_ctx_test to test suite. 5 rokov pred
ssl_test.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
ssl_test.tmpl f4941736a9 test/ssl_test.tmpl: make it work with elderly perl. 8 rokov pred
ssl_test_ctx.c 09d62b336d Fix end-point shared secret for DTLS/SCTP 5 rokov pred
ssl_test_ctx.h ae4186b004 Fix header file include guard names 5 rokov pred
ssl_test_ctx_test.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
ssl_test_ctx_test.conf cf72c75792 Implement Maximum Fragment Length TLS extension. 7 rokov pred
sslapitest.c 706457b7bd Reorganize local header files 5 rokov pred
sslbuffertest.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
sslcorrupttest.c 3d48457478 Replace BUF_ string function calls with OPENSSL_ ones 5 rokov pred
ssltest_old.c 573e4bf0ba Adapt two test programs that were using now deprecated functions 5 rokov pred
ssltestlib.c c2969ff6e7 Fix Typos 5 rokov pred
ssltestlib.h ae4186b004 Fix header file include guard names 5 rokov pred
stack_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
sysdefault.cnf 8a5ed9dce8 Apply system_default configuration on SSL_CTX_new(). 6 rokov pred
sysdefaulttest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
test.cnf 23f3993127 Remove RANDFILE settings from configuration files 5 rokov pred
test_test.c e0249827b3 Fix --strict-warnings build 5 rokov pred
testcrl.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
testdsa.pem 79a578b902 Add private/public key conversion tests 9 rokov pred
testdsapub.pem 79a578b902 Add private/public key conversion tests 9 rokov pred
testec-p256.pem 79a578b902 Add private/public key conversion tests 9 rokov pred
testecpub-p256.pem 79a578b902 Add private/public key conversion tests 9 rokov pred
tested25519.pem 81722fdf2e More testing for CLI usage of Ed25519 and Ed448 keys 4 rokov pred
tested25519pub.pem 81722fdf2e More testing for CLI usage of Ed25519 and Ed448 keys 4 rokov pred
tested448.pem 81722fdf2e More testing for CLI usage of Ed25519 and Ed448 keys 4 rokov pred
tested448pub.pem 81722fdf2e More testing for CLI usage of Ed25519 and Ed448 keys 4 rokov pred
testp7.pem dcb1ef5c22 Change PKCS#7 test data to take account of removal of 24 rokov pred
testreq2.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
testrsa.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
testrsapub.pem 79a578b902 Add private/public key conversion tests 9 rokov pred
testsid.pem 45f55f6a5b Remove SSLv2 support 10 rokov pred
testutil.h ae4186b004 Fix header file include guard names 5 rokov pred
testx509.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
threadstest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
time_offset_test.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
tls13ccstest.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
tls13encryptiontest.c 706457b7bd Reorganize local header files 5 rokov pred
tls13secretstest.c 706457b7bd Reorganize local header files 5 rokov pred
uitest.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
v3-cert1.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
v3-cert2.pem d02b48c63a Import of old SSLeay release: SSLeay 0.8.1b 26 rokov pred
v3ext.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
v3nametest.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
verify_extra_test.c bc42bd6298 Support SM2 certificate signing 5 rokov pred
versions.c 909f1a2e51 Following the license change, modify the boilerplates in test/ 6 rokov pred
wpackettest.c 0d345f0e10 Make the PACKET/WPACKET code available to both libcrypto and libssl 5 rokov pred
x509_check_cert_pkey_test.c 4b931252be Fix incorrect usage of a test case 5 rokov pred
x509_dup_cert_test.c a43ce58f55 Updated test command line parsing to support commmon commands 5 rokov pred
x509_internal_test.c 878dc8dd95 Join the x509 and x509v3 directories 5 rokov pred
x509_time_test.c 25d7cd1d69 add X509_cmp_timeframe() including its documentation 4 rokov pred
x509aux.c 9fdcc21fdc constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION 5 rokov pred

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/build.info. Please refer to the section "Changes to
test/build.info" below.


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 ../apps/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.