@@ -511,7 +511,7 @@ struct test_result {
511511};
512512
513513//  Printer classes for different output formats
514- enum  class  test_status_t  { NOT_SUPPORTED, OK, FAIL };
514+ enum  class  test_status_t  { NOT_SUPPORTED, OK, FAIL, SKIPPED  };
515515
516516struct  test_operation_info  {
517517    std::string   op_name;
@@ -687,6 +687,10 @@ struct printer {
687687    virtual  void  print_backend_status (const  backend_status_info & info) { (void ) info; }
688688
689689    virtual  void  print_overall_summary (const  overall_summary_info & info) { (void ) info; }
690+ 
691+     virtual  void  print_failed_tests (const  std::vector<std::string> & failed_tests) {
692+         (void ) failed_tests;
693+     }
690694};
691695
692696struct  console_printer  : public  printer  {
@@ -804,6 +808,17 @@ struct console_printer : public printer {
804808        }
805809    }
806810
811+     void  print_failed_tests (const  std::vector<std::string> & failed_tests) override  {
812+         if  (failed_tests.empty ()) {
813+             return ;
814+         }
815+ 
816+         printf (" \n Failing tests:\n " 
817+         for  (const  auto  & test_name : failed_tests) {
818+             printf ("   %s\n " c_str ());
819+         }
820+     }
821+ 
807822  private: 
808823    void  print_test_console (const  test_result & result) {
809824        printf ("   %s(%s): " op_name .c_str (), result.op_params .c_str ());
@@ -1056,6 +1071,8 @@ struct test_case {
10561071
10571072    std::vector<ggml_tensor *> sentinels;
10581073
1074+     std::string current_op_name;
1075+ 
10591076    void  add_sentinel (ggml_context * ctx) {
10601077        if  (mode == MODE_PERF || mode == MODE_GRAD || mode == MODE_SUPPORT) {
10611078            return ;
@@ -1127,7 +1144,7 @@ struct test_case {
11271144        }
11281145    }
11291146
1130-     bool  eval (ggml_backend_t  backend1, ggml_backend_t  backend2, const  char  * op_names_filter, printer * output_printer) {
1147+     test_status_t  eval (ggml_backend_t  backend1, ggml_backend_t  backend2, const  char  * op_names_filter, printer * output_printer) {
11311148        mode = MODE_TEST;
11321149
11331150        ggml_init_params params = {
@@ -1144,11 +1161,12 @@ struct test_case {
11441161        add_sentinel (ctx);
11451162
11461163        ggml_tensor * out = build_graph (ctx);
1147-         std::string current_op_name = op_desc (out);
1164+         current_op_name = op_desc (out);
1165+ 
11481166        if  (!matches_filter (out, op_names_filter)) {
11491167            // printf("  %s: skipping\n", op_desc(out).c_str());
11501168            ggml_free (ctx);
1151-             return  true ;
1169+             return  test_status_t ::SKIPPED ;
11521170        }
11531171
11541172        //  check if the backends support the ops
@@ -1172,7 +1190,7 @@ struct test_case {
11721190            }
11731191
11741192            ggml_free (ctx);
1175-             return  true ;
1193+             return  test_status_t ::NOT_SUPPORTED ;
11761194        }
11771195
11781196        //  post-graph sentinel
@@ -1184,7 +1202,7 @@ struct test_case {
11841202        if  (buf == NULL ) {
11851203            printf (" failed to allocate tensors [%s] " ggml_backend_name (backend1));
11861204            ggml_free (ctx);
1187-             return  false ;
1205+             return  test_status_t ::FAIL ;
11881206        }
11891207
11901208        //  build graph
@@ -1289,7 +1307,7 @@ struct test_case {
12891307            output_printer->print_test_result (result);
12901308        }
12911309
1292-         return  test_passed;
1310+         return  test_passed ?  test_status_t ::OK :  test_status_t ::FAIL ;
12931311    }
12941312
12951313    bool  eval_perf (ggml_backend_t  backend, const  char  * op_names_filter, printer * output_printer) {
@@ -1306,7 +1324,7 @@ struct test_case {
13061324        GGML_ASSERT (ctx);
13071325
13081326        ggml_tensor * out             = build_graph (ctx.get ());
1309-         std::string    current_op_name = op_desc (out);
1327+         current_op_name = op_desc (out);
13101328        if  (!matches_filter (out, op_names_filter)) {
13111329            // printf("  %s: skipping\n", op_desc(out).c_str());
13121330            return  true ;
@@ -1436,7 +1454,8 @@ struct test_case {
14361454        GGML_ASSERT (ctx);
14371455
14381456        ggml_tensor * out             = build_graph (ctx.get ());
1439-         std::string   current_op_name = op_desc (out);
1457+         current_op_name = op_desc (out);
1458+ 
14401459        if  (!matches_filter (out, op_names_filter)) {
14411460            return  true ;
14421461        }
@@ -7356,16 +7375,26 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
73567375        }
73577376
73587377        size_t  n_ok = 0 ;
7378+         size_t  tests_run = 0 ;
7379+         std::vector<std::string> failed_tests;
73597380        for  (auto  & test : test_cases) {
7360-             if  (test->eval (backend, backend_cpu, op_names_filter, output_printer)) {
7381+             test_status_t  status = test->eval (backend, backend_cpu, op_names_filter, output_printer);
7382+             if  (status == test_status_t ::SKIPPED || status == test_status_t ::NOT_SUPPORTED) {
7383+                 continue ;
7384+             }
7385+             tests_run++;
7386+             if  (status == test_status_t ::OK) {
73617387                n_ok++;
7388+             } else  if  (status == test_status_t ::FAIL) {
7389+                 failed_tests.push_back (test->current_op_name  + " (" vars () + " )" 
73627390            }
73637391        }
7364-         output_printer->print_summary (test_summary_info (n_ok, test_cases.size (), false ));
7392+         output_printer->print_summary (test_summary_info (n_ok, tests_run, false ));
7393+         output_printer->print_failed_tests (failed_tests);
73657394
73667395        ggml_backend_free (backend_cpu);
73677396
7368-         return  n_ok == test_cases. size () ;
7397+         return  n_ok == tests_run ;
73697398    }
73707399
73717400    if  (mode == MODE_GRAD) {
0 commit comments