From: Matthew Fernandez Date: Sat, 19 Feb 2022 20:41:08 +0000 (-0800) Subject: add a test case demonstrating a GVPR regression X-Git-Tag: 3.0.0~19^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1da00aa1f2517159436a88304daf45067b9b1505;p=graphviz add a test case demonstrating a GVPR regression --- diff --git a/rtest/test_regression.py b/rtest/test_regression.py index fe7d515f2..908358529 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1536,3 +1536,24 @@ def test_bitarray(): cflags += ["-std=gnu99", "-Wall", "-Wextra", "-Werror"] _, _ = run_c(src, cflags=cflags) + +@pytest.mark.xfail(strict=True) # FIXME +@pytest.mark.skipif(shutil.which("gvpr") is None, reason="gvpr not available") +def test_gvpr_usage(): + """ + gvpr usage information should be included when erroring on a malformed command + """ + + # create a temporary directory, under which we know no files will exist + with tempfile.TemporaryDirectory() as tmp: + + # ask GVPR to process a non-existent file + with subprocess.Popen(["gvpr", "-f", "nofile"], stderr=subprocess.PIPE, + cwd=tmp, universal_newlines=True) as p: + _, stderr = p.communicate() + + assert p.returncode != 0, "GVPR accepted a non-existent file" + + # the stderr output should have contained full usage instructions + assert "-o - write output to ; stdout by default" in stderr, \ + "truncated or malformed GVPR usage information"