summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/liberasurecode_test.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index b837baa..a7bb612 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -498,7 +498,7 @@ static void test_create_and_destroy_backend(
498{ 498{
499 int desc = liberasurecode_instance_create(be_id, args); 499 int desc = liberasurecode_instance_create(be_id, args);
500 if (-EBACKENDNOTAVAIL == desc) { 500 if (-EBACKENDNOTAVAIL == desc) {
501 fprintf (stderr, "Backend library not available!\n"); 501 fprintf(stderr, "Backend library not available!\n");
502 return; 502 return;
503 } 503 }
504 assert(desc > 0); 504 assert(desc > 0);
@@ -553,7 +553,7 @@ static void test_destroy_backend_invalid_args()
553 assert(liberasurecode_instance_destroy(desc) < 0); 553 assert(liberasurecode_instance_destroy(desc) < 0);
554 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 554 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
555 if (-EBACKENDNOTAVAIL == desc) { 555 if (-EBACKENDNOTAVAIL == desc) {
556 fprintf (stderr, "Backend library not available!\n"); 556 fprintf(stderr, "Backend library not available!\n");
557 return; 557 return;
558 } 558 }
559 assert(desc > 0); 559 assert(desc > 0);
@@ -579,7 +579,7 @@ static void test_encode_invalid_args()
579 579
580 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 580 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
581 if (-EBACKENDNOTAVAIL == desc) { 581 if (-EBACKENDNOTAVAIL == desc) {
582 fprintf (stderr, "Backend library not available!\n"); 582 fprintf(stderr, "Backend library not available!\n");
583 return; 583 return;
584 } 584 }
585 assert(desc > 0); 585 assert(desc > 0);
@@ -623,7 +623,7 @@ static void test_encode_cleanup_invalid_args()
623 623
624 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 624 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
625 if (-EBACKENDNOTAVAIL == desc) { 625 if (-EBACKENDNOTAVAIL == desc) {
626 fprintf (stderr, "Backend library not available!\n"); 626 fprintf(stderr, "Backend library not available!\n");
627 return; 627 return;
628 } 628 }
629 assert(desc > 0); 629 assert(desc > 0);
@@ -664,7 +664,7 @@ static void test_decode_invalid_args()
664 664
665 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 665 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
666 if (-EBACKENDNOTAVAIL == desc) { 666 if (-EBACKENDNOTAVAIL == desc) {
667 fprintf (stderr, "Backend library not available!\n"); 667 fprintf(stderr, "Backend library not available!\n");
668 return; 668 return;
669 } 669 }
670 assert(desc > 0); 670 assert(desc > 0);
@@ -755,7 +755,7 @@ static void test_decode_cleanup_invalid_args()
755 755
756 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 756 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
757 if (-EBACKENDNOTAVAIL == desc) { 757 if (-EBACKENDNOTAVAIL == desc) {
758 fprintf (stderr, "Backend library not available!\n"); 758 fprintf(stderr, "Backend library not available!\n");
759 return; 759 return;
760 } 760 }
761 assert(desc > 0); 761 assert(desc > 0);
@@ -786,7 +786,7 @@ static void test_reconstruct_fragment_invalid_args()
786 786
787 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 787 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
788 if (-EBACKENDNOTAVAIL == desc) { 788 if (-EBACKENDNOTAVAIL == desc) {
789 fprintf (stderr, "Backend library not available!\n"); 789 fprintf(stderr, "Backend library not available!\n");
790 return; 790 return;
791 } 791 }
792 assert(desc > 0); 792 assert(desc > 0);
@@ -831,7 +831,7 @@ static void test_fragments_needed_invalid_args()
831 831
832 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 832 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
833 if (-EBACKENDNOTAVAIL == desc) { 833 if (-EBACKENDNOTAVAIL == desc) {
834 fprintf (stderr, "Backend library not available!\n"); 834 fprintf(stderr, "Backend library not available!\n");
835 return; 835 return;
836 } 836 }
837 assert(desc > 0); 837 assert(desc > 0);
@@ -882,7 +882,7 @@ static void test_verify_stripe_metadata_invalid_args() {
882 882
883 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 883 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
884 if (-EBACKENDNOTAVAIL == desc) { 884 if (-EBACKENDNOTAVAIL == desc) {
885 fprintf (stderr, "Backend library not available!\n"); 885 fprintf(stderr, "Backend library not available!\n");
886 return; 886 return;
887 } 887 }
888 assert(desc > 0); 888 assert(desc > 0);
@@ -915,7 +915,7 @@ static void test_get_fragment_partition()
915 915
916 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args); 916 desc = liberasurecode_instance_create(EC_BACKEND_NULL, &null_args);
917 if (-EBACKENDNOTAVAIL == desc) { 917 if (-EBACKENDNOTAVAIL == desc) {
918 fprintf (stderr, "Backend library not available!\n"); 918 fprintf(stderr, "Backend library not available!\n");
919 free(orig_data); 919 free(orig_data);
920 free(skips); 920 free(skips);
921 return; 921 return;
@@ -1008,7 +1008,7 @@ static void encode_decode_test_impl(const ec_backend_id_t be_id,
1008 desc = liberasurecode_instance_create(be_id, args); 1008 desc = liberasurecode_instance_create(be_id, args);
1009 1009
1010 if (-EBACKENDNOTAVAIL == desc) { 1010 if (-EBACKENDNOTAVAIL == desc) {
1011 fprintf (stderr, "Backend library not available!\n"); 1011 fprintf(stderr, "Backend library not available!\n");
1012 return; 1012 return;
1013 } else if ((args->k + args->m) > EC_MAX_FRAGMENTS) { 1013 } else if ((args->k + args->m) > EC_MAX_FRAGMENTS) {
1014 assert(-EINVALIDPARAMS == desc); 1014 assert(-EINVALIDPARAMS == desc);
@@ -1100,7 +1100,7 @@ static void reconstruct_test_impl(const ec_backend_id_t be_id,
1100 1100
1101 desc = liberasurecode_instance_create(be_id, args); 1101 desc = liberasurecode_instance_create(be_id, args);
1102 if (-EBACKENDNOTAVAIL == desc) { 1102 if (-EBACKENDNOTAVAIL == desc) {
1103 fprintf (stderr, "Backend library not available!\n"); 1103 fprintf(stderr, "Backend library not available!\n");
1104 return; 1104 return;
1105 } 1105 }
1106 assert(desc > 0); 1106 assert(desc > 0);
@@ -1159,7 +1159,7 @@ static void test_fragments_needed_impl(const ec_backend_id_t be_id,
1159 1159
1160 int desc = liberasurecode_instance_create(be_id, args); 1160 int desc = liberasurecode_instance_create(be_id, args);
1161 if (-EBACKENDNOTAVAIL == desc) { 1161 if (-EBACKENDNOTAVAIL == desc) {
1162 fprintf (stderr, "Backend library not available!\n"); 1162 fprintf(stderr, "Backend library not available!\n");
1163 return; 1163 return;
1164 } 1164 }
1165 assert(desc > 0); 1165 assert(desc > 0);
@@ -1292,7 +1292,7 @@ static void test_get_fragment_metadata(const ec_backend_id_t be_id, struct ec_ar
1292 1292
1293 desc = liberasurecode_instance_create(be_id, args); 1293 desc = liberasurecode_instance_create(be_id, args);
1294 if (-EBACKENDNOTAVAIL == desc) { 1294 if (-EBACKENDNOTAVAIL == desc) {
1295 fprintf (stderr, "Backend library not available!\n"); 1295 fprintf(stderr, "Backend library not available!\n");
1296 return; 1296 return;
1297 } 1297 }
1298 assert(desc > 0); 1298 assert(desc > 0);
@@ -1451,7 +1451,7 @@ static void test_isa_l_rs_vand_decode_reconstruct_specific_error_case()
1451 desc = liberasurecode_instance_create( 1451 desc = liberasurecode_instance_create(
1452 EC_BACKEND_ISA_L_RS_VAND, &specific_1010_args); 1452 EC_BACKEND_ISA_L_RS_VAND, &specific_1010_args);
1453 if (-EBACKENDNOTAVAIL == desc) { 1453 if (-EBACKENDNOTAVAIL == desc) {
1454 fprintf (stderr, "Backend library not available!\n"); 1454 fprintf(stderr, "Backend library not available!\n");
1455 free(orig_data); 1455 free(orig_data);
1456 free(skips); 1456 free(skips);
1457 return; 1457 return;
@@ -1530,7 +1530,7 @@ static void test_jerasure_rs_cauchy_init_failure()
1530 desc = liberasurecode_instance_create( 1530 desc = liberasurecode_instance_create(
1531 EC_BACKEND_JERASURE_RS_CAUCHY, &bad_args); 1531 EC_BACKEND_JERASURE_RS_CAUCHY, &bad_args);
1532 if (-EBACKENDNOTAVAIL == desc) { 1532 if (-EBACKENDNOTAVAIL == desc) {
1533 fprintf (stderr, "Backend library not available!\n"); 1533 fprintf(stderr, "Backend library not available!\n");
1534 return; 1534 return;
1535 } 1535 }
1536 assert(-EBACKENDINITERR == desc); 1536 assert(-EBACKENDINITERR == desc);
@@ -1614,7 +1614,7 @@ static void test_verify_stripe_metadata(const ec_backend_id_t be_id,
1614 int desc = liberasurecode_instance_create(be_id, args); 1614 int desc = liberasurecode_instance_create(be_id, args);
1615 1615
1616 if (-EBACKENDNOTAVAIL == desc) { 1616 if (-EBACKENDNOTAVAIL == desc) {
1617 fprintf (stderr, "Backend library not available!\n"); 1617 fprintf(stderr, "Backend library not available!\n");
1618 free(orig_data); 1618 free(orig_data);
1619 free(skip); 1619 free(skip);
1620 return; 1620 return;
@@ -1659,7 +1659,7 @@ static void verify_fragment_metadata_mismatch_impl(const ec_backend_id_t be_id,
1659 int desc = liberasurecode_instance_create(be_id, args); 1659 int desc = liberasurecode_instance_create(be_id, args);
1660 1660
1661 if (-EBACKENDNOTAVAIL == desc) { 1661 if (-EBACKENDNOTAVAIL == desc) {
1662 fprintf (stderr, "Backend library not available!\n"); 1662 fprintf(stderr, "Backend library not available!\n");
1663 free(orig_data); 1663 free(orig_data);
1664 free(skip); 1664 free(skip);
1665 return; 1665 return;
@@ -1866,15 +1866,15 @@ int main(int argc, char **argv)
1866{ 1866{
1867 int ii = 0, num_cases = 0, i = 0; 1867 int ii = 0, num_cases = 0, i = 0;
1868 int max_backend_tests = max_tests_for_backends(); 1868 int max_backend_tests = max_tests_for_backends();
1869 setbuf(stdout, NULL);
1869 1870
1870 for (i = 0; i < max_backend_tests; i++) { 1871 for (i = 0; i < max_backend_tests; i++) {
1871 for (ii = 0; testcases[ii].description != NULL; ++ii) { 1872 for (ii = 0; testcases[ii].description != NULL; ++ii) {
1872 const char *testname = get_name_from_backend_id(testcases[ii].be_id); 1873 const char *testname = get_name_from_backend_id(testcases[ii].be_id);
1873 fflush(stdout);
1874 if (testcases[ii].skip) { 1874 if (testcases[ii].skip) {
1875 fprintf(stdout, "ok # SKIP %d - %s: %s (idx=%d)\n", num_cases, 1875 printf("ok # SKIP %d - %s: %s (idx=%d)\n", num_cases,
1876 testcases[ii].description, 1876 testcases[ii].description,
1877 (testname) ? testname : "", i); 1877 (testname) ? testname : "", i);
1878 continue; 1878 continue;
1879 } 1879 }
1880 if (testcases[ii].be_id == EC_BACKENDS_MAX) { 1880 if (testcases[ii].be_id == EC_BACKENDS_MAX) {
@@ -1883,21 +1883,21 @@ int main(int argc, char **argv)
1883 } 1883 }
1884 /* EC_BACKENDS_MAX basically designed for invalid args tests 1884 /* EC_BACKENDS_MAX basically designed for invalid args tests
1885 * and not takes the args so call the function w/o args here */ 1885 * and not takes the args so call the function w/o args here */
1886 printf("%d - %s: %s (idx=%d) ... ", num_cases,
1887 testcases[ii].description,
1888 (testname) ? testname : "", i);
1886 testcases[ii].function(); 1889 testcases[ii].function();
1887 fprintf(stdout, "ok %d - %s: %s (idx=%d)\n", num_cases, 1890 printf("ok\n");
1888 testcases[ii].description,
1889 (testname) ? testname : "", i);
1890 fflush(stdout);
1891 num_cases++; 1891 num_cases++;
1892 continue; 1892 continue;
1893 } 1893 }
1894 struct ec_args *args = create_ec_args(testcases[ii].be_id, testcases[ii].ct, i); 1894 struct ec_args *args = create_ec_args(testcases[ii].be_id, testcases[ii].ct, i);
1895 if (NULL != args) { 1895 if (NULL != args) {
1896 printf("%d - %s: %s (idx=%d) ... ", num_cases,
1897 testcases[ii].description,
1898 (testname) ? testname : "", i);
1896 testcases[ii].function(testcases[ii].be_id, args); 1899 testcases[ii].function(testcases[ii].be_id, args);
1897 fprintf(stdout, "ok %d - %s: %s (idx=%d)\n", num_cases, 1900 printf("ok\n");
1898 testcases[ii].description,
1899 (testname) ? testname : "", i);
1900 fflush(stdout);
1901 free(args); 1901 free(args);
1902 num_cases++; 1902 num_cases++;
1903 } 1903 }