Preserve device DM regression coverage with explicit mode

This commit is contained in:
evgeny committed 2026-11-03 12:34:38 +01:00
1 parent ce8f9d53f9
commit c2e503a90a
3 files changed
+7 -6

No files matched your search

+2 -2
View File
@@ -452,7 +452,7 @@ static void dm_tick(void* arg) {
t->phase = P_SEND1;
break;
case P_SEND1:
if (dm_start(A, nb, g_sh.x_pub[IDX_B], g_sh.ed_pub[IDX_B], "B", CH_ID) != 0
if (dm_start(A, nb, g_sh.x_pub[IDX_B], g_sh.ed_pub[IDX_B], "B", CH_ID, DM_MODE_DEVICE, NULL) != 0
|| dm_send(A, g_sh.conv_id, "text", (const uint8_t*)"hello1", 6) != 0 || protocol_checks(A, B, C) != 0) {
fprintf(stderr, "A: dm_start/send hello1 failed\n");
t->result = 2;
@@ -592,7 +592,7 @@ static void dm2_tick(void* arg) {
if (!bgp_has(A, nb)) t->phase = S2_SEND;
break;
case S2_SEND:
if (dm_start(A, nb, g_sh.x_pub[IDX_B], g_sh.ed_pub[IDX_B], "B", CH_ID) != 0
if (dm_start(A, nb, g_sh.x_pub[IDX_B], g_sh.ed_pub[IDX_B], "B", CH_ID, DM_MODE_DEVICE, NULL) != 0
|| dm_send(A, g_sh.conv_id, "text", (const uint8_t*)"first", 5) != 0) {
fprintf(stderr, "A: dm_start/send first failed\n");
t->result = 2;
+4 -3
View File
@@ -120,7 +120,7 @@ static int peer(struct UTUN_INSTANCE* inst, struct UTUN_INSTANCE* other, const c
int rc = sqlite3_step(st);
sqlite3_finalize(st);
return rc == SQLITE_DONE ? dm_start(inst, other->node_id, other->my_keys.public_key,
other->my_ed25519_pubkey, "peer", group) : -1;
other->my_ed25519_pubkey, "peer", group, DM_MODE_DEVICE, NULL) : -1;
}
static struct UTUN_INSTANCE* start(struct UASYNC* ua, const char* directory, int index, struct SC_MYKEYS* identity) {
@@ -161,7 +161,8 @@ static int exercise(struct UTUN_INSTANCE* inst, struct UTUN_INSTANCE* other, con
fault_query = op == OP_FILE ? "SELECT peer_x25519 FROM dm_conversations" : "SELECT peer_node_id, peer_x25519, peer_ed25519";
injections = 0; fault = failure;
int rc = -1;
if (op == OP_START) rc = dm_start(inst, other->node_id, other->my_keys.public_key, other->my_ed25519_pubkey, "changed", "99");
if (op == OP_START) rc = dm_start(inst, other->node_id, other->my_keys.public_key, other->my_ed25519_pubkey,
"changed", "99", DM_MODE_DEVICE, NULL);
else if (op == OP_RECEIVE) rc = dm_accept_message(inst, body, bytes, receipt);
else if (op == OP_SEND) rc = dm_send(inst, conv, "text", (const uint8_t*)"rejected", 8);
else if (op == OP_LIST) {
@@ -236,7 +237,7 @@ int main(void) {
}
utun_instance_destroy(b); b = start(ua, directory, 1, &identities[1]); CHECK(b);
CHECK(dm_history_generation(b, conv) == 2 && scalar(b->topo_sqlite_db, "SELECT hidden FROM dm_history") == 1);
CHECK(!dm_start(b, a->node_id, a->my_keys.public_key, a->my_ed25519_pubkey, "peer", group_id));
CHECK(!dm_start(b, a->node_id, a->my_keys.public_key, a->my_ed25519_pubkey, "peer", group_id, DM_MODE_DEVICE, NULL));
CHECK(!dm_send(b, conv, "text", (const uint8_t*)"after restart", 13));
CHECK(scalar(b->topo_sqlite_db, "SELECT last_out_seq FROM dm_conversations") == 2);
CHECK(!dm_accept_message(b, first, first_len, receipt) && !dm_verify_receipt(a, receipt, first, first_len));
+1 -1
View File
@@ -84,7 +84,7 @@ static int check_case(struct UTUN_INSTANCE* inst, const char* input, size_t len,
sqlite3_bind_blob(st, 2, peer.public_key, 32, SQLITE_STATIC); sqlite3_bind_blob(st, 3, ed, 32, SQLITE_STATIC);
sqlite3_bind_text(st, 4, input, (int)len, SQLITE_STATIC);
int rc = sqlite3_step(st); sqlite3_finalize(st); EXPECT(rc == SQLITE_DONE);
EXPECT(!dm_start(inst, id, peer.public_key, ed, input, NULL));
EXPECT(!dm_start(inst, id, peer.public_key, ed, input, NULL, DM_MODE_DEVICE, NULL));
EXPECT(!stored(db, last, expected, strlen(expected)) && !snapshot(inst, last, expected, file));
/* Старый SQL может содержать полное длинное имя, оборванный UTF-8 или NUL внутри TEXT. */