Quiet clang analyzer false positive in regress tests.

This commit is contained in:
Todd C. Miller
2021-04-27 15:56:24 -06:00
parent 84a01d3a93
commit ac878d3e27
11 changed files with 42 additions and 21 deletions

View File

@@ -91,7 +91,7 @@ main(int argc, char *argv[])
continue; continue;
} }
} }
if (errors != 0) { if (ntests != 0) {
printf("%s: %d tests run, %d errors, %d%% success rate\n", printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests); getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
} }

View File

@@ -183,8 +183,10 @@ main(int argc, char *argv[])
} }
ntests++; ntests++;
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -92,8 +92,10 @@ main(int argc, char *argv[])
sudo_dso_unload(handle); sudo_dso_unload(handle);
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -144,8 +144,10 @@ main(int argc, char *argv[])
free(edit_argv); free(edit_argv);
} }
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -96,8 +96,10 @@ main(int argc, char *argv[])
} }
} }
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -108,7 +108,10 @@ main(int argc, char *argv[])
} }
ntests *= 2; /* we test in both directions */ ntests *= 2; /* we test in both directions */
printf("check_base64: %d tests run, %d errors, %d%% success rate\n", if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -175,8 +175,10 @@ main(int argc, char *argv[])
errors += do_tests(check_fill_args, args_data, nitems(args_data)); errors += do_tests(check_fill_args, args_data, nitems(args_data));
ntests = nitems(txt_data) + nitems(cmd_data) + nitems(args_data); ntests = nitems(txt_data) + nitems(cmd_data) + nitems(args_data);
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -77,7 +77,9 @@ main(int argc, char *argv[])
errors++; errors++;
} }
} }
printf("check_gentime: %d tests run, %d errors, %d%% success rate\n", if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -75,7 +75,9 @@ main(int argc, char *argv[])
errors++; errors++;
} }
} }
printf("check_hexchar: %d tests run, %d errors, %d%% success rate\n", if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -111,8 +111,10 @@ main(int argc, char *argv[])
} }
} }
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }

View File

@@ -136,8 +136,10 @@ main(int argc, char *argv[])
test_strvec_join(' ', &ntests, &errors); test_strvec_join(' ', &ntests, &errors);
test_strvec_join('\n', &ntests, &errors); test_strvec_join('\n', &ntests, &errors);
printf("%s: %d tests run, %d errors, %d%% success rate\n", getprogname(), if (ntests != 0) {
ntests, errors, (ntests - errors) * 100 / ntests); printf("%s: %d tests run, %d errors, %d%% success rate\n",
getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
}
exit(errors); exit(errors);
} }