diff -r 853e8a9ccfc9 -r cd3068704d3a test/harness/testcase.c --- a/test/harness/testcase.c Tue Sep 24 07:18:50 2013 +0100 +++ b/test/harness/testcase.c Sun Oct 20 21:06:25 2013 +0100 @@ -326,6 +326,42 @@ } /* + * Check the summary produced by bookloupe against testcase->summary. + */ +static gboolean testcase_check_summary(Testcase *testcase,const char *summary) +{ + int i; + gboolean r; + gchar **lines; + GSList *texts,*lnk; + if (!testcase->summary.texts) + return TRUE; + texts=g_slist_copy(testcase->summary.texts); + lines=g_strsplit(summary,"\n",0); + for(i=0;lines[i];i++) + { + if (!g_str_has_prefix(lines[i]," --> ")) + continue; + for(lnk=texts;lnk;lnk=lnk->next) + if (!strcmp(lines[i]+7,lnk->data)) + { + texts=g_slist_delete_link(texts,lnk); + break; + } + } + g_strfreev(lines); + r=!texts; + if (texts) + { + g_print("%s: FAIL\n",testcase->basename); + g_print("Missing summary text from bookloupe:\n"); + g_print(" --> %s\n",texts->data); + } + g_slist_free(texts); + return r; +} + +/* * Check the warnings produced by bookloupe against either the * unstructured testcase->expected or the structured testcase->warnings * as appropriate. @@ -460,7 +496,7 @@ gboolean r; size_t pos,offset; GString *header; - char *output,*filename,*s,*xfail=NULL; + char *output,*filename,*s,*summary,*xfail=NULL; GError *error=NULL; if (!testcase_create_input_files(testcase,&error)) { @@ -500,10 +536,15 @@ pos=header->len; if (r) { - /* Skip the summary */ + /* Find the end of the summary */ s=strstr(output+pos,"\n\n"); if (s) + { + summary=g_strndup(output+pos,s-(output+pos)); + r=testcase_check_summary(testcase,summary); + g_free(summary); pos=s-output+2; + } else { g_print("%s: FAIL\n",testcase->basename); @@ -512,7 +553,8 @@ } } g_string_free(header,TRUE); - r=testcase_check_warnings(testcase,output+pos,&xfail); + if (r) + r=testcase_check_warnings(testcase,output+pos,&xfail); g_free(filename); g_free(output); if (r)