Commit Graph

98 Commits

Author SHA1 Message Date
Andrew Bettison
a82babf9db Refactor test setup function 'create_single_identity'
Now produces exactly the same output variables as 'create_identities 1'
so that these two functions can be interchanged with minimal impact
on the test script.
2018-03-27 17:29:21 +10:30
Andrew Bettison
bc7f7aeaaf Refactor all REST API tests
Rename 'testdefs_json.sh' to 'testdefs_rest.sh'; add setup functions and
rest_request() function, and roll out through existing test scripts.
2018-03-27 17:29:21 +10:30
Andrew Bettison
3ffa4b10af Add Swift keyring client API with tests
Add a swift-client-api subdirectory containing a Swift source package
and a Makefile.in that compiles it into the "ServalClient" Swift module
using the Swift package manager.  The Swift API contains the following
classes:

- ServalKeyring provides the operations: add, remove, set, list
- AbstractId and its specialisation SubscriberId, already in near-final
  form, are data types for SID and the like
- ServalRestfulClient (internal) uses an HTTP client to access the
  Serval DNA RESTful interface

Improve the REST /keyring/set operation to only alter the DID or Name if
the corresponding query parameter is supplied.  Modify the internal
keyring_set_did() function to only assign the DID or Name if the
corresponding parameter is not a null pointer.

The configure script ensures that the Swift build target version is
10.10 or later when compiling for Mac OS-X, so that the package manager
will succeed.

Add autoconf macros for the Swift package manager.
2018-03-06 15:29:17 +10:30
Andrew Bettison
16d4a6d18e Fix the $JAVAC conditional in tests/all
Add a test script for all Java tests, called "alljava".

Include testconfig.sh in testdefs.sh, not testdefs_java.sh, so that the
tests/all script can successfully test the $JAVAC variable.
2018-03-06 15:16:56 +10:30
Jeremy Lakeman
60b9472472 Always include testconfig so java tests are run with all tests 2018-01-08 12:24:42 +10:30
Andrew Bettison
bc6396ec28 Fix malformed test assert message in executeOk_servald()
The assertion message was omitting the details of the command executed.
2017-12-06 16:36:42 +10:30
Andrew Bettison
68deae8393 Improve out-of-tree build support
Use the conventional autoconf @srcdir@ substitution instead of requiring
the SOURCE_PREFIX variable to be passed to the Makefile.

Also support running test scripts in an out-of-tree build directory.
2017-10-23 17:51:42 +10:30
Andrew Bettison
298b83f97b Fix a failing keyringrestful test
The recent randomising of keyring slots broke an assumption
about the order of the 'keyring list' output.  Now the test's
assertions do not assume any order.
2016-09-21 12:16:50 +09:30
Jeremy Lakeman
b6256ea89a Add identity_t type & rename signing key api to identity. 2016-08-16 12:22:13 +09:30
Jeremy Lakeman
b55926b081 Add configuration for idle_tick_ms so tests can complete faster without wasting power 2016-05-10 11:19:49 +09:30
Andrew Bettison
afc1cc5dbe Improve test defs to ensure setup_curl is called before curl 2016-02-15 18:41:54 +10:30
Andrew Bettison
3e4470bf4a Use nc6 in MSP tests instead of nc
On OS-X (BSD), nc6 appears to be the only available variant of
netcat that matches the Linux version.

Introduces a guard function to catch invocations of nc6 when
setup_netcat6 has not been called in the fixture.  Introduce
guard functions to prevent invocations of nc and netcat.
2016-02-15 18:41:54 +10:30
Andrew Bettison
0361b99ca7 Fix OSX bugs in test framework
Use GNU grep, sed and awk instead of BSD variants.  Developers will have
to install these using a package manager like homebrew.  Updated the
INSTALL.md and doc/Development.md tech docs with instructions.
2016-01-27 00:24:43 +10:30
Andrew Bettison
2b40e5394d Define $LF in testdefs
Accompanies $CR and $HT to help write more readable test
scripts.
2015-12-07 22:35:42 +10:30
Andrew Bettison
6486b3f469 Improve test defs create_identities()
Only set $DIDA1, $NAMEA1, etc. vars if the identity has a DID or
Name field
2015-08-31 19:16:30 +09:30
Andrew Bettison
564f8973af Improve test defs: create_identities() with PINs 2015-08-24 22:41:53 +09:30
Andrew Bettison
586c6b3060 Add HTTP GET /restful/keyring/add 2015-08-10 18:13:57 +09:30
Andrew Bettison
45c6b9ecfa Refactor: set $CR and $HT in testdefs.sh
Fix some bugs in test scripts that used $CR without setting it
2015-06-02 02:23:06 +09:30
Andrew Bettison
d5b96b9931 Fix 'meshms' and 'meshmsjava' newsince-arrival tests
Failed because of a database locking storm between the three waiting
newsince REST requests (which polled the database) and the concurrent
'meshms send' CLI commands.  Changed to use REST requests instead of CLI
for 'meshms send'.
2015-05-25 16:46:43 +09:30
Andrew Bettison
c560374da5 Quieten some stderr ephemera in test logs 2015-05-18 17:15:18 +09:30
Andrew Bettison
eda128c10e Improve test defs: assertions in unpack_stdout_list() 2015-02-16 11:16:15 +10:30
Andrew Bettison
776d4de894 Split up 'rhizomehttp' test script
New scripts 'rhizomerestful' and 'meshmsrestful'
New testdefs_json.sh
Improved testdefs.sh functions for discovering HTTP server port
2014-06-26 15:08:48 +09:30
Andrew Bettison
f2772b0ce8 Refactor tests: testdefs_java.sh, testdefs_meshms.sh
meshms_add_messages() now puts message texts into TEXT[$n] array
instead of "text$n" files
2014-06-19 09:54:29 +09:30
Andrew Bettison
11dcc3e972 Fix minor bugs in server start/kill tests 2014-06-11 11:15:28 +09:30
Andrew Bettison
ea9de737a2 MDP packet filter rules configuration
Configurable rules file path: mdp.filter_rules_path

Add filter rules parsing code, add filtering to outgoing as well as
incoming packets

New test script: tests/mdp with two test cases

Improve test defs: new execute_servald() function

Widen MDP port number format from 8 to ten chars to accommodate leading
"0x"
2014-04-29 15:31:50 +09:30
Andrew Bettison
684735b11c Fix config file timestamp bug
Ensure that timestamp always advances by at least one second every time
the config file is modified, add test case

Refactor test defs: detecting started HTTPD is not specific to Rhizome

Refactor struct file_meta and associated functions into "io.h" and io.c

Add various strbuf helper functions for formatting struct timespec
and struct file_meta to assist debug logging
2014-04-29 15:04:20 +09:30
Andrew Bettison
19aed8ecb5 Fix test defs: pop_instance did not restore instance
Add push_and_set_instance() function
Remove redundant set_instance calls in test cases
Cope if error() returns (can happen during teardown)
2014-03-03 15:14:34 +10:30
Andrew Bettison
08e02b18db Improve test framework: tfw_run() function 2014-03-03 15:14:34 +10:30
Jeremy Lakeman
ae67dd9c56 Initialise client API sockets before PID file 2014-02-24 17:14:35 +10:30
Jeremy Lakeman
46ef40cf23 Migrate and refactor more interfaces from batphone 2014-02-19 15:35:08 +10:30
Jeremy Lakeman
a7b43581ce Rename libservald to libserval for consistency with android build 2014-02-12 14:29:13 +10:30
Jeremy Lakeman
6d942f8d4f Improve tests 2014-01-09 15:01:38 +10:30
Jeremy Lakeman
4bb3336b33 Generalise method for defining multiple interfaces 2014-01-09 15:01:38 +10:30
Andrew Bettison
701f14fdf9 Improve test defs: extract_stdout_keyvalue_optional()
Logs its variable assignment
2013-11-11 16:17:16 +10:30
Andrew Bettison
f3f39faf84 Improve test defs: setup_jq()
For test fixtures that need the jq(1) JSON filter utility
2013-10-14 16:50:02 +10:30
Andrew Bettison
eb46cc99b3 Improve test defs: setup_curl()
Replace setup_curl_7() function in separate test scripts with a single,
general setup_curl() function in testdefs.sh which takes the minimum
version number as its argument.
2013-10-14 16:48:20 +10:30
Andrew Bettison
5e164607aa Expand output of rhizome add and import
Rename 'secret:' field to '.secret:' (non-manifest-fields start with '.'
using the same convention as rhizome list)

Add '.author' and 'BK' fields to "rhizome add"

Add 'BK' field to "rhizome import"

Fix 'rhizomeops' tests to assert no 'author' and 'BK' output fields from
"rhizome add" with no author

Fiz testdefs.sh and testdefs_rhizome.sh to support new output fields
2013-09-27 22:34:22 +09:30
Jeremy Lakeman
dab07dd4dc Remove monitor.socket & mdp.socket from tests 2013-09-24 16:27:34 +09:30
Andrew Bettison
d177512746 Add test for server start with --keyring-pin option 2013-09-09 14:47:02 +09:30
Andrew Bettison
aa20fd1a9b Improve keyring environment variables
Rename to SERVALD_...

Interpret SERVALD_KEYRING_PATH relative to instance dir unless absolute.

Explicitly unset them in setup_servald() test defs function
2013-08-30 11:20:19 +09:30
Jeremy Lakeman
d6d3c1f413 Add ping backward compatibility test 2013-05-29 11:58:06 +09:30
Jeremy Lakeman
abfe6963d2 Wait for servald daemon to enter main loop for more reliable tests 2013-05-27 14:24:33 +09:30
Jeremy Lakeman
6d9bbe2e2c Refactor interface handling to separate encapsulation from stream type 2013-02-20 15:36:23 +10:30
Andrew Bettison
c42260f5f9 Replace "add did" command with improved "keyring add did"
Output is same format as "keyring add" command

Fixed minor bug in rolling a random DID -- last byte was not random

Some code improvements, including better support for sid_t
2013-02-14 16:06:01 +10:30
Andrew Bettison
5985df751d Overhaul debug flags
Replace debugflags_t and DEBUG_XXX bit masks with config schema "debug.xxx"
entries.

No more support for "debug.all".
2012-12-11 15:59:46 +10:30
Jeremy Lakeman
dc6d0da07e Add explicit route tests and improve test speed 2012-12-11 11:27:18 +10:30
Jeremy Lakeman
2932544eb8 Add IPv4 addresses to dummy interface 2012-12-10 14:06:25 +10:30
Jeremy Lakeman
5c7eb4a594 Add unicast probe packets
Probe directory service instead of assuming that it is always reachable
Fix directory service and routing tests
2012-12-04 14:47:57 +10:30
Andrew Bettison
54d0e49a1d Improve Rhizome test defs: bundle_received_by()
Introduce per-instance server cache directory and use it to suppress duplicate
log messages from bundle_received_by().
2012-11-05 14:43:57 +10:30
Andrew Bettison
381fc7cad8 Use finally() function in test suites
Mainly to call stop_all_servald_servers(), which asserts that the server is
still running and responding to orderly shutdown.
2012-10-18 11:46:32 +10:30