Check coloring
authorMathis Rosenhauer <rosenhauer@dkrz.de>
Thu, 29 Nov 2012 14:24:16 +0000 (15:24 +0100)
committerThomas Jahns <jahns@dkrz.de>
Tue, 19 Feb 2013 10:33:01 +0000 (11:33 +0100)
tests/Makefile.am
tests/check_aec.c
tests/check_aec.h
tests/check_buffer_sizes.c
tests/check_code_options.c

index 2821b0d..37fceab 100644 (file)
@@ -1,3 +1,4 @@
+AUTOMAKE_OPTIONS = color-tests
 AM_CPPFLAGS = -I$(top_srcdir)/src
 TESTS = check_code_options check_buffer_sizes
 check_LTLIBRARIES = libcheck_aec.la
index ac1d915..57c57fd 100644 (file)
@@ -173,7 +173,7 @@ int encode_decode_small(struct test_state *state)
     }
 
     if (memcmp(state->ubuf, state->obuf, state->ibuf_len)) {
-        printf("FAIL: Uncompressed output differs from input.\n");
+        printf("\n%s: Uncompressed output differs from input.\n", CHECK_FAIL);
 
         printf("\nuncompressed buf");
         for (i = 0; i < 80; i++) {
@@ -243,7 +243,7 @@ int encode_decode_large(struct test_state *state)
     }
 
     if (memcmp(state->ubuf, state->obuf, state->ibuf_len)) {
-        printf("FAIL: Uncompressed output differs from input.\n");
+        printf("\n%s: Uncompressed output differs from input.\n", CHECK_FAIL);
 
         printf("\nuncompressed buf");
         for (i = 0; i < 80; i++) {
index 62a0a30..a7a307d 100644 (file)
@@ -22,5 +22,7 @@ int update_state(struct test_state *state);
 int encode_decode_small(struct test_state *state);
 int encode_decode_large(struct test_state *state);
 
-#define CHECK_OK ""
+#define CHECK_PASS "\e[0;32mPASS\e[0m"
+#define CHECK_FAIL "\e[0;31mFAIL\e[0m"
+
 #endif /* CHECK_AEC_H */
index abcf5db..7448baf 100644 (file)
@@ -65,14 +65,14 @@ int check_rsi(struct test_state *state)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
 
     printf("Checking short rsi ... ");
     status = check_block_sizes_short(state);
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }
 
index d16954d..dc6bebf 100644 (file)
@@ -25,8 +25,8 @@ int check_block_sizes(struct test_state *state, int id, int id_len)
                 return status;
 
             if ((state->cbuf[0] >> (8 - id_len)) != id) {
-                printf("FAIL: Unexpected block of size %i created ID:%x.\n",
-                       bs, state->cbuf[0] >> (8 - id_len));
+                printf("%s: Unexpected block of size %i created ID:%x.\n",
+                       CHECK_FAIL, bs, state->cbuf[0] >> (8 - id_len));
                 return 99;
             }
         }
@@ -45,7 +45,7 @@ int check_zero(struct test_state *state)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }
 
@@ -70,7 +70,7 @@ int check_splitting(struct test_state *state, int k)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }
 
@@ -95,7 +95,7 @@ int check_uncompressed(struct test_state *state)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }
 
@@ -120,7 +120,7 @@ int check_fs(struct test_state *state)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }
 
@@ -149,7 +149,7 @@ int check_se(struct test_state *state)
     if (status)
         return status;
 
-    printf ("OK\n");
+    printf ("%s\n", CHECK_PASS);
     return 0;
 }