diff options
author | Zhu Bingbing <bingbingx.zhu@intel.com> | 2014-12-10 12:05:11 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-12-16 16:06:15 +0800 |
commit | 293777b4b1fe6241b0a5ccd3467a28c699f1ae80 (patch) | |
tree | 03267a4b7cc82c84f231e11b3271cb398b460793 | |
parent | 430284d29039a52f7ccefab33e9fbd6e538f0fdb (diff) |
change the utest summary code
Signed-off-by: Zhu Bingbing<bingbingx.zhu@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | utests/utest.cpp | 10 | ||||
-rw-r--r-- | utests/utest.hpp | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/utests/utest.cpp b/utests/utest.cpp index b9148914..0a03d8b8 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 0dc611d4..b028b64f 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 */ |