summaryrefslogtreecommitdiff
path: root/unittests/helpers.py
diff options
context:
space:
mode:
authorLei YU <yulei.sh@bytedance.com>2023-08-30 06:47:14 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2023-09-25 16:25:01 +0300
commit8d6b474bf67bb8a75e8f60196f7eaf7528a85c62 (patch)
tree1a5d56603a4e64c6878577ba45fb3af15ebf2fd8 /unittests/helpers.py
parentf20f33149495b5b43bba5f06aa5b9ff4ee59a474 (diff)
downloadmeson-8d6b474bf67bb8a75e8f60196f7eaf7528a85c62.tar.gz
Add clang-tidy-fix target
Add the `clang-tidy-fix` target to apply clang-tidy fixes to the source code. This is done by calling `run-clang-tidy` with `-fix` argument. Add a test case to run `clang-tidy-fix` and verify the file is changed. Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Diffstat (limited to 'unittests/helpers.py')
-rw-r--r--unittests/helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/unittests/helpers.py b/unittests/helpers.py
index 7483f51b7..83327cbad 100644
--- a/unittests/helpers.py
+++ b/unittests/helpers.py
@@ -12,7 +12,7 @@ from contextlib import contextmanager
from mesonbuild.compilers import detect_c_compiler, compiler_from_language
from mesonbuild.mesonlib import (
MachineChoice, is_osx, is_cygwin, EnvironmentException, OptionKey, MachineChoice,
- OrderedSet
+ OrderedSet, quiet_git
)
from run_tests import get_fake_env
@@ -135,6 +135,9 @@ def is_tarball():
return True
return False
+def is_git_repo():
+ return quiet_git(['branch'], '.')[0]
+
@contextmanager
def chdir(path: str):
curdir = os.getcwd()