Make clang-tidy propose diffs

clang-tidy supports a -fix option, which will directly apply the diffs
that it's able to do automatically to the tree.  This is advantageous
for developers, because it gives them a quick way to "do as the robot
commands" when run locally, and makes it more obvious in the output
exactly what's being asked for in a changeset.

Unfortunately, to use this feature, the run-clang-tidy script needs to
be run from the build folder directly, which involves a cd into the
directory.  We actually already had to do this for cmake elsewhere in
this file, but it didn't get propagated to meson builds.

At the same time, when run-clang-tidy fails to run, catch the error and
run the same "git diff" procedure that we run elsewhere such that the
diff is printed to the console.

Tested:
Updated clang-tidy to include a new check for
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50660

and ran run-unit-test-docker.sh, and observed that both the bmcweb tree
had been updated locally, and the diff was printed to the console
output.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I04ef8c136c8e72e7787cebe018cfe2289d7f2c59
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 6f15960..72eb9b5 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -972,8 +972,16 @@
         if os.path.isfile('.clang-tidy'):
             os.environ["CXX"] = "clang++"
             check_call_cmd('meson', 'setup', 'build-clang')
-            check_call_cmd('run-clang-tidy', '-p',
-                           'build-clang')
+            os.chdir("build-clang")
+            try:
+                check_call_cmd('run-clang-tidy', '-fix', '-format', '-p', '.')
+            except subprocess.CalledProcessError:
+                check_call_cmd("git", "-C", CODE_SCAN_DIR,
+                       "--no-pager", "diff")
+                raise
+            finally:
+                os.chdir("..")
+
         # Run the basic clang static analyzer otherwise
         else:
             check_call_cmd('ninja', '-C', 'build',