[compiler-rt] 84980b1 - [DFSan] Print more debugging info on test failure.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 08:48:20 PDT 2020


Author: Matt Morehouse
Date: 2020-07-23T15:47:56Z
New Revision: 84980b1395d17c022f0393ca3d0638153b48c75a

URL: https://github.com/llvm/llvm-project/commit/84980b1395d17c022f0393ca3d0638153b48c75a
DIFF: https://github.com/llvm/llvm-project/commit/84980b1395d17c022f0393ca3d0638153b48c75a.diff

LOG: [DFSan] Print more debugging info on test failure.

Added: 
    

Modified: 
    compiler-rt/test/dfsan/fast16labels.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/dfsan/fast16labels.c b/compiler-rt/test/dfsan/fast16labels.c
index 4af452638926..90c039234c33 100644
--- a/compiler-rt/test/dfsan/fast16labels.c
+++ b/compiler-rt/test/dfsan/fast16labels.c
@@ -24,6 +24,7 @@ int foo(int a, int b) {
 int main(int argc, char *argv[]) {
   // Death tests for unsupported API usage.
   const char *command = (argc < 2) ? "" : argv[1];
+  fprintf(stderr, "Running with command %s\n", command);
   // CREATE-LABEL: FATAL: DataFlowSanitizer: dfsan_create_label is unsupported
   if (strcmp(command, "dfsan_create_label") == 0)
     dfsan_create_label("", NULL);
@@ -41,12 +42,18 @@ int main(int argc, char *argv[]) {
   dfsan_set_label(8, &a, sizeof(a));
   dfsan_set_label(512, &b, sizeof(b));
   int c = foo(a, b);
-  printf("A: 0x%x\n", dfsan_get_label(a));
-  printf("B: 0x%x\n", dfsan_get_label(b));
+  fprintf(stderr, "A: 0x%x\n", dfsan_get_label(a));
+  fprintf(stderr, "B: 0x%x\n", dfsan_get_label(b));
   dfsan_label l = dfsan_get_label(c);
-  printf("C: 0x%x\n", l);
+  fprintf(stderr, "C: 0x%x\n", l);
+  fprintf(stderr, "Testing l == 520\n");
   assert(l == 520);  // OR of the other two labels.
+  fprintf(stderr, "Testing dfsan_has_label(l, 8)\n");
   assert(dfsan_has_label(l, 8));
+  fprintf(stderr, "Testing dfsan_has_label(l, 512)\n");
   assert(dfsan_has_label(l, 512));
+  fprintf(stderr, "Testing !dfsan_has_label(l, 1)\n");
   assert(!dfsan_has_label(l, 1));
+  fprintf(stderr, "returning...\n");
+  return 0;
 }


        


More information about the llvm-commits mailing list