Tobias Brunner
cd67cd70c8
host: Ignore spaces around - when parsing ranges
2014-10-30 12:32:45 +01:00
Tobias Brunner
82be444eb9
host: Add function to create two hosts from a range definition
2014-10-30 12:32:45 +01:00
Martin Willi
a6c8647eca
constraints: Add permitted/excludedNameConstraints check
2014-10-30 11:40:48 +01:00
Martin Willi
6733109d0e
constraints: Add requireExplicitPolicy tests
2014-10-30 11:40:47 +01:00
Martin Willi
3b25be0e57
constraints: Add inhibitAnyPolicy tests
2014-10-30 11:40:47 +01:00
Martin Willi
af37fac9a8
constraints: Add inhibitPolicyMapping tests
2014-10-30 11:40:47 +01:00
Martin Willi
885646acd3
constraints: Add certificate policy and policy mapping unit tests
2014-10-30 11:32:19 +01:00
Martin Willi
6528338753
identification: Support custom types in string constructor prefixes
2014-10-30 11:07:08 +01:00
Martin Willi
c0da835a9f
identification: Support prefixes in string constructors for an explicit type
2014-10-30 11:05:44 +01:00
Martin Willi
46001e1131
unit-tests: Re-align identification_create_from_string() unit test table data
2014-10-30 11:03:48 +01:00
Martin Willi
6a3f0467e4
threading: Add a more explicit rwlock try_write_lock() testing
2014-10-30 10:45:24 +01:00
Tobias Brunner
e7c582e652
unit-tests: Fix internet checksum tests on big-endian systems
...
We actually need to do a byte-swap, which ntohs() only does on
little-endian systems.
Fixes #747 .
2014-10-23 11:13:54 +02:00
Martin Willi
784916e28d
process: Don't use the shells built-in echo in tests
...
On OS X, the /bin/sh built-in echo does not support -n.
2014-10-14 16:33:10 +02:00
Martin Willi
b16ea3415f
process: Don't use absolute path names for true/false/cat in unit tests
...
But use the (builtin) shell commands instead, as on OS X true/false are under
/usr/bin.
2014-10-14 16:33:10 +02:00
Martin Willi
7dd06d274d
process: Add a wrapper to invoke a command under the system default shell
2014-10-06 18:24:39 +02:00
Martin Willi
02e4dedce5
process: Port child process spawning to the Windows platform
2014-10-06 18:24:39 +02:00
Martin Willi
1fea589c1f
process: Provide an abstraction to spawn child processes with redirected I/O
2014-10-06 18:24:39 +02:00
Tobias Brunner
c6f886ce10
unit-tests: Give worker threads time to clean up when testing thread_t.detach()
2014-09-09 10:58:59 +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
b557f4a7cd
chunk: Add function to calculate Internet Checksums according to RFC 1071
2014-07-22 11:10:35 +02:00
Martin Willi
a51c48eeaa
settings: Allow spaces in time settings before the optional unit
2014-07-07 16:58:05 +02:00
Martin Willi
0058e26cb0
settings: Be more strict in converting settings to specific data types
...
As the behavior was inconsistent for empty strings or strings with characters
appended to a number, testing the code failed on some platforms. The new rules
are more strict, returning the default if additional characters or an empty
string was found for a setting.
2014-07-07 16:57:38 +02:00
Tobias Brunner
aba9ef542e
unit-tests: Add tests for DH factory
2014-06-20 16:21:55 +02:00
Tobias Brunner
e145f27db7
unit-tests: Add test for crypto_factory_t's rng_create method
2014-06-20 16:21:55 +02:00
Tobias Brunner
a1625fdc9b
unit-tests: Make fixture functions optional
2014-06-19 14:00:48 +02:00
Tobias Brunner
aba55fdffe
identification: Only use either , or / to separate RDNs
...
If a DN starts with a slash (or whitespace and a slash) slashes will
be used, otherwise commas.
2014-06-18 09:24:03 +02:00
Martin Willi
cab59c73fc
windows: Use WINAPI call convention for Windows API callbacks
...
For x86_64 it does not actually matter, but for i686 builds the call convention
is different with WINAPI.
2014-06-06 16:28:28 +02:00
Martin Willi
74eedc8061
unit-tests: Zero-initialize chunk to avoid free on non-successful fetch
...
If the fetch fails, the fetcher is not required to return an empty chunk. Avoid
the resulting invalid free() by initializing data.ptr to NULL.
2014-06-04 16:34:16 +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
549502bcb2
unit-tests: Force a CET/CEST timezone Windows understands
...
As it is currently unclear what the "three-letter-timezone" for CEST is, we
use the German timezone, which actually is CET/CEST. SetEnvironmentVariable()
"TZ" does not seem to affect localtime(), so we use _putenv() instead.
2014-06-04 15:53:11 +02:00
Martin Willi
74e14ea547
unit-tests: Adapt settings tests for Windows
2014-06-04 15:53:09 +02:00
Martin Willi
67b3bcd13d
utils: Provide a path_absolute() function to check path for non-relativeness
...
The usually used trivial '/' check won't work on Windows platforms.
2014-06-04 15:53:09 +02:00
Martin Willi
8182631bc3
utils: Support Windows path separators in path_basename/dirname
2014-06-04 15:53:08 +02:00
Martin Willi
266ee0a190
windows: Provide a sched_yield() implementation
2014-06-04 15:53:01 +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
Martin Willi
d8e56dfe32
unit-tests: Don't test Unix socket stream/services on Windows
2014-06-04 15:53:00 +02:00
Martin Willi
adaa9f3942
unit-tests: Use send/recv on socket in watcher tests
...
Windows does not support read/write on sockets.
2014-06-04 15:53:00 +02:00
Martin Willi
7458952575
unit-tests: Use Windows path for chunk tests, and socket functions if required
2014-06-04 15:52:59 +02:00
Martin Willi
a8c86599e4
unit-tests: Don't depend on sockaddr_un to test invalid host_t family
2014-06-04 15:52:59 +02:00
Martin Willi
4aaf0320d0
unit-tests: Add support for Windows build
...
Instead of signals we catch Windows exceptions. Currently not supported are
timers, which is more a convenience thing anyway.
2014-06-04 15:52:58 +02:00
Tobias Brunner
b9dfeb5de4
unit-tests: Sync threads with main thread in test_cleanup_cancel()
...
Without synchronization threads could get canceled before they could
disable their cancelability.
2014-05-19 16:06:52 +02:00
Tobias Brunner
350c1dead9
unit-tests: Allow some HTTP write operations to fail
...
Because CURLOPT_FAILONERROR is enabled in the curl plugin an error code
will often (not always) cause the client to close the TCP connection
before the server has written the complete response.
2014-05-19 14:28:45 +02:00
Tobias Brunner
deb8975bd2
unit-tests: Add a test case for HTTP response codes
2014-05-19 14:24:12 +02:00
Tobias Brunner
032dcb8989
unit-tests: Defer failures by worker threads
...
In some cases the main thread is not ready to immediately call siglongjmp(),
e.g. if it currently holds a mutex that is later required during
shutdown.
Therefore, we delay handling errors in worker threads until the main
thread performs the next check itself (or the test function ends).
The same issue remains with SIGALRM.
2014-05-19 14:06:55 +02:00
Tobias Brunner
435fecd751
unit-tests: Make sure plugins in the builddir are loaded
...
When running the tests in GDB the working directory apparently is
different. With the relative path used previously the plugins would not
be found and those installed on the system would get used.
2014-05-19 14:06:43 +02:00
Tobias Brunner
7c888e0d23
unit-tests: Don't assert failures for unreadable settings files as root
...
The file can still be read by root even if nobody has read privileges.
2014-05-16 17:50:29 +02:00
Martin Willi
064fe9c963
enum: Return boolean result for enum_from_name() lookup
...
Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.
Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.
This also fixes several clang warnings where enums are unsigned.
2014-05-16 15:42:07 +02:00
Martin Willi
9ee8b3b41f
enum: Don't directly include enum.h
...
To allow enum.h to depend on utils.h definitions, avoid its direct inclusion.
Instead include utils.h, which includes enum.h as well.
2014-05-16 15:42:07 +02:00
Tobias Brunner
8b43c9ba34
settings: Adopt the new order of sections and settings when replacing configs
2014-05-15 11:28:09 +02:00