From 50526c789de08df78eee21a0c6eedd8162bf806a Mon Sep 17 00:00:00 2001 From: Teemu Murtola Date: Thu, 22 Jan 2015 17:38:08 +0200 Subject: [PATCH] Ignore test-only dependency cycles 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 | 6 ++---- docs/doxygen/gmxtree.py | 7 +++++++ docs/doxygen/graphbuilder.py | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/doxygen/check-source.py b/docs/doxygen/check-source.py index 34cca21a90..b0bb86e537 100755 --- a/docs/doxygen/check-source.py +++ b/docs/doxygen/check-source.py @@ -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): diff --git a/docs/doxygen/gmxtree.py b/docs/doxygen/gmxtree.py index 687280c41a..a2f012a502 100644 --- a/docs/doxygen/gmxtree.py +++ b/docs/doxygen/gmxtree.py @@ -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 diff --git a/docs/doxygen/graphbuilder.py b/docs/doxygen/graphbuilder.py index 0026e60c09..1df4fd9a33 100755 --- a/docs/doxygen/graphbuilder.py +++ b/docs/doxygen/graphbuilder.py @@ -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: -- 2.22.0