MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_add_delete

Function test_add_delete

dpdk/app/test/test_efd.c:124–157  ·  view source on GitHub ↗

* Basic sequence of operations for a single key: * - add * - lookup (hit) * - delete * Note: lookup (miss) is not applicable since this is a filter */

Source from the content-addressed store, hash-verified

122 * Note: lookup (miss) is not applicable since this is a filter
123 */
124static int test_add_delete(void)
125{
126 struct rte_efd_table *handle;
127 /* test with standard add/lookup/delete functions */
128 efd_value_t prev_value;
129 printf("Entering %s\n", __func__);
130
131 handle = rte_efd_create("test_add_delete",
132 TABLE_SIZE, sizeof(struct flow_key),
133 efd_get_all_sockets_bitmask(), test_socket_id);
134 TEST_ASSERT_NOT_NULL(handle, "Error creating the EFD table\n");
135
136 data[0] = mrand48() & VALUE_BITMASK;
137 TEST_ASSERT_SUCCESS(rte_efd_update(handle, test_socket_id, &keys[0],
138 data[0]),
139 "Error inserting the key");
140 print_key_info("Add", &keys[0], data[0]);
141
142 TEST_ASSERT_EQUAL(rte_efd_lookup(handle, test_socket_id, &keys[0]),
143 data[0],
144 "failed to find key");
145
146 TEST_ASSERT_SUCCESS(rte_efd_delete(handle, test_socket_id, &keys[0],
147 &prev_value),
148 "failed to delete key");
149 TEST_ASSERT_EQUAL(prev_value, data[0],
150 "failed to delete the expected value, got %d, "
151 "expected %d", prev_value, data[0]);
152 print_key_info("Del", &keys[0], data[0]);
153
154 rte_efd_free(handle);
155
156 return 0;
157}
158
159/*
160 * Sequence of operations for a single key:

Callers 1

test_efdFunction · 0.70

Calls 8

rte_efd_createFunction · 0.85
rte_efd_updateFunction · 0.85
rte_efd_lookupFunction · 0.85
rte_efd_deleteFunction · 0.85
rte_efd_freeFunction · 0.85
print_key_infoFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected