libqaeda

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README | LICENSE

commit 4e5182885f8a59c8ed62fa8d05163a7e96ff5048
parent cce716ca44feeacd98ff7e5944ffc9f238e3b4ac
Author: lash <dev@holbrook.no>
Date:   Mon, 31 Mar 2025 00:28:01 +0100

Remove malfunctioning memstore from tests

Diffstat:
Msrc/test/Makefile | 5+++--
Msrc/test/test_msg.c | 2--
Msrc/test/test_test.c | 2+-
Msrc/test/test_trust.c | 39++++++++++++++++++++++++++++++++++-----
4 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/test/Makefile b/src/test/Makefile @@ -19,13 +19,14 @@ all: build test: all build: - $(CC) $(CFLAGS) test_test.c -o test_test_bin $(COMMONOBJS) ../io/dummy.o ../store/mem.o $(LDFLAGS) + #$(CC) $(CFLAGS) test_test.c -o test_test_bin $(COMMONOBJS) ../io/dummy.o ../store/mem.o $(LDFLAGS) + $(CC) $(CFLAGS) test_test.c -o test_test_bin $(COMMONOBJS) ../io/std.o ../store/file.o $(LDFLAGS) $(CC) $(CFLAGS) test_debug.c -o test_debug_bin $(COMMONOBJS) $(LDFLAGS) $(CC) $(CFLAGS) test_config.c -o test_config_bin $(COMMONOBJS) $(LDFLAGS) $(CC) $(CFLAGS) test_crypto.c -o test_crypto_bin $(COMMONOBJS) ../store/file.o ../io/std.o ../crypto/gcrypt.o $(LDFLAGS) -lgcrypt $(CC) $(CFLAGS) test_msg.c -o test_msg_bin $(COMMONOBJS) ../store/file.o ../store/dummy.o ../io/std.o ../crypto/gcrypt.o ../lq/msg.o $(LDFLAGS) $(CC) $(CFLAGS) test_cert.c -o test_cert_bin $(COMMONOBJS) ../store/file.o ../io/std.o ../crypto/gcrypt.o ../store/dummy.o ../lq/msg.o ../lq/cert.o $(LDFLAGS) - $(CC) $(CFLAGS) test_trust.c -o test_trust_bin $(COMMONOBJS) ../store/mem.o ../crypto/gcrypt.o ../lq/trust.o $(LDFLAGS) + $(CC) $(CFLAGS) test_trust.c -o test_trust_bin $(COMMONOBJS) ../store/file.o ../io/std.c ../crypto/gcrypt.o ../lq/trust.o $(LDFLAGS) $(CC) $(CFLAGS) test_store.c -o test_store_bin $(COMMONOBJS) ../store/file.o ../io/std.o ../crypto/gcrypt.o $(LDFLAGS) clean: diff --git a/src/test/test_msg.c b/src/test/test_msg.c @@ -48,8 +48,6 @@ START_TEST(check_msg_symmetric) { lq_msg_free(msg); resolve.store->free(resolve.store); resolve_dummy.store->free(resolve_dummy.store); - - lq_store_free(store); } END_TEST diff --git a/src/test/test_test.c b/src/test/test_test.c @@ -54,7 +54,7 @@ START_TEST(check_hashmap) { ck_assert_mem_eq(in, out, 8192); - lq_store_free(store); + store->free(store); } END_TEST diff --git a/src/test/test_trust.c b/src/test/test_trust.c @@ -6,6 +6,7 @@ #include "lq/err.h" #include "lq/mem.h" #include "lq/crypto.h" +#include "lq/io.h" static const char pubkey_data_alice[65] = { 0x40, 0xde, 0x58, 0x08, 0xe7, 0x24, 0x5e, 0x04, 0x72, @@ -48,8 +49,15 @@ START_TEST(check_trust_none) { LQStore *store; char *lodata; size_t lolen; + char path[1024]; + char *p; - store = &LQMemContent; + lq_cpy(path, "/tmp/lqstore_file_XXXXXX", 25); + p = mktempdir(path); + *(p+24) = '/'; + *(p+25) = 0x0; + store = lq_store_new(p); + ck_assert_ptr_nonnull(store->userdata); pubkey_alice = lq_publickey_new(pubkey_data_alice); pubkey_bob = lq_publickey_new(pubkey_data_bob); @@ -80,8 +88,15 @@ START_TEST(check_trust_one) { LQStore *store; char *lodata; size_t lolen; + char path[1024]; + char *p; - store = &LQMemContent; + lq_cpy(path, "/tmp/lqstore_file_XXXXXX", 25); + p = mktempdir(path); + *(p+24) = '/'; + *(p+25) = 0x0; + store = lq_store_new(p); + ck_assert_ptr_nonnull(store->userdata); pubkey_alice = lq_publickey_new(pubkey_data_alice); @@ -104,8 +119,15 @@ START_TEST(check_trust_best) { LQStore *store; char *lodata; size_t lolen; + char path[1024]; + char *p; - store = &LQMemContent; + lq_cpy(path, "/tmp/lqstore_file_XXXXXX", 25); + p = mktempdir(path); + *(p+24) = '/'; + *(p+25) = 0x0; + store = lq_store_new(p); + ck_assert_ptr_nonnull(store->userdata); pubkey_alice = lq_publickey_new(pubkey_data_alice); @@ -128,8 +150,15 @@ START_TEST(check_trust_all) { LQStore *store; char *lodata; size_t lolen; - - store = &LQMemContent; + char path[1024]; + char *p; + + lq_cpy(path, "/tmp/lqstore_file_XXXXXX", 25); + p = mktempdir(path); + *(p+24) = '/'; + *(p+25) = 0x0; + store = lq_store_new(p); + ck_assert_ptr_nonnull(store->userdata); pubkey_alice = lq_publickey_new(pubkey_data_alice);