Mesa (staging/20.3): glcpp: Handle bison-3.6 error message changes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 19 18:12:24 UTC 2020


Module: Mesa
Branch: staging/20.3
Commit: 0201fc95e7f9fc47687dfa412372f4e2c1a60629
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0201fc95e7f9fc47687dfa412372f4e2c1a60629

Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Nov 17 14:58:24 2020 -0500

glcpp: Handle bison-3.6 error message changes

In bison's commit 72c9fa4510eb (skeletons: use "end of file" instead of
"$end") in bison-3.6, '$end' was changed to 'end of file' in error
messages. Since our glcpp test cases contain the expected output text,
they rely on the particular messages printed by bison. The test case
084-unbalanced-parentheses fails when Mesa is built with bison-3.6 due
to this change.

To allow the test to pass on all supported versions of bison, we:

   1. Change '$end' -> 'end of file' in the .expected file, and
   2. Normalize the error generated by the test case with the same
      replacement

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3181
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7659>
(cherry picked from commit df29d0a111da3a555d8f0751722ca70fe0c5ffc0)

---

 .pick_status.json                                                   | 2 +-
 src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected | 2 +-
 src/compiler/glsl/glcpp/tests/glcpp_test.py                         | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index dcd3a8b20eb..aed27e8cd30 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -121,7 +121,7 @@
         "description": "glcpp: Handle bison-3.6 error message changes",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected
index af49a37369d..6af8033b0a3 100644
--- a/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected
+++ b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected
@@ -1,2 +1,2 @@
-0:2(8): preprocessor error: syntax error, unexpected $end
+0:2(8): preprocessor error: syntax error, unexpected end of file
 
diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py b/src/compiler/glsl/glcpp/tests/glcpp_test.py
index 457bf823612..d3fdc6b27d7 100644
--- a/src/compiler/glsl/glcpp/tests/glcpp_test.py
+++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py
@@ -83,6 +83,10 @@ def test_output(glcpp, filename, expfile, nl_format='\n'):
     with open(expfile, 'r') as f:
         expected = f.read()
 
+    # Bison 3.6 changed '$end' to 'end of file' in its error messages
+    # See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3181
+    actual = actual.replace('$end', 'end of file')
+
     if actual == expected:
         return (True, [])
     return (False, difflib.unified_diff(actual.splitlines(), expected.splitlines()))



More information about the mesa-commit mailing list