[Beignet] [PATCH] change the utest summary code

Zhu Bingbing bingbingx.zhu at intel.com
Tue Dec 9 20:05:11 PST 2014


Signed-off-by: Zhu Bingbing<bingbingx.zhu at intel.com>
---
 utests/utest.cpp | 10 +++++-----
 utests/utest.hpp |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/utests/utest.cpp b/utests/utest.cpp
index b914891..0a03d8b 100644
--- a/utests/utest.cpp
+++ b/utests/utest.cpp
@@ -48,15 +48,14 @@ void runSummaryAtExit(void) {
   // If case crashes, count it as fail, and accumulate finishrun
   if(UTest::retStatistics.finishrun != UTest::utestList->size()) {
     UTest::retStatistics.finishrun++;
-    UTest::retStatistics.failCount++;
+   // UTest::retStatistics.failCount++;
   }
   printf("\nsummary:\n----------\n");
   printf("  total: %zu\n",UTest::utestList->size());
-  printf("  run: %zu\n",UTest::retStatistics.finishrun);
+  printf("  run: %zu\n",UTest::retStatistics.actualrun);
   printf("  pass: %zu\n",UTest::retStatistics.passCount);
   printf("  fail: %zu\n",UTest::retStatistics.failCount);
-  printf("  pass rate: %f\n",1-(float)UTest::retStatistics.failCount/(float)UTest::utestList->size());
-
+  printf("  pass rate: %f\n", (UTest::retStatistics.actualrun)?((float)UTest::retStatistics.passCount/(float)UTest::retStatistics.actualrun):(float)0);
   releaseUTestList();
 }
 
@@ -84,6 +83,7 @@ void signalHandler( int signum )
   }
 
   printf("    Interrupt signal (%s) received.", name);
+  UTest::retStatistics.failCount++;
 
   exit(signum);
 }
@@ -128,7 +128,7 @@ void UTest::do_run(struct UTest utest){
   // Print function name
   printf("%s()", utest.name);
   fflush(stdout);
-
+  retStatistics.actualrun++;
   // Run one case in utestList, print result [SUCCESS] or [FAILED]
   (utest.fn)();
 }
diff --git a/utests/utest.hpp b/utests/utest.hpp
index 0dc611d..b028b64 100644
--- a/utests/utest.hpp
+++ b/utests/utest.hpp
@@ -37,6 +37,7 @@ struct RStatistics
   size_t passCount;
   size_t failCount;
   size_t finishrun;
+  size_t actualrun;
 };
 
 /*! Quick and dirty unit test system with registration */
-- 
1.9.3



More information about the Beignet mailing list