test_storage: extend test harness; datastorage: two bug fixes

datastorage (bug fix): deleting expired array item would fail to test next item
test_storage: extended to cover all required datastorage entry points
test_storage: added ability to read script file
test_storage: added new and revised test scripts
TESTING.md: added to describe testing approach
general: added various TODO notes on things to come back to
general: revised #includes to make each "self-compiling"
general: revised #includes to minimise usage across source files
general: moved declarations and defintions to simplify and rationalise code
datastorage: refactor to support scalability testing
datastorage: made independent of time() calls to support testing
datastorage: fixed redundant use of both SORT_NUM and SORT_LENGTH defines
datastorage: fake kicking to test clients move between access points
msghandler: new module to reduce compile time interdependencies
mshhandler: (issue #100?) fixed SEGV memcpy() in dump_client() using strncpy()
ubus: merged uface into ubus
mac_utils: new module for MAC address utilites
test_header: added target to help #include rationalisation

Tested-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Ian Clowes 2020-05-27 19:25:04 +01:00 committed by Polynomialdivision
parent 0f63e00c43
commit 67c3ed0d0a
46 changed files with 2947 additions and 1476 deletions

View file

@ -8,6 +8,7 @@
#include "networksocket.h"
#include "ubus.h"
#include "dawn_uci.h"
#include "dawn_iwinfo.h"
#include "tcpsocket.h"
#include "crypto.h"
@ -15,8 +16,6 @@ void daemon_shutdown();
void signal_handler(int sig);
int init_mutex();
struct sigaction signal_action;
void daemon_shutdown() {
@ -25,11 +24,7 @@ void daemon_shutdown() {
uci_clear();
uloop_cancelled = true;
// free resources
fprintf(stdout, "Freeing mutex resources\n");
pthread_mutex_destroy(&probe_array_mutex);
pthread_mutex_destroy(&client_array_mutex);
pthread_mutex_destroy(&ap_array_mutex);
destroy_mutex();
}
void signal_handler(int sig) {
@ -49,30 +44,6 @@ void signal_handler(int sig) {
}
}
int init_mutex() {
if (pthread_mutex_init(&probe_array_mutex, NULL) != 0) {
fprintf(stderr, "Mutex init failed!\n");
return 1;
}
if (pthread_mutex_init(&client_array_mutex, NULL) != 0) {
fprintf(stderr, "Mutex init failed!\n");
return 1;
}
if (pthread_mutex_init(&ap_array_mutex, NULL) != 0) {
fprintf(stderr, "Mutex init failed!\n");
return 1;
}
if (pthread_mutex_init(&denied_array_mutex, NULL) != 0) {
fprintf(stderr, "Mutex init failed!\n");
return 1;
}
return 0;
}
int main(int argc, char **argv) {
const char *ubus_socket = NULL;
@ -89,6 +60,7 @@ int main(int argc, char **argv) {
sigaction(SIGINT, &signal_action, NULL);
uci_init();
// TODO: Why the extra loacl struct to retuen into?
struct network_config_s net_config = uci_get_dawn_network();
network_config = net_config;
@ -96,6 +68,7 @@ int main(int argc, char **argv) {
gcrypt_init();
gcrypt_set_key_and_iv(net_config.shared_key, net_config.iv);
// TODO: Why the extra loacl struct to retuen into?
struct time_config_s time_config = uci_get_time_config();
timeout_config = time_config; // TODO: Refactor...