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

Function test_five_keys

dpdk/app/test/test_efd.c:251–326  ·  view source on GitHub ↗

* Sequence of operations for 5 keys * - add keys * - lookup keys: hit (bulk) * - add keys (update) * - lookup keys: hit (updated data) * - delete keys : hit */

Source from the content-addressed store, hash-verified

249 * - delete keys : hit
250 */
251static int test_five_keys(void)
252{
253 struct rte_efd_table *handle;
254 const void *key_array[5] = {0};
255 efd_value_t result[5] = {0};
256 efd_value_t prev_value;
257 unsigned int i;
258 printf("Entering %s\n", __func__);
259
260 handle = rte_efd_create("test_five_keys", TABLE_SIZE,
261 sizeof(struct flow_key),
262 efd_get_all_sockets_bitmask(), test_socket_id);
263 TEST_ASSERT_NOT_NULL(handle, "Error creating the efd table\n");
264
265 /* Setup data */
266 for (i = 0; i < 5; i++)
267 data[i] = mrand48() & VALUE_BITMASK;
268
269 /* Add */
270 for (i = 0; i < 5; i++) {
271 TEST_ASSERT_SUCCESS(rte_efd_update(handle, test_socket_id,
272 &keys[i], data[i]),
273 "Error inserting the key");
274 print_key_info("Add", &keys[i], data[i]);
275 }
276
277 /* Lookup */
278 for (i = 0; i < 5; i++)
279 key_array[i] = &keys[i];
280
281 rte_efd_lookup_bulk(handle, test_socket_id, 5,
282 (void *) &key_array, result);
283
284 for (i = 0; i < 5; i++) {
285 TEST_ASSERT_EQUAL(result[i], data[i],
286 "bulk: failed to find key. Expected %d, got %d",
287 data[i], result[i]);
288 print_key_info("Lkp", &keys[i], data[i]);
289 }
290
291 /* Modify data (bulk) */
292 for (i = 0; i < 5; i++)
293 data[i] = data[i] + 1;
294
295 /* Add - update */
296 for (i = 0; i < 5; i++) {
297 TEST_ASSERT_SUCCESS(rte_efd_update(handle, test_socket_id,
298 &keys[i], data[i]),
299 "Error inserting the key");
300 print_key_info("Add", &keys[i], data[i]);
301 }
302
303 /* Lookup */
304 for (i = 0; i < 5; i++) {
305 TEST_ASSERT_EQUAL(rte_efd_lookup(handle, test_socket_id,
306 &keys[i]), data[i],
307 "failed to find key");
308 print_key_info("Lkp", &keys[i], data[i]);

Callers 1

test_efdFunction · 0.70

Calls 9

rte_efd_createFunction · 0.85
rte_efd_updateFunction · 0.85
rte_efd_lookup_bulkFunction · 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