[gtk-doc] gtkdoc-check: Add a test checking if all XML files are included in main file
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] gtkdoc-check: Add a test checking if all XML files are included in main file
- Date: Wed, 15 Sep 2010 19:18:04 +0000 (UTC)
commit fb06cef480903fcfef7eb366de3b7dfd2fd9fd2d
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Sep 8 22:36:53 2010 +0100
gtkdoc-check: Add a test checking if all XML files are included in main file
Add a test to gtkdoc-check which checks if all XML files in the xml directory
are included in $DOC_MAIN_SGML_FILE. Closes: bgo#627920
gtkdoc-check.in | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc-check.in b/gtkdoc-check.in
index 8cf914f..22991b3 100755
--- a/gtkdoc-check.in
+++ b/gtkdoc-check.in
@@ -51,7 +51,7 @@ EOF
exit 0;
}
-my $checks = 3;
+my $checks = 4;
# Get parameters from test env, if not there try to grab them from the makefile
# We like Makefile.am more but builddir does not necessarily contain one.
@@ -61,6 +61,11 @@ my $DOC_MODULE = $ENV{"DOC_MODULE"};
if (!defined($DOC_MODULE) or $DOC_MODULE == "") {
$DOC_MODULE = &Grep('^\s*DOC_MODULE\s*=\s*(\S+)', $makefile, 'DOC_MODULE');
}
+my $DOC_MAIN_SGML_FILE = $ENV{"DOC_MAIN_SGML_FILE"};
+if (!defined($DOC_MAIN_SGML_FILE) or $DOC_MAIN_SGML_FILE == "") {
+ $DOC_MAIN_SGML_FILE = &Grep('^\s*DOC_MAIN_SGML_FILE\s*=\s*(\S+)', $makefile, 'DOC_MAIN_SGML_FILE');
+ $DOC_MAIN_SGML_FILE =~ s/\$\(DOC_MODULE\)/$DOC_MODULE/;
+}
print "Running suite(s): gtk-doc-$DOC_MODULE\n";
@@ -80,7 +85,9 @@ my $undeclared = &CheckEmpty("$DOC_MODULE-undeclared.txt",
my $unused = &CheckEmpty("$DOC_MODULE-unused.txt",
'unused documentation entries');
-my $failed = ($total > 0) + ($undeclared != 0) + ($unused != 0);
+my $missing_includes = &CheckIncludes ($DOC_MAIN_SGML_FILE);
+
+my $failed = ($total > 0) + ($undeclared != 0) + ($unused != 0) + ($missing_includes != 0);
my $rate = 100.0*($checks - $failed)/$checks;
printf "%.1f%%: Checks %d, Failures: %d\n", $rate, $checks, $failed;
exit ($failed != 0);
@@ -123,3 +130,36 @@ sub CheckEmpty() {
return $count;
}
+sub CheckIncludes() {
+ my ($main_sgml_file) = @_;
+
+ if (not open GFILE, "<$main_sgml_file") {
+ die "Cannot open $main_sgml_file: $!\n";
+ }
+
+ # Check that each of the XML files in the xml directory are included in $DOC_MAIN_SGML_FILE
+ my @xml_files = <xml/*.xml>;
+ my $num_missing = 0;
+
+ foreach my $xml_file (@xml_files) {
+ my $regex = quotemeta ($xml_file);
+ my $found = 0;
+
+ while (<GFILE>) {
+ next if not m/"$regex"/;
+ $found = 1;
+ last;
+ }
+
+ if (!$found) {
+ $num_missing++;
+ print "$main_sgml_file doesn't appear to include \"$xml_file\"\n";
+ }
+
+ seek (GFILE, 0, 0);
+ }
+
+ close (GFILE);
+
+ return $num_missing;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]