Skip to content

multispline: add assert of no infinite loop

I don't know if it's desirable to merge this or not, but it causes test_2168 to fail on this assertion instead of waiting for the timeout. At least when debugging #2168 (closed) locally this is very useful.

This is how the failure looks locally with a slightly modified 2168.dot (the second edge removed) and xfail removed:

fdp: /home/magjac/graphviz/lib/neatogen/multispline.c:1057: mkPoly: Assertion `nxt != dad[nxt] && "infinite loop due to 'nxt' not changing"' failed.
FAILED

=================================== FAILURES ===================================
__________________________________ test_2168 ___________________________________

    def test_2168():
        """
        using spline routing should not cause fdp/neato to infinite loop
        https://gitlab.com/graphviz/graphviz/-/issues/2168
        """
    
        # locate our associated test case in this directory
        input = Path(__file__).parent / "2168.dot"
        assert input.exists(), "unexpectedly missing test case"
    
>       subprocess.check_call(["fdp", "-o", os.devnull, input], timeout=5)

tests/test_regression.py:2020: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['fdp', '-o', '/dev/null', PosixPath('/home/magjac/graphviz/tests/2168.dot')],)
kwargs = {'timeout': 5}, retcode = -6
cmd = ['fdp', '-o', '/dev/null', PosixPath('/home/magjac/graphviz/tests/2168.dot')]

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['fdp', '-o', '/dev/null', PosixPath('/home/magjac/graphviz/tests/2168.dot')]' died with <Signals.SIGABRT: 6>.

/usr/lib/python3.10/subprocess.py:369: CalledProcessError
=========================== short test summary info ============================
FAILED tests/test_regression.py::test_2168 - subprocess.CalledProcessError: C...
====================== 1 failed, 291 deselected in 0.49s =======================

GitLab: #2168 (closed)

Merge request reports