From 4f067ada47bfeef792e5adbed4f3e215b704212a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jun 2010 17:00:48 -0600 Subject: [PATCH] llvmpipe: new -s option to run single test Put specific test code in the test_single() function and pass -s to execute that code. --- src/gallium/drivers/llvmpipe/lp_test.h | 2 ++ src/gallium/drivers/llvmpipe/lp_test_blend.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_conv.c | 26 ++++++++++++++++++++++++-- src/gallium/drivers/llvmpipe/lp_test_format.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_main.c | 7 ++++++- src/gallium/drivers/llvmpipe/lp_test_printf.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_sincos.c | 7 +++++++ 7 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index 338a04a4878..90422e42588 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -66,6 +66,8 @@ write_tsv_header(FILE *fp); boolean test_some(unsigned verbose, FILE *fp, unsigned long n); +boolean +test_single(unsigned verbose, FILE *fp); boolean test_all(unsigned verbose, FILE *fp); diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 557eb8e3e6f..0c955556551 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -895,3 +895,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) return success; } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index cb0d02ab32c..9b02f436c5b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -260,10 +260,15 @@ test_one(unsigned verbose, success = FALSE; } - if (!success) { + if (!success || verbose >= 3) { if(verbose < 1) dump_conv_types(stderr, src_type, dst_type); - fprintf(stderr, "MISMATCH\n"); + if (success) { + fprintf(stderr, "PASS\n"); + } + else { + fprintf(stderr, "MISMATCH\n"); + } for(j = 0; j < num_srcs; ++j) { fprintf(stderr, " Src%u: ", j); @@ -429,3 +434,20 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) return success; } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + /* float, fixed, sign, norm, width, len */ + struct lp_type f32x4_type = + { TRUE, FALSE, TRUE, TRUE, 32, 4 }; + struct lp_type ub8x4_type = + { FALSE, FALSE, FALSE, TRUE, 8, 16 }; + + boolean success; + + success = test_one(verbose, fp, f32x4_type, ub8x4_type); + + return success; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 7c0d7d2e656..8b6dc1c7f5d 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -269,3 +269,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index f9dce8b9c25..7bbbc61d4c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -370,10 +370,13 @@ int main(int argc, char **argv) unsigned long n = 1000; unsigned i; boolean success; + boolean single = FALSE; for(i = 1; i < argc; ++i) { if(strcmp(argv[i], "-v") == 0) ++verbose; + else if(strcmp(argv[i], "-s") == 0) + single = TRUE; else if(strcmp(argv[i], "-o") == 0) fp = fopen(argv[++i], "wt"); else @@ -391,7 +394,9 @@ int main(int argc, char **argv) write_tsv_header(fp); } - if(n) + if (single) + success = test_single(verbose, fp); + else if (n) success = test_some(verbose, fp, n); else success = test_all(verbose, fp); diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index d99ca816387..21df83f9d89 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -165,3 +165,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_sincos.c b/src/gallium/drivers/llvmpipe/lp_test_sincos.c index da16fea7bd5..c7a903a0256 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_sincos.c +++ b/src/gallium/drivers/llvmpipe/lp_test_sincos.c @@ -198,3 +198,10 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} -- 2.11.0