From 048d0c14b138ceb6026f63f01b88a832317d2ee4 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 24 Aug 2026 17:03:52 +0200 Subject: [PATCH] Make TEST_COUNT and TEST_SIZE parametric in raid fulltest and test Makefile --- raid/test/Makefile | 17 +++++++++----- raid/test/fulltest.c | 56 ++++++++++++++++++++++++++++++-------------- 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/raid/test/Makefile b/raid/test/Makefile index c4f29947..0471ad3f 100644 --- a/raid/test/Makefile +++ b/raid/test/Makefile @@ -64,11 +64,16 @@ mktables: mktables.o tables.c: mktables ./mktables > tables.c +TEST_COUNT ?= 32 +TEST_SIZE ?= 256 +SDE_TEST_COUNT ?= 8 +SDE_TEST_SIZE ?= 256 + # Use this target to run a complete test test: ./selftest ./speedtest - ./fulltest + ./fulltest $(TEST_COUNT) $(TEST_SIZE) # Use this target to run a coverage test using lcov covtest: @@ -86,10 +91,10 @@ sdecovtest: $(MAKE) clean $(MAKE) lcov_reset $(MAKE) COVERAGE=1 all - $(SDE) -p4p -- ./fulltest - $(SDE) -mrm -- ./fulltest - $(SDE) -nhm -- ./fulltest - $(SDE) -hsw -- ./fulltest + $(SDE) -p4p -- ./fulltest $(SDE_TEST_COUNT) $(SDE_TEST_SIZE) + $(SDE) -mrm -- ./fulltest $(SDE_TEST_COUNT) $(SDE_TEST_SIZE) + $(SDE) -nhm -- ./fulltest $(SDE_TEST_COUNT) $(SDE_TEST_SIZE) + $(SDE) -hsw -- ./fulltest $(SDE_TEST_COUNT) $(SDE_TEST_SIZE) $(SDE) -p4p -- ./selftest $(SDE) -mrm -- ./selftest $(SDE) -nhm -- ./selftest @@ -109,7 +114,7 @@ sdetest: $(SDE) -hsw -- ./selftest $(SDE) -skx -- ./selftest $(SDE) -icl -- ./selftest - $(SDE) -icl -- ./fulltest + $(SDE) -icl -- ./fulltest $(SDE_TEST_COUNT) $(SDE_TEST_SIZE) # Use this target to run a speed test on Ice Lake simulator sdespeed: diff --git a/raid/test/fulltest.c b/raid/test/fulltest.c index c1611359..011dcaf2 100644 --- a/raid/test/fulltest.c +++ b/raid/test/fulltest.c @@ -21,11 +21,32 @@ #ifdef COVERAGE #define TEST_COUNT 10 #else -#define TEST_COUNT 32 +#define TEST_COUNT 24 #endif -int main(void) +int main(int argc, char *argv[]) { + int test_count = TEST_COUNT; + int test_size = TEST_SIZE; + + if (argc > 1) { + test_count = atoi(argv[1]); + if (test_count < RAID_PARITY_MAX || test_count > RAID_DATA_MAX) { + printf("Invalid TEST_COUNT %d (must be between %d and %d)\n", + test_count, RAID_PARITY_MAX, RAID_DATA_MAX); + return EXIT_FAILURE; + } + } + + if (argc > 2) { + test_size = atoi(argv[2]); + if (test_size <= 0 || (test_size % 64) != 0) { + printf("Invalid TEST_SIZE %d (must be positive and multiple of 64)\n", + test_size); + return EXIT_FAILURE; + } + } + printf("Full sanity test for the RAID Cauchy library\n\n"); raid_init(); @@ -53,7 +74,10 @@ int main(void) #endif #endif - printf("\nPlease wait about 60 seconds...\n\n"); + if (test_count >= 32) + printf("\nPlease wait about 60 seconds...\n\n"); + else + printf("\nPlease wait...\n\n"); printf("Test sorting...\n"); if (raid_test_sort() != 0) { @@ -84,7 +108,7 @@ int main(void) } printf("Test Vandermonde RAID parity generation with %u data disks...\n", RAID_DATA_MAX); - if (raid_test_par(RAID_MODE_VANDERMONDE_RAID, RAID_DATA_MAX, TEST_SIZE) != 0) { + if (raid_test_par(RAID_MODE_VANDERMONDE_RAID, RAID_DATA_MAX, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ @@ -92,7 +116,7 @@ int main(void) printf("Test Cauchy RAID 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_RAID, i, TEST_SIZE) != 0) { + if (raid_test_par(RAID_MODE_CAUCHY_RAID, i, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ @@ -100,7 +124,7 @@ int main(void) } printf("Test Cauchy AES 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_AES, i, TEST_SIZE) != 0) { + if (raid_test_par(RAID_MODE_CAUCHY_AES, i, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ @@ -108,44 +132,42 @@ int main(void) } printf("Test Vandermonde RAID tail recovering with 1-%u data disks...\n", RAID_DATA_MAX); - if (raid_test_tail(RAID_MODE_VANDERMONDE_RAID, RAID_DATA_MAX, TEST_SIZE) != 0) { + if (raid_test_tail(RAID_MODE_VANDERMONDE_RAID, RAID_DATA_MAX, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test Cauchy RAID tail recovering with 1-%u data disks...\n", RAID_DATA_MAX); - if (raid_test_tail(RAID_MODE_CAUCHY_RAID, RAID_DATA_MAX, TEST_SIZE) != 0) { + if (raid_test_tail(RAID_MODE_CAUCHY_RAID, RAID_DATA_MAX, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } printf("Test Cauchy AES tail recovering with 1-%u data disks...\n", RAID_DATA_MAX); - if (raid_test_tail(RAID_MODE_CAUCHY_AES, RAID_DATA_MAX, TEST_SIZE) != 0) { + if (raid_test_tail(RAID_MODE_CAUCHY_AES, RAID_DATA_MAX, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } - printf("Test Vandermonde RAID recovering with all combinations of %u data and 3 parity blocks...\n", TEST_COUNT); - if (raid_test_rec(RAID_MODE_VANDERMONDE_RAID, TEST_COUNT, TEST_SIZE) != 0) { + printf("Test Vandermonde RAID recovering with all combinations of %u data and 3 parity blocks...\n", test_count); + if (raid_test_rec(RAID_MODE_VANDERMONDE_RAID, test_count, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } - - printf("Test Cauchy RAID recovering with all combinations of %u data and 6 parity blocks...\n", TEST_COUNT); - if (raid_test_rec(RAID_MODE_CAUCHY_RAID, TEST_COUNT, TEST_SIZE) != 0) { + printf("Test Cauchy RAID recovering with all combinations of %u data and 6 parity blocks...\n", test_count); + if (raid_test_rec(RAID_MODE_CAUCHY_RAID, test_count, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */ } - - printf("Test Cauchy AES recovering with all combinations of %u data and 6 parity blocks...\n", TEST_COUNT); - if (raid_test_rec(RAID_MODE_CAUCHY_AES, TEST_COUNT, TEST_SIZE) != 0) { + printf("Test Cauchy AES recovering with all combinations of %u data and 6 parity blocks...\n", test_count); + if (raid_test_rec(RAID_MODE_CAUCHY_AES, test_count, test_size) != 0) { /* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */