From be871fff3cb0dbdb9e158a4d8e9ff5e18b5aa32a Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 21 Dec 2020 18:39:02 -0800 Subject: [PATCH] test case for #1910 --- rtest/1910.c | 19 +++++++++++++++++++ rtest/test_regression.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 rtest/1910.c diff --git a/rtest/1910.c b/rtest/1910.c new file mode 100644 index 000000000..22f874f0e --- /dev/null +++ b/rtest/1910.c @@ -0,0 +1,19 @@ +/* test case for repeated use of agmemread() + * (see test_regression.py:test_1910()) + */ + +#include +#include + +#ifdef NDEBUG + #error "this code is not intended to be compiled with assertions disabled" +#endif + +int main(void) { + + /* we should be able to parse a trivial graph successfully twice */ + assert(agmemread("digraph { a -> b }")); + assert(agmemread("digraph { a -> b }")); + + return 0; +} diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 8f0573f7f..2ca488265 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -588,3 +588,36 @@ def test_1909(): ' a -> b;\n' \ ' b -> c;\n' \ '}\n' + +@pytest.mark.xfail(strict=True) # FIXME +def test_1910(): + ''' + Repeatedly using agmemread() should have consistent results + https://gitlab.com/graphviz/graphviz/-/issues/1910 + ''' + + # FIXME: Remove skip when + # https://gitlab.com/graphviz/graphviz/-/issues/1777 is fixed + if os.getenv('build_system') == 'msbuild': + pytest.skip('Windows MSBuild release does not contain any header files (#1777)') + + # find co-located test source + c_src = os.path.abspath(os.path.join(os.path.dirname(__file__), '1910.c')) + assert os.path.exists(c_src), 'missing test case' + + # create some scratch space to work in + with tempfile.TemporaryDirectory() as tmp: + + # compile our test code + exe = os.path.join(tmp, 'a.exe') + rt_lib_option = '-MDd' if os.environ.get('configuration') == 'Debug' else '-MD' + + if platform.system() == 'Windows': + subprocess.check_call(['cl', c_src, '-Fe:', exe, '-nologo', + rt_lib_option, '-link', 'cgraph.lib', 'gvc.lib']) + else: + cc = os.environ.get('CC', 'cc') + subprocess.check_call([cc, c_src, '-o', exe, '-lcgraph', '-lgvc']) + + # run the test + subprocess.check_call([exe]) -- 2.40.0