diff -r f0740133c606 -r 8e0ba1a088c4 test/harness/testcase.c --- a/test/harness/testcase.c Sun Sep 29 22:51:27 2013 +0100 +++ b/test/harness/testcase.c Sun Oct 27 16:36:46 2013 +0000 @@ -385,6 +385,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. @@ -519,7 +555,7 @@ gboolean r; size_t pos,offset; GString *header; - char *filename,*s,*xfail=NULL; + char *filename,*s,*summary,*xfail=NULL; GError *error=NULL; if (!testcase_create_input_files(testcase,&error)) { @@ -558,23 +594,30 @@ print_unexpected(testcase->test_output,offset); r=FALSE; } + summary=testcase->test_output+header->len; pos=header->len; if (r) { - /* Skip the summary */ - s=strstr(testcase->test_output+pos,"\n\n"); + /* Find the end of the summary */ + s=strstr(summary,"\n\n"); if (s) + { + summary=g_strndup(summary,s-summary); + r=testcase_check_summary(testcase,summary); + g_free(summary); pos=s-testcase->test_output+2; + } else { g_print("%s: FAIL\n",testcase->basename); - g_print("Unterminated summary from bookloupe:\n%s\n", - testcase->test_output+pos); + g_print("Unterminated summary from bookloupe:\n%s\n",summary); r=FALSE; } } g_string_free(header,TRUE); - r=testcase_check_warnings(testcase,testcase->test_output+pos,&xfail); + if (r) + r=testcase_check_warnings(testcase,testcase->test_output+pos, + &xfail); } if (!testcase_verify_output_files(testcase)) r=FALSE;