Skip to content

Commit

Permalink
refs #27: Use db->preprocess() in test.
Browse files Browse the repository at this point in the history
 * Now, it's time to write IPsec tests to get rid of the memory bug!
  • Loading branch information
achimnol committed Feb 28, 2016
1 parent f37feb8 commit 4f9e131
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/test_ipv4route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ TEST_P(IPLookupCUDAMatchTest, SingleBatchWithDatablock) {
uint16_t *output_buffer = (uint16_t *) malloc(out_size);
ASSERT_NE(nullptr, input_buffer);
ASSERT_NE(nullptr, output_buffer);
input_buffer[0] = (uint32_t) inet_addr(dest_addrs[0]); // ntohl is done inside kernels
input_buffer[1] = (uint32_t) inet_addr(dest_addrs[1]);
output_buffer[0] = 0;
output_buffer[1] = 0;
db_daddrs->preprocess(batch, input_buffer);
for (unsigned i = 0; i < in_count; i++)
ASSERT_EQ((uint32_t) inet_addr(dest_addrs[i]), input_buffer[i]);
memset(output_buffer, 0, sizeof(uint16_t) * out_count);
void *input_buffer_d = nullptr;
void *output_buffer_d = nullptr;
ASSERT_EQ(cudaSuccess, cudaMalloc(&input_buffer_d, in_size));
Expand Down Expand Up @@ -385,6 +385,9 @@ TEST_P(IPLookupCUDAMatchTest, SingleBatchWithDatablock) {
out_size, cudaMemcpyDeviceToHost));
ASSERT_EQ(cudaSuccess, cudaDeviceSynchronize());

// We skip postprocessing since it has no actual elements here.
batch->tracker.has_results = true;

EXPECT_NE(0, output_buffer[0]);
EXPECT_NE(0, output_buffer[1]);
EXPECT_EQ(cpu_results[0], output_buffer[0]);
Expand Down

0 comments on commit 4f9e131

Please sign in to comment.