Skip to content

Commit 84980b1

Browse files
committed
[DFSan] Print more debugging info on test failure.
1 parent 5477fbc commit 84980b1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

compiler-rt/test/dfsan/fast16labels.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ int foo(int a, int b) {
2424
int main(int argc, char *argv[]) {
2525
// Death tests for unsupported API usage.
2626
const char *command = (argc < 2) ? "" : argv[1];
27+
fprintf(stderr, "Running with command %s\n", command);
2728
// CREATE-LABEL: FATAL: DataFlowSanitizer: dfsan_create_label is unsupported
2829
if (strcmp(command, "dfsan_create_label") == 0)
2930
dfsan_create_label("", NULL);
@@ -41,12 +42,18 @@ int main(int argc, char *argv[]) {
4142
dfsan_set_label(8, &a, sizeof(a));
4243
dfsan_set_label(512, &b, sizeof(b));
4344
int c = foo(a, b);
44-
printf("A: 0x%x\n", dfsan_get_label(a));
45-
printf("B: 0x%x\n", dfsan_get_label(b));
45+
fprintf(stderr, "A: 0x%x\n", dfsan_get_label(a));
46+
fprintf(stderr, "B: 0x%x\n", dfsan_get_label(b));
4647
dfsan_label l = dfsan_get_label(c);
47-
printf("C: 0x%x\n", l);
48+
fprintf(stderr, "C: 0x%x\n", l);
49+
fprintf(stderr, "Testing l == 520\n");
4850
assert(l == 520); // OR of the other two labels.
51+
fprintf(stderr, "Testing dfsan_has_label(l, 8)\n");
4952
assert(dfsan_has_label(l, 8));
53+
fprintf(stderr, "Testing dfsan_has_label(l, 512)\n");
5054
assert(dfsan_has_label(l, 512));
55+
fprintf(stderr, "Testing !dfsan_has_label(l, 1)\n");
5156
assert(!dfsan_has_label(l, 1));
57+
fprintf(stderr, "returning...\n");
58+
return 0;
5259
}

0 commit comments

Comments
 (0)