[Beignet] [PATCH] change the utest summary code

Zhigang Gong zhigang.gong at linux.intel.com
Mon Dec 15 22:42:01 PST 2014


The empty commit message is not good, other than that, LGTM.
will push latter. Thanks.

On Wed, Dec 10, 2014 at 12:05:11PM +0800, Zhu Bingbing wrote:
> 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
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list