cppdep icon indicating copy to clipboard operation
cppdep copied to clipboard

Test on Boost project

Open rakhimov opened this issue 8 years ago • 13 comments

rakhimov avatar Jan 09 '17 23:01 rakhimov

The current running time with pypy:

  • 3s for parsing and creating components
  • ~7s to analyze and plot the graph (networkx)

SUMMARY: Components: 10254 Cycles: 1 Levels: 20 CCD: 14748 ACCD: 1.438268 NCCD: 0.116692(typical range is [0.85, 1.10])

rakhimov avatar Jan 10 '17 03:01 rakhimov

@rakhimov Could you please provide the test setup of this run (invokation location of cppdep, file system structure, config.yml, etc.). As there is no documentation right now this would help others to understand how to use cppdep...

fkromer avatar Jan 16 '17 20:01 fkromer

@fkromer This is the initial setup (used with cppdep 0.1.0).

Currently, the configuration file is under refactoring, so the meaning of paths and setup are likely to change. Anyhow, please feel free to contribute to the wiki of the project.

rakhimov avatar Jan 16 '17 20:01 rakhimov

Boost source is from the archive (not the git repositories).

rakhimov avatar Jan 16 '17 20:01 rakhimov

@rakhimov Thanks. I will do so.

fkromer avatar Jan 16 '17 20:01 fkromer

@rakhimov I tried it with the github boost sources:

~/ws_github $ git clone https://github.com/boostorg/boost.git
...
~/ws_github $ cd boost/
~/ws_github/boost $ virtualenv -p /usr/bin/python3.4 pyvenv
...
~/ws_github/boost $ source pyvenv/bin/activate
(pyvenv) ~/ws_github/boost $ pip install cppdep
...

I added the config_boost.xml in /ws_github/cppdep (with adjusted boost src directory, c++ stl version):

<cppdep>
  <package-group name="Boost" path=".">
    <include-path/>  <!-- The project group root path -->
    <src-path>libs</src-path>
  </package-group>
  <package-group role="external" name="STD" path="/usr/include">
    <include-path/>
    <package name="STL">
      <include-path>c++/4.8</include-path>
    </package>
    <package name="BoostExternal">
      <alias-path>boost</alias-path>  <!-- The fake project to find headers -->
    </package>
  </package-group>
</cppdep>

I ran cppdep:

(pyvenv) ~/ws_github/boost $ cppdep -c ./config_boost.xml
Traceback (most recent call last):
...
File "/home/florian/ws_github/boost/pyvenv/lib/python3.4/site-packages/cppdep.py", line 358, in _update
(path, self.group.path, self.group.name))
cppdep.InvalidArgumentError: boost is not a directory in /usr/include (group STD).

Did you installed boost into /usr/include/boost as "fake project to find headers"?

fkromer avatar Jan 16 '17 21:01 fkromer

Yes, the reason is #32

rakhimov avatar Jan 16 '17 21:01 rakhimov

The c++ stl and boost is expected to be installed, if not installed yet:

~/ws_github/boost $ sudo apt-get install build-essential
~/ws_github/boost $ sudo apt-get install libboost-all-dev

Now I get:

(pyvenv) ~/ws_github/boost $ cppdep -c ./config_boost.xml

################################################################################
analyzing dependencies among packages in the specified package group Boost ...
================================================================================
1 level(s):

level 0:
level 1:
	.
	libs
================================================================================
SUMMARY:
Components: 2	 Cycles: 0	 Levels: 1
CCD: 2	 ACCD: 1.000000	 NCCD: 0.725982(typical range is [0.85, 1.10])
Traceback (most recent call last):
  File "/home/florian/ws_github/boost/pyvenv/bin/cppdep", line 11, in <module>
    sys.exit(main())
  File "/home/florian/ws_github/boost/pyvenv/lib/python3.4/site-packages/cppdep.py", line 735, in main
    analysis.make_graph(printer, args)
  File "/home/florian/ws_github/boost/pyvenv/lib/python3.4/site-packages/cppdep.py", line 695, in make_graph
AssertionError

fkromer avatar Jan 16 '17 21:01 fkromer

I think the problem is that you are getting Boost from the git repo. The configuration is for Boost 1.56 from the archive (distributed by release).

I think a better configuration would be to have a configuration for each sub-project within Boost as is done for git with git submodules.

rakhimov avatar Jan 16 '17 21:01 rakhimov

Right, I give it a try...

fkromer avatar Jan 16 '17 21:01 fkromer

I checked out all the submodules:

~/ws_github/boost $ git submodule update --init --recursive --remote --no-fetch

But I got a lot of errors when I ran cppcheck over all of them in a single run:

TypeError: not all arguments converted during string formatting
...
Message: 'include issues: duplicate include:'
...
Message: 'include issues: include order:'
...
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 371: invalid start byte

fkromer avatar Jan 16 '17 22:01 fkromer

This 'utf-8' and other bugs have been fixed in the current development: https://github.com/rakhimov/cppdep/milestone/2?closed=1

This is still work in progress. I would say, for now, please wait till the configuration file stabilizes with version 0.2.0.

I hope the example configuration file and schema should be enough to grasp how to setup a project analysis.

rakhimov avatar Jan 16 '17 22:01 rakhimov

I added a separate config_boost_filesystem.xml in boost/libs/filesystem:

<cppdep>
  <package-group name="Boost filesystem" path=".">
    <include-path/>  <!-- The project group root path -->
    <src-path>src</src-path>
  </package-group>
  <package-group role="external" name="STD" path="/usr/include">
    <include-path/>
    <package name="STL">
      <include-path>c++/4.8</include-path>
    </package>
    <package name="BoostExternal">
      <alias-path>boost</alias-path>  <!-- The fake project to find headers -->
    </package>
  </package-group>
</cppdep>

I ran:

(pyvenv) ~/ws_github/boost/libs/filesystem $ cppdep -c ./config_boost_filesystem.xml

...got some warnings and errors but was able to display the diagrams (requires xdot, if not installed yet: sudo apt-get install xdot):

(pyvenv) ~/ws_github/boost/libs/filesystem $ xdot 'Boost filesystem_src.dot'
(pyvenv) ~/ws_github/boost/libs/filesystem $ xdot 'Boost filesystem.dot'

fkromer avatar Jan 16 '17 22:01 fkromer