From: Matthew Fernandez Date: Sat, 29 May 2021 22:42:19 +0000 (-0700) Subject: add a test case for gvmap crash X-Git-Tag: 2.47.3~14^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fea63b06d6f1639eb006134975a4c861c0fe814;p=graphviz add a test case for gvmap crash As discussed on #1822, gvmap currently crashes sometimes. It seems this is not input dependent, but rather platform dependent. A fix will arrive in an upcoming commit. --- diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 71c6f3f68..326340382 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -948,3 +948,39 @@ def test_vcxproj_inclusive(vcxproj: Path): assert srcs1 == srcs2, \ "mismatch between sources in {str(vcxproj)} and {str(filters)}" + +@pytest.mark.xfail() +@pytest.mark.skipif(shutil.which("gvmap") is None, reason="gvmap not available") +def test_gvmap_fclose(): + """ + gvmap should not attempt to fclose(NULL). This example will trigger a crash if + this bug has been reintroduced and Graphviz is built with ASan support. + """ + + # a reasonable input graph + input = 'graph "Alík: Na vlastní oči" {\n' \ + ' graph [bb="0,0,128.9,36",\n' \ + ' concentrate=true,\n' \ + ' overlap=prism,\n' \ + ' start=3\n' \ + ' ];\n' \ + ' node [label="\\N"];\n' \ + ' {\n' \ + ' bob [height=0.5,\n' \ + ' pos="100.95,18",\n' \ + ' width=0.77632];\n' \ + ' }\n' \ + ' {\n' \ + ' alice [height=0.5,\n' \ + ' pos="32.497,18",\n' \ + ' width=0.9027];\n' \ + ' }\n' \ + ' alice -- bob [pos="65.119,18 67.736,18 70.366,18 72.946,18"];\n' \ + ' bob -- alice;\n' \ + '}' + + # pass this through gvmap + p = subprocess.Popen(["gvmap"], stdin=subprocess.PIPE) + p.communicate(input.encode("utf-8")) + + assert p.returncode == 0