Skip to content

Commit c278fcb

Browse files
committed
test: ensure multiple calls to cloudsync_terminate or other functions after termination do not crash
1 parent 9735988 commit c278fcb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,19 @@ bool do_test_double_init(int nclients, bool cleanup_databases) {
28622862
if (do_create_tables(table_mask, db[0]) == false) goto finalize;
28632863
if (do_augment_tables(table_mask, db[0], table_algo_crdt_cls) == false) goto finalize;
28642864

2865+
// double load
2866+
sqlite3_cloudsync_init(db[0], NULL, NULL);
2867+
sqlite3_cloudsync_init(db[0], NULL, NULL);
2868+
2869+
// double cloudsync-init
2870+
if (do_augment_tables(table_mask, db[0], table_algo_crdt_cls) == false) goto finalize;
2871+
if (do_augment_tables(table_mask, db[0], table_algo_crdt_cls) == false) goto finalize;
2872+
2873+
// double terminate
2874+
if (sqlite3_exec(db[0], "SELECT cloudsync_terminate();", NULL, NULL, NULL) != SQLITE_OK) goto finalize;
2875+
if (do_augment_tables(table_mask, db[0], table_algo_crdt_cls) == false) goto finalize;
2876+
if (sqlite3_exec(db[0], "SELECT cloudsync_terminate();", NULL, NULL, NULL) != SQLITE_OK) goto finalize;
2877+
28652878
db[1] = do_create_database_file(0, timestamp, test_counter);
28662879

28672880
result = true;

0 commit comments

Comments
 (0)