runner: Use "18" as exit code in case of error

It is a random number, but it will in most cases give people a hint
that gst-validate reported a critical issue, and thus set the return
code, only by looking at it

Also make use of gst_validate_runner_print() in
gst-validate-transcoding.c as we were copy pasting that method there.
This commit is contained in:
Thibault Saunier 2013-10-05 12:00:35 -03:00
parent ae641d0353
commit 7e1249f089
3 changed files with 8 additions and 23 deletions

View file

@ -75,4 +75,6 @@ gst-validate will try to replace GstPipeline creating functions and configure
monitors automatically for you, reports will be printed to stderr when
they are found. You can also use GST_DEBUG to view the issues that were found
NOTS: The exit code will be "18" in case a critical issue has
been seen while running any of those tools.

View file

@ -128,9 +128,9 @@ gst_validate_runner_printf (GstValidateRunner * runner)
gst_validate_report_printf (report);
if (ret == 0 && report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL) {
g_printerr ("Got critical error %s, setting return value to -1\n",
g_printerr ("Got critical error %s, setting return value to 18\n",
((GstValidateReport *) (tmp->data))->message);
ret = -1;
ret = 18;
}
count++;
}

View file

@ -329,18 +329,17 @@ int
main (int argc, gchar ** argv)
{
guint i;
GSList *tmp;
GstBus *bus;
GstValidateRunner *runner;
GstValidateMonitor *monitor;
GOptionContext *ctx;
int rep_err;
#ifdef G_OS_UNIX
guint signal_watch_id;
#endif
GError *err = NULL;
const gchar *scenario = NULL;
guint count = 0;
gboolean want_help = FALSE;
gboolean list_scenarios = FALSE;
@ -451,25 +450,9 @@ main (int argc, gchar ** argv)
g_timeout_add (50, (GSourceFunc) print_position, NULL);
g_main_loop_run (mainloop);
for (tmp = gst_validate_runner_get_reports (runner); tmp; tmp = tmp->next) {
if (ret == 0 && ((GstValidateReport *) (tmp->data))->level ==
GST_VALIDATE_REPORT_LEVEL_CRITICAL) {
g_printerr ("Got critical error %s, setting return value to -1\n",
((GstValidateReport *) (tmp->data))->message);
ret = -1;
}
count++;
}
g_print ("Pipeline finished, total issues found: %u\n", count);
if (count) {
GSList *iter;
GSList *issues = gst_validate_runner_get_reports (runner);
for (iter = issues; iter; iter = g_slist_next (iter)) {
GstValidateReport *report = iter->data;
gst_validate_report_printf (report);
}
}
rep_err = gst_validate_runner_printf (runner);
if (ret == 0)
ret = rep_err;
exit:
gst_element_set_state (pipeline, GST_STATE_NULL);