aboutgitcodelistschat:MatrixIRC
path: root/tests
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-02-27 10:55:31 +0100
committerAlice Frosi <afrosi@redhat.com>2023-02-27 11:59:32 +0100
commitf219fada2e1107ce1a0f69bab03ee93d92d7b6f3 (patch)
tree9e4ec8178c0c3b27431518a27932f773acb644bf /tests
parent4989288ddfe8156fc4cea5599c34ef932010c9aa (diff)
downloadseitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar.gz
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar.bz2
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar.lz
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar.xz
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.tar.zst
seitan-f219fada2e1107ce1a0f69bab03ee93d92d7b6f3.zip
seitan: copy immediate args with op_copy
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_operations.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/unit/test_operations.c b/tests/unit/test_operations.c
index 4bcca57..2d1a6a9 100644
--- a/tests/unit/test_operations.c
+++ b/tests/unit/test_operations.c
@@ -416,16 +416,19 @@ START_TEST(test_op_copy)
};
struct op_copy_args *o = &operations[0].copy;
struct sockaddr_un *addr;
+ socklen_t *len, expect;
int ret;
- o->args[0] = (struct copy_arg){ .args_off = 0, .size = sizeof(int) };
+ o->args[0] = (struct copy_arg){ .args_off = 0,
+ .type = IMMEDIATE,
+ .size = sizeof(int) };
o->args[1] =
(struct copy_arg){ .args_off = sizeof(int) / sizeof(uint16_t),
- .need_copied = true,
+ .type = REFERENCE,
.size = sizeof(struct sockaddr_un) };
o->args[2] = (struct copy_arg){ .args_off = o->args[1].args_off /
sizeof(uint16_t),
- .need_copied = false,
+ .type = IMMEDIATE,
.size = sizeof(socklen_t) };
ret = do_operations(&tmp_data, operations, &req,
sizeof(operations) / sizeof(operations[0]), -1,
@@ -435,6 +438,10 @@ START_TEST(test_op_copy)
addr = (struct sockaddr_un *)(tmp_data + o->args[1].args_off);
ck_assert_str_eq(addr->sun_path, "/tmp/test.sock");
ck_assert(addr->sun_family == AF_UNIX);
+ expect = sizeof(addr->sun_path);
+ len = (socklen_t *)(tmp_data + o->args[2].args_off);
+ ck_assert_msg(*len == expect, "expect len %x to be equal to %x", *len,
+ expect);
}
END_TEST