// SPDX-License-Identifier: GPL-2.0-or-later // Copyright (C) 2013 Andrea Mazzoleni /* Full sanity test for the RAID library */ #include "internal.h" #include "test.h" #include "cpu.h" #include #include /* * Size of the blocks to test. */ #define TEST_SIZE 256 /** * Number of disks in the long parity test. */ #ifdef COVERAGE #define TEST_COUNT 10 #else #define TEST_COUNT 32 #endif int main(void) { printf("Full sanity test for the RAID Cauchy library\n\n"); raid_init(); #ifdef CONFIG_VEC128 printf("Including 128-bit vectors\n"); #endif #ifdef CONFIG_X86 if (raid_cpu_has_sse2()) printf("Including x86 SSE2\n"); if (raid_cpu_has_ssse3()) printf("Including x86 SSSE3\n"); if (raid_cpu_has_avx2()) printf("Including x86 AVX2\n"); #ifdef CONFIG_X86_64 if (raid_cpu_has_avx512bw()) printf("Including x86 AVX512BW\n"); if (raid_cpu_has_avx2gfni()) #ifdef USE_RAID_AES printf("Including x86 AVX2GFNI\n"); #else printf("Excluding x86 AVX2GFNI due polynomial mismatch\n"); #endif if (raid_cpu_has_avx512gfni()) #ifdef USE_RAID_AES printf("Including x86 AVX512GFNI\n"); #else printf("Excluding x86 AVX512GFNI due polynomial mismatch\n"); #endif #endif #endif printf("\nPlease wait about 60 seconds...\n\n"); printf("Test sorting...\n"); if (raid_test_sort() != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test insertion...\n"); if (raid_test_insert() != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test combinations/permutations...\n"); if (raid_test_combo() != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test Cauchy parity generation with 1-%u data disks...\n", RAID_DATA_MAX); for (int i = 1; i <= RAID_DATA_MAX; ++i) { if (raid_test_par(RAID_MODE_CAUCHY, i, TEST_SIZE) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } } printf("Test Cauchy recovering with all combinations of %u data and 6 parity blocks...\n", TEST_COUNT); if (raid_test_rec(RAID_MODE_CAUCHY, TEST_COUNT, TEST_SIZE) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test Vandermonde parity generation with %u data disks...\n", RAID_DATA_MAX); if (raid_test_par(RAID_MODE_VANDERMONDE, RAID_DATA_MAX, TEST_SIZE) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test Vandermonde recovering with all combinations of %u data and 3 parity blocks...\n", TEST_COUNT); if (raid_test_rec(RAID_MODE_VANDERMONDE, TEST_COUNT, TEST_SIZE) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("OK\n"); return 0; bail: /* LCOV_EXCL_START */ printf("FAILED!\n"); exit(EXIT_FAILURE); /* LCOV_EXCL_STOP */ }