Commit Graph

60 Commits

Author SHA1 Message Date
Tobias Brunner 4334f61284 unit-tests: Pass test iteration to fixtures 2020-07-20 13:50:11 +02:00
Tobias Brunner 13d302e95a unit-tests: Optionally report the times test cases ran 2020-07-20 13:50:11 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 4c5dd39aa3 unit-tests: Add ability to issue a warning message for a test case
This way we can warn if we e.g. skipped actually doing something due to
dependencies (otherwise the test case would just appear to have succeeded).
2017-11-08 16:48:10 +01:00
Tobias Brunner b104b2a737 unit-tests: Defining TESTS_RUNNERS allows to only run specific test runners 2016-06-17 18:48:01 +02:00
Martin Willi 80d7f44198 unit-tests: Increase failure message buffer to hold larger hex dumps 2015-07-12 13:25:50 +02:00
Martin Willi 432d712048 unit-tests: Set test verbosity just after test suite loading
We see any plugin startup messages during suite configuration, where
initialization is called once to query plugin features. No need to be verbose
and show these messages once again in the first test.
2015-04-15 14:38:43 +02:00
Martin Willi 30003bc51a unit-tests: Invoke all registered thread cleanup handlers on test failure
If a test fails in a timeout or a test failure, longjmp() is used to restore
the thread context and handle test failure. However, there might be unreleased
resources, namely locks, which prevent the library to clean up properly after
finishing the test.

By using thread cleanup handlers, we can release any test subject internal or
test specific external resources on test failure. We do so by calling all
registered cleanup handlers.
2015-04-15 14:38:43 +02:00
Tobias Brunner 4f71ee2cf6 unit-tests: Add option to exclude specific test suites
Listing test suites in TESTS_SUITES_EXCLUDE allows excluding specific
test suites from running.
2014-09-09 10:56:14 +02:00
Tobias Brunner a1625fdc9b unit-tests: Make fixture functions optional 2014-06-19 14:00:48 +02:00
Martin Willi 0c34c1b3af unit-tests: Support testable functions on Windows, avoid weak GCC symbols
Instead of using weak symbols, we use dlsym() on Windows to find an arbitrary
symbol in libtest to detect its linkage. Instead of creating the associated
hashtable in the test runner, we maintain it in libstrongswan, making it
significantly simpler.
2014-06-04 15:53:12 +02:00
Martin Willi 460adb5d09 unit-tests: Seed chunk_hash() only once, but before creating any hashtables
Due to the removal of pthread_once, we manually create the seed for
chunk_hash(). With the new testable functions interface, this won't work for
the hashtable initiated using __attribute__((constructor)). Enforce seeding
before creating that hashtable.
2014-06-04 15:53:11 +02:00
Martin Willi 965e846cc3 library: Change init/deinit order to allow utils to depend on threading 2014-06-04 15:53:01 +02:00
Thomas Egerer f406a5bf72 unit-tests: Allow configuration of libstrongswan via config
By setting the environment variable TESTS_STRONGSWAN_CONF, the unit tests can
be asked to load a configuration file, thus enabling the tester to make use of
the usual configuration settings.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2014-04-30 17:22:48 +02:00
Martin Willi 70889c42a6 unit-tests: Catch timeouts during test runner deinit function
The test runner deinit function often cancels all threads from the pool. This
operation might hang on error conditions, hence we should include that hook in
the test timeout to fail properly.
2014-04-01 14:28:55 +02:00
Tobias Brunner 5dd638f45c unit-tests: Add an option to increase the verbosity when running tests
The TESTS_VERBOSITY option takes an integer from -1 to 4 that sets the
default debug level.
2014-03-20 15:49:05 +01:00
Tobias Brunner 77603e98a3 unit-tests: Add an option to run only a subset of all test suites
The TESTS_SUITES environment variable can contain a comma separated list
of names of test suites to run.
2014-03-20 15:49:05 +01:00
Tobias Brunner f51169eb09 unit-tests: Change how hashtable for testable functions is created
Because GCC does not adhere to the priorities defined for constructors
when building with --enable-monolithic (not sure if it was just luck
that it worked in non-monolithic mode - anyway, it's not very portable)
function registration would fail because the hashtable would not be
created yet.
2014-03-20 15:29:27 +01:00
Tobias Brunner 48ac56e2aa unit-tests: Generate weak keys with gcrypt plugin (but quickly) 2014-03-20 15:29:27 +01:00
Tobias Brunner 34d3bfcf14 lib: Add global config namespace 2014-02-12 14:34:31 +01:00
Martin Willi b034131555 unit-tests: Pass a test suite collection name to print during test execution
As we except to get more and more test runners for the different components,
we add a name to easily identify them on the test output.
2014-01-22 15:34:53 +01:00
Tobias Brunner 4cea186b64 unit-tests: Add facility to register testable functions
These can be defined in plugins, or other parts of the tested libraries.
They can even be static.
2013-12-04 20:32:59 +01:00
Tobias Brunner 334f44cd29 unit-tests: Initialize tests with a callback 2013-11-06 10:31:07 +01:00
Martin Willi 09d0c9030a unit-tests: Separate test runner to a library, reusable by other tests
Other users may make use of the noinst libtest.la helper library to implement
unit tests. For libstrongswan, tests.[ch] provide the configuration for test
runner to perform unit tests in a simple manner.
2013-11-06 10:31:07 +01:00
Martin Willi 5a3230a250 unit-tests: Use some include magic to define test suite constructors
Avoid editing of several files when creating test suites by using a single
header file to define test suite constructor functions.
2013-11-06 10:31:07 +01:00
Martin Willi b942528419 unit-tests: Add test suite for streams and services 2013-11-06 10:31:02 +01:00
Martin Willi 8eda87af86 unit-tests: Add a few test cases for watcher 2013-11-06 10:31:02 +01:00
Martin Willi 23b8f9bf86 unit-tests: Support testing multi-threaded code 2013-11-06 10:31:01 +01:00
Martin Willi f7b8396af0 unit-tests: Initialize backtracing before printing any backtraces 2013-11-06 10:31:00 +01:00
Martin Willi 35e8eb93a0 unit-tests: Implement testing framework without "check" 2013-11-06 10:30:59 +01:00
Andreas Steffen 54bce665c4 unit-tests: 12 asn1 functions tested 2013-11-02 21:20:04 +01:00
Andreas Steffen a40c4bc28c unit-tests: Added tests for pen_type_t 2013-11-01 22:29:29 +01:00
Martin Willi ebca34d782 printf-hook: Add some basic printf() string/integer test functions 2013-10-11 11:05:37 +02:00
Tobias Brunner 5baec6448d unit-tests: Add test for host_create_netmask() 2013-07-24 16:17:21 +02:00
Martin Willi 4730c4b32b unit-tests: implement tests for array collection 2013-07-17 17:20:17 +02:00
Tobias Brunner b18a531715 plugin-loader: Removed unused path argument of load() method
Multiple additional search paths can be added with the add_path()
method.
2013-06-28 10:44:15 +02:00
Tobias Brunner fcc33c0cd4 unit-tests: Print loaded plugins 2013-06-27 11:27:13 +02:00
Tobias Brunner 65d23c7c90 tests: Properly load plugins from build directory
Calling load() incrementally does not really work as dependencies
wouldn't be resolved properly if a required feature was to be provided
by a plugin that is loaded later with a separate call to load().
2013-06-27 11:06:47 +02:00
Martin Willi ef687db734 unit-tests: load plugins in test-runner from build directory 2013-06-21 10:53:23 +02:00
Martin Willi df1a1a0901 unit-tests: add RSA test cases, very similar to ECDSA 2013-06-21 10:53:23 +02:00
Martin Willi eabf4af0f8 unit-tests: test with /dev/urandom if random plugin is in use 2013-06-21 10:53:22 +02:00
Martin Willi 2bedb0f270 Move test-runners has_feature() function to plugin loader 2013-06-21 10:53:22 +02:00
Martin Willi d18ff88faf unit-tests: perform a first ECDSA test case if ECDSA is supported 2013-06-21 10:53:21 +02:00
Martin Willi 200f38ad4c unit-tests: add a helper function checking if a plugin feature is available 2013-06-21 10:53:21 +02:00
Martin Willi cb1745f7a6 unit-tests: add a test case checking if all test vectors have been passed 2013-06-21 10:53:20 +02:00
Martin Willi 3714979427 unit-tests: load all libstrongswan plugins in test-runner 2013-06-21 10:53:20 +02:00
Tobias Brunner 95e9915074 Enable leak detective for all test cases 2013-06-11 11:03:13 +02:00
Tobias Brunner 2b4902973b Added tests for bio_writer_t 2013-06-11 11:03:13 +02:00
Tobias Brunner b4029a4aae Added tests for bio_reader_t 2013-06-11 11:03:13 +02:00
Tobias Brunner 80d9a9b722 Added tests for utils/enum.c 2013-06-11 11:03:13 +02:00