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

Function test_results_validation

dpdk/app/test/test_compressdev.c:1898–1967  ·  view source on GitHub ↗

* Validation of the output (compression/decompression) data. * * The function compares the source stream with the output stream, * after decompression, to check if compression/decompression * was correct. * -1 returned if function fail. * * @param int_data * Interim data containing session/transformation objects. * @param test_data * The test parameters set by users (command line par

Source from the content-addressed store, hash-verified

1896 * - -1: On error.
1897 */
1898static int
1899test_results_validation(const struct interim_data_params *int_data,
1900 const struct test_data_params *test_data,
1901 const struct test_private_arrays *test_priv_data)
1902{
1903 /* local variables: */
1904 unsigned int i;
1905 struct priv_op_data *priv_data;
1906 const char *buf1;
1907 const char *buf2;
1908 char *contig_buf = NULL;
1909 uint32_t data_size;
1910
1911 /* from int_data: */
1912 struct rte_comp_xform **compress_xforms = int_data->compress_xforms;
1913 unsigned int num_bufs = int_data->num_bufs;
1914 const char * const *test_bufs = int_data->test_bufs;
1915
1916 /* from test_priv_data: */
1917 uint64_t *compress_checksum = test_priv_data->compress_checksum;
1918 struct rte_comp_op **ops_processed = test_priv_data->ops_processed;
1919
1920 /*
1921 * Compare the original stream with the decompressed stream
1922 * (in size and the data)
1923 */
1924 for (i = 0; i < num_bufs; i++) {
1925 priv_data = (struct priv_op_data *)(ops_processed[i] + 1);
1926 buf1 = test_data->use_external_mbufs ?
1927 test_data->inbuf_memzone->addr :
1928 test_bufs[priv_data->orig_idx];
1929 data_size = test_data->use_external_mbufs ?
1930 test_data->inbuf_data_size :
1931 strlen(buf1) + 1;
1932
1933 contig_buf = rte_malloc(NULL, ops_processed[i]->produced, 0);
1934 if (contig_buf == NULL) {
1935 RTE_LOG(ERR, USER1, "Contiguous buffer could not "
1936 "be allocated\n");
1937 goto exit;
1938 }
1939
1940 buf2 = rte_pktmbuf_read(ops_processed[i]->m_dst, 0,
1941 ops_processed[i]->produced, contig_buf);
1942 if (compare_buffers(buf1, data_size,
1943 buf2, ops_processed[i]->produced) < 0)
1944 goto exit;
1945
1946 /* Test checksums */
1947 if (compress_xforms[0]->compress.chksum !=
1948 RTE_COMP_CHECKSUM_NONE) {
1949 if (ops_processed[i]->output_chksum !=
1950 compress_checksum[i]) {
1951 RTE_LOG(ERR, USER1, "The checksums differ\n"
1952 "Compression Checksum: %" PRIu64 "\tDecompression "
1953 "Checksum: %" PRIu64 "\n", compress_checksum[i],
1954 ops_processed[i]->output_chksum);
1955 goto exit;

Callers 1

test_deflate_comp_decompFunction · 0.85

Calls 4

rte_mallocFunction · 0.85
rte_pktmbuf_readFunction · 0.85
compare_buffersFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected