[gtk-doc] check: fix check invocation with env-vars



commit eb70b07faab9b863cd70ee0d4e3b5566e214ec01
Author: Stefan Kost <ensonic users sf net>
Date:   Tue Sep 21 17:17:12 2010 +0300

    check: fix check invocation with env-vars
    
    We need to first cd and then set env-vars so that the vars are active for the
    process. Also pick the chance and pass srcdir + builddir (needed for transition
    of building in builddir).

 examples/Makefile.am |    4 ++--
 gtkdoc-check.in      |   22 +++++++++++++++++-----
 2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 4065742..661491c 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -96,9 +96,9 @@ EXTRA_DIST +=
 # Comment this out if you want 'make check' to test you doc status
 # and run some sanity checks
 if ENABLE_GTK_DOC
-TESTS_ENVIRONMENT = \
+TESTS_ENVIRONMENT = cd $(srcdir) && \
   DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
-  cd $(srcdir) &&
+  SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
 #TESTS = $(GTKDOC_CHECK)
 endif
 
diff --git a/gtkdoc-check.in b/gtkdoc-check.in
index e94c753..b2d71b6 100755
--- a/gtkdoc-check.in
+++ b/gtkdoc-check.in
@@ -57,6 +57,18 @@ my $checks = 4;
 # We like Makefile.am more but builddir does not necessarily contain one.
 my $makefile = (-f 'Makefile.am') ? 'Makefile.am' : 'Makefile';
 
+# For historic reasons tests are launched in srcdir
+my $SRCDIR = $ENV{"SRCDIR"};
+my $BUILDDIR = $ENV{"BUILDDIR"};
+my $dir = ".";
+if (defined($BUILDDIR) and $BUILDDIR ne "") {
+    $dir=$BUILDDIR;
+}
+
+# debug
+#for my $key (sort(keys(%ENV))) { print "$key = ", $ENV{$key}, "\n"; }
+# debug
+
 my $DOC_MODULE = $ENV{"DOC_MODULE"};
 if (!defined($DOC_MODULE) or $DOC_MODULE eq "") {
     $DOC_MODULE = &Grep('^\s*DOC_MODULE\s*=\s*(\S+)', $makefile, 'DOC_MODULE');
@@ -70,22 +82,22 @@ if (!defined($DOC_MAIN_SGML_FILE) or $DOC_MAIN_SGML_FILE eq "") {
 print "Running suite(s): gtk-doc-$DOC_MODULE\n";
 
 my $undocumented = int &Grep('^(\d+)\s+not\s+documented\.\s*$',
-                             "$DOC_MODULE-undocumented.txt",
+                             "$dir/$DOC_MODULE-undocumented.txt",
                              'number of undocumented symbols');
 my $incomplete = int &Grep('^(\d+)\s+symbols?\s+incomplete\.\s*$',
-                           "$DOC_MODULE-undocumented.txt",
+                           "$dir/$DOC_MODULE-undocumented.txt",
                            'number of incomplete symbols');
 my $total = $undocumented + $incomplete;
 if ($total) {
     print "$DOC_MODULE-undocumented.txt:1:E: $total undocumented or incomplete symbols\n";
 }
 
-my $undeclared = &CheckEmpty("$DOC_MODULE-undeclared.txt",
+my $undeclared = &CheckEmpty("$dir/$DOC_MODULE-undeclared.txt",
                              'undeclared symbols');
-my $unused = &CheckEmpty("$DOC_MODULE-unused.txt",
+my $unused = &CheckEmpty("$dir/$DOC_MODULE-unused.txt",
                          'unused documentation entries');
 
-my $missing_includes = &CheckIncludes ($DOC_MAIN_SGML_FILE);
+my $missing_includes = &CheckIncludes ("$dir/$DOC_MAIN_SGML_FILE");
 
 my $failed = ($total > 0) + ($undeclared != 0) + ($unused != 0) + ($missing_includes != 0);
 my $rate = 100.0*($checks - $failed)/$checks;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]