From 991677207b43a45b3419fa614095500b550b2cbe Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 20 Jan 2023 12:21:49 -0500 Subject: [PATCH] =?UTF-8?q?Documentation=20update=20and=20make=20the=20gol?= =?UTF-8?q?den=20image=20error=20message=20point=20to=E2=80=A6=20(#24490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Documentation update and make the golden image error message point to docs and command to run * Restyle * Undo file change that was made to test the error reporting * Fix typo s/regenerata/regenerate --- docs/code_generation.md | 7 +++++++ scripts/tools/zap/test_generate.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/docs/code_generation.md b/docs/code_generation.md index 57dc512a1f7055..58c3474881fad2 100644 --- a/docs/code_generation.md +++ b/docs/code_generation.md @@ -286,3 +286,10 @@ replacement during running of `ninja check`. ```shell ZAP_GENERATE_GOLDEN_REGENERATE=1 ninja check ``` + +Alternatively, the golden image can also be re-generated by running the +stand-alone test in a bootstrapped environment: + +```shell +./scripts/tools/zap/test_generate.py --output out/gen --regenerate +``` diff --git a/scripts/tools/zap/test_generate.py b/scripts/tools/zap/test_generate.py index 73353ee0e51f4e..ce18acc2fca397 100755 --- a/scripts/tools/zap/test_generate.py +++ b/scripts/tools/zap/test_generate.py @@ -122,6 +122,12 @@ def run_test_cases(self, checker: unittest.TestCase): f"Copying updated golden image from {actual} to {expected}") subprocess.check_call(["cp", actual, expected]) else: + print("*"*80) + print("* Golden image regeneration seems to have failed.") + print("* Documentation regarding code-generation logic available at docs/code_generation.md") + print("*\n* Specifically to update golden images, you may want to run:") + print("*\n* ./scripts/tools/zap/test_generate.py --output out/gen --regenerate") + print("*\n" + "*"*80) raise