gxl2gv: move common agxset call outside conditional in setEdgeAttr
Every path through the conditional block in this code ends in the same agxset
call. We can simplify this (and upcoming changes) by moving the common call
outside the block. Related to #517.
This file was upstreamed into Vim itself in Vim commit 2346a6378483c9871016f9fc821ec5cbea638f13. The version in Vim can now be
considered authoritative and we can cease maintaining a copy here in Graphviz.
Related to #1762.
The sfio library versioned its format structure, _sffmt_s. This allowed multiple
format structures of differing versions to exist in memory at once,¹ with sfio
able to distinguish between a structure created by itself vs a structure created
by a different version of sfio. In theory, this allows multiple versions of the
sfio library to be loaded at once.
In practice, Graphviz does not take advantage of any of this. In fact, it is not
possible to do this within Graphviz as SFIO_VERSION has not been bumped when
lib/sfio is changed. It still claims to be compatible with a version developed
in 2001.
This commit removes the versioning mechanism entirely, in order to both reduce
maintenance overhead as well as remove the runtime cost associated with managing
this data. The latter is trivial in terms of runtime, but it is also work that
has no purpose.
¹ This kind of design often also allows you to serialize a structure to disk or
network to later be read back in by a potentially differing version of the
library. In the case of sfio however, this use case was not possible because
the structure contains function pointers.
I believe these were used by Kiem-Phong Vo to remind themselves to expose these
definitions unconditionally in future. However, it seems they were never
followed up on. We remove them now to ease ongoing maintenance.
As of the previous commit, the Docker image on which Pylint checks are run in CI
has all Python module dependencies available, so import-error warnings are no
longer an issue. This change adds a build-failing more relaxed Pylint check to
the existing (non-build-failing) one, that only checks for conclusive errors. It
should no longer be possible to introduce broken Python code into Graphviz –
even when it is uncalled – without breaking CI.
remove MarkupSafe as a claimed dependency of doc/infosrc
Nothing in Graphviz uses MarkupSafe. Its last use was removed in 38e3b019bb1b73f273beec66ee2d79e814a97251, but it was incorrectly left behind as
a dependency. I only discovered this by trying to use
doc/infosrc/requirements.txt and finding that MarkupSafe 1.0 is uninstallable.
This is a configuration option to
SparseMatrix_from_coordinate_arrays_not_compacted that is never used. The
leading comment that is also removed in this commit seems to have been a
mistake. If refers to incorrect constants, repeats variables, and contains
numerous typographical errors.
change the always pass test to a simple Graphviz test
The test now uses the existing C API to render SVG from DOT source
code.
To support this, the commit also adds the necessary Graphviz libraries
and the dot_builtins to the common test library and the necessary
include directories to the macro creating the individual test
executables.
don't disable leak detection for ctest based tests
The current test does not trigger any memory leaks and we want to
ensure that we don't introduce any new leaks and fix existing leaks as
new tests encounter them.
We still want leak detection disabled when running pytest since those
tests still trigger many memory leaks.
This is accomplished by moving the disabling of the leak detection
into the test template and performing it after ctest has been
executed, but before pytest executes.
This commit also makes the temporary disabling of ODR violation
bacause of lib/ortho to be selectively for ctest only.
This adds a new test template that is based on the default test
template, but replaces the script section in order to be able to set
up and execute ctest without affecting tests on older OSes.
archive all shared libraries in Ubuntu 21.04 build for ctest
The Ubuntu 21.04 build is renamed and modified to be able to run
ctest, which uses the build products directly from where they reside
before installing them.
Adds archiving of all shared libraries produced directly by "cmake
--build". In the test stage, the test executables load them from those
directory locations since LD_LIBRARY_PATH is automatically set up to
contain them.
add optional ctest & catch2 based test infrastructure
This commit adds a CMakeLists.txt in the tests directory containing
the foundation for easily creating new test executables. It includes
creation of a shared library that the individual test executables can
be linked to, allowing them to be as small as possible.
The tests are optional and can be enabled with the CMake option
with_cxx_tests.
Also added is a first simple test case that always passes to show how
to create test cases.
fix incorrect reference counting of HTML-like strings in gvpack
When duplicating graph attributes, gvpack was calling agstrdup_html to construct
an HTML-like string and then agattr/agset to assign this to an attribute. It did
not anticipate that *both* of these increment the reference count for the string
that has been interned in the graph’s dictionary. The result was a reference
count of 2 for a new HTML-like string, despite only 1 reference to the string
existing.
This was not directly visible to users (hence no changelog entry for this
commit) and the extra reference counts are disposed of when the graph itself is
destroyed. However, this persistent off-by-one issue internally confused some
debugging and potentially retained memory longer than was necessary. The issue
was visible with the following patch applied:
gv2gxl: in GXL output, indicate when a label originated as an HTML like label
When translating Dot to GXL, labels come out as strings. Input something like:
`label="foo"` and the GXL output is something like
`<attr name="label"><string>foo</string></attr>`. This translation is fine and
works well, until you start using HTML like labels.
Graphviz allows `<` and `>` as delimiters to indicate your label string contains
HTML that should be parsed. When you try to use this feature in combination with
gv2gxl, you get a lossy translation. E.g. the labels `label="foo"` and
`label=<foo>` come out identically in GXL.
This commit makes use of the GXL ‘kind’ field on attributes to note that the
source was an HTML like label. If you translate the two labels from above, you
will now get:
This is a partial fix for #517. This makes the translation to GXL no longer
lossy. The other half of this is recognizing the ‘kind’ field during gxl2gv
translation and preserving it on the way back.
These functions are used extensively within Graphviz. This change tells the
compiler to optimize for the case when allocation succeeds. This may slow the
case when allocation fails, though we do not care about this case as Graphviz is
about to exit with failure in this scenario.
Nothing in the build system(s) define this. A lot of this also looks broken.
For example, the GVIEWER alternative of the stress_model function sets up an
argv whose first string entry is not terminated.
The last use of gvfwrite was removed in 6e818420cf02ad01d9c976b69d49fb794a661f5e. But more problematically, this
function seems incorrect. By ignoring its size argument it will generate
surprising results if ever called with a non-1 size. Closes #1846.