Mesa (master): llvmpipe: new -s option to run single test

Brian Paul brianp at kemper.freedesktop.org
Fri Jun 4 16:01:47 PDT 2010


Module: Mesa
Branch: master
Commit: 4f067ada47bfeef792e5adbed4f3e215b704212a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f067ada47bfeef792e5adbed4f3e215b704212a

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Jun  4 17:00:48 2010 -0600

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 338a04a..90422e4 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 557eb8e..0c95555 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 cb0d02a..9b02f43 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 7c0d7d2..8b6dc1c 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 f9dce8b..7bbbc61 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 d99ca81..21df83f 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 da16fea..c7a903a 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;
+}



More information about the mesa-commit mailing list