|
@@ -133,6 +133,19 @@ static char *analyze_output(const char *output, char **errs)
|
|
|
return leaks;
|
|
return leaks;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static const char *concat(struct score *score, char *bits[])
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+ char *ret = talloc_strdup(score, "");
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; bits[i]; i++) {
|
|
|
|
|
+ if (i)
|
|
|
|
|
+ ret = talloc_append_string(ret, " ");
|
|
|
|
|
+ ret = talloc_append_string(ret, bits[i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ return ret;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/* FIXME: Run examples, too! */
|
|
/* FIXME: Run examples, too! */
|
|
|
static void do_run_tests_vg(struct manifest *m,
|
|
static void do_run_tests_vg(struct manifest *m,
|
|
|
bool keep,
|
|
bool keep,
|
|
@@ -145,11 +158,19 @@ static void do_run_tests_vg(struct manifest *m,
|
|
|
|
|
|
|
|
/* This is slow, so we run once but grab leak info. */
|
|
/* This is slow, so we run once but grab leak info. */
|
|
|
score->total = 0;
|
|
score->total = 0;
|
|
|
|
|
+ score->pass = true;
|
|
|
foreach_ptr(list, &m->run_tests, &m->api_tests) {
|
|
foreach_ptr(list, &m->run_tests, &m->api_tests) {
|
|
|
list_for_each(list, i, list) {
|
|
list_for_each(list, i, list) {
|
|
|
char *output, *err, *log;
|
|
char *output, *err, *log;
|
|
|
bool pass;
|
|
bool pass;
|
|
|
|
|
+ const char *options;
|
|
|
|
|
+
|
|
|
score->total++;
|
|
score->total++;
|
|
|
|
|
+ options = concat(score,
|
|
|
|
|
+ per_file_options(&tests_pass_valgrind,
|
|
|
|
|
+ i));
|
|
|
|
|
+ if (streq(options, "FAIL"))
|
|
|
|
|
+ continue;
|
|
|
|
|
|
|
|
/* FIXME: Valgrind's output sucks. XML is unreadable by
|
|
/* FIXME: Valgrind's output sucks. XML is unreadable by
|
|
|
* humans *and* doesn't support children reporting. */
|
|
* humans *and* doesn't support children reporting. */
|
|
@@ -164,8 +185,7 @@ static void do_run_tests_vg(struct manifest *m,
|
|
|
" --leak-check=full"
|
|
" --leak-check=full"
|
|
|
" --log-fd=3 %s %s"
|
|
" --log-fd=3 %s %s"
|
|
|
" 3> %s",
|
|
" 3> %s",
|
|
|
- tests_pass_valgrind.options ?
|
|
|
|
|
- tests_pass_valgrind.options : "",
|
|
|
|
|
|
|
+ options,
|
|
|
i->compiled, log);
|
|
i->compiled, log);
|
|
|
output = grab_file(i, log, NULL);
|
|
output = grab_file(i, log, NULL);
|
|
|
/* No valgrind errors? Expect it to pass... */
|
|
/* No valgrind errors? Expect it to pass... */
|
|
@@ -181,15 +201,13 @@ static void do_run_tests_vg(struct manifest *m,
|
|
|
} else {
|
|
} else {
|
|
|
i->leak_info = analyze_output(output, &err);
|
|
i->leak_info = analyze_output(output, &err);
|
|
|
}
|
|
}
|
|
|
- if (err)
|
|
|
|
|
|
|
+ if (err) {
|
|
|
score_file_error(score, i, 0, "%s", err);
|
|
score_file_error(score, i, 0, "%s", err);
|
|
|
- else
|
|
|
|
|
|
|
+ score->pass = false;
|
|
|
|
|
+ } else
|
|
|
score->score++;
|
|
score->score++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (score->score == score->total)
|
|
|
|
|
- score->pass = true;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void do_leakcheck_vg(struct manifest *m,
|
|
static void do_leakcheck_vg(struct manifest *m,
|
|
@@ -226,13 +244,18 @@ static void run_under_debugger_vg(struct manifest *m, struct score *score)
|
|
|
struct file_error *first;
|
|
struct file_error *first;
|
|
|
char *command;
|
|
char *command;
|
|
|
|
|
|
|
|
|
|
+ /* Don't ask anything if they suppressed tests. */
|
|
|
|
|
+ if (score->pass)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
if (!ask("Should I run the first failing test under the debugger?"))
|
|
if (!ask("Should I run the first failing test under the debugger?"))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
first = list_top(&score->per_file_errors, struct file_error, list);
|
|
first = list_top(&score->per_file_errors, struct file_error, list);
|
|
|
command = talloc_asprintf(m, "valgrind --leak-check=full --db-attach=yes%s %s",
|
|
command = talloc_asprintf(m, "valgrind --leak-check=full --db-attach=yes%s %s",
|
|
|
- tests_pass_valgrind.options ?
|
|
|
|
|
- tests_pass_valgrind.options : "",
|
|
|
|
|
|
|
+ concat(score,
|
|
|
|
|
+ per_file_options(&tests_pass_valgrind,
|
|
|
|
|
+ first->file)),
|
|
|
first->file->compiled);
|
|
first->file->compiled);
|
|
|
if (system(command))
|
|
if (system(command))
|
|
|
doesnt_matter();
|
|
doesnt_matter();
|