Ignore test-only dependency cycles
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 22 Jan 2015 15:38:08 +0000 (17:38 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 23 Jan 2015 16:08:15 +0000 (17:08 +0100)
Make check-source and the dependency graph generation ignore
module-level dependencies where only tests in the source module depend
on the destination module.  This could possibly be more fine-grained (in
valid cases, the tests should only depend on a well-defined set of
low-level modules, not on any higher-level module), but for now this is
likely fine.

Change-Id: I9d218f632c6155ad6ba21a218bfc7ec940593b51

docs/doxygen/check-source.py
docs/doxygen/gmxtree.py
docs/doxygen/graphbuilder.py

index 34cca21a9090d43bf1a107da0ba34df337e1a722..b0bb86e5372a11953d7e620a74b9865f576789fc 100755 (executable)
@@ -336,13 +336,11 @@ class ModuleDependencyGraph(object):
         self._tree = tree
 
     def iternodes(self):
-        for module in self._tree.get_modules():
-            if module.get_name() != 'module_testutils':
-                yield module
+        return self._tree.get_modules()
 
     def iteredges(self, module):
         for dependency in module.get_dependencies():
-            if dependency.get_other_module().get_name() != 'module_testutils':
+            if not dependency.is_test_only_dependency():
                 yield (dependency.get_other_module(), dependency)
 
     def report_cycle(self, cycle, reporter):
index 687280c41a2bd603fbe48d5aa9b28eced6f7df9e..a2f012a50277960078e69abc14d581bf8a7ffa9c 100644 (file)
@@ -476,10 +476,13 @@ class ModuleDependency(object):
         self._othermodule = othermodule
         self._includedfiles = []
         self._cyclesuppression = None
+        self._is_test_only_dependency = True
 
     def add_included_file(self, includedfile):
         """Add IncludedFile that is part of this dependency."""
         assert includedfile.get_file().get_module() == self._othermodule
+        if not includedfile.get_including_file().is_test_file():
+            self._is_test_only_dependency = False
         self._includedfiles.append(includedfile)
 
     def set_cycle_suppression(self):
@@ -490,6 +493,10 @@ class ModuleDependency(object):
         """Return whether cycles containing this dependency are suppressed."""
         return self._cyclesuppression is not None
 
+    def is_test_only_dependency(self):
+        """Return whether this dependency is only from test code."""
+        return self._is_test_only_dependency
+
     def get_other_module(self):
         """Get module that this dependency is to."""
         return self._othermodule
index 0026e60c093f9ede5fdf8238c090c07d6643e4a3..1df4fd9a33ecaac2d202705f3578ec1d77a9826e 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -130,7 +130,8 @@ class Edge(object):
         elif self._edgetype == EdgeType.intramodule:
             properties = ''
         elif self._edgetype == EdgeType.test:
-            properties = 'color=".33 .8 .8", style=dashed'
+            # TODO: Consider if only some test edges should be made non-constraints
+            properties = 'color=".33 .8 .8", style=dashed, constraint=no'
         elif self._edgetype == EdgeType.libimpl:
             properties = 'color=".66 .8 .8", style=dashed'
         elif self._edgetype == EdgeType.pubimpl: