[clang] caeef19 - [analyzer] Allow cmake options to be passed to satest container
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 25 02:15:57 PDT 2021
Author: Manas
Date: 2021-10-25T11:15:40+02:00
New Revision: caeef1995ab47387fa8da3e958afc5637b4e893d
URL: https://github.com/llvm/llvm-project/commit/caeef1995ab47387fa8da3e958afc5637b4e893d
DIFF: https://github.com/llvm/llvm-project/commit/caeef1995ab47387fa8da3e958afc5637b4e893d.diff
LOG: [analyzer] Allow cmake options to be passed to satest container
This patch selects all cmake options and passes them to global cmake
command while building LLVM inside satest docker container.
Prior to this, the cmake command was hard-coded and this would consume
a huge amount of memory while building. There was no support to pass
extra cmake options for the build, except for changing the command
manually. This patch allows testers to pass all "-D*" cmake options to
the build.
Reviewed By: vsavchenko
Differential Revision: https://reviews.llvm.org/D105447
Patch by: @manas (Manas Gupta)
Added:
Modified:
clang/utils/analyzer/entrypoint.py
Removed:
################################################################################
diff --git a/clang/utils/analyzer/entrypoint.py b/clang/utils/analyzer/entrypoint.py
index 9c84431da5482..b61f0d5192946 100644
--- a/clang/utils/analyzer/entrypoint.py
+++ b/clang/utils/analyzer/entrypoint.py
@@ -9,10 +9,11 @@
def main():
settings, rest = parse_arguments()
+ cmake_opts = ['-D' + cmd for cmd in settings.D]
if settings.wait:
wait()
if settings.build_llvm or settings.build_llvm_only:
- build_llvm()
+ build_llvm(cmake_opts)
if settings.build_llvm_only:
return
sys.exit(test(rest))
@@ -30,14 +31,15 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]:
parser.add_argument('--wait', action='store_true')
parser.add_argument('--build-llvm', action='store_true')
parser.add_argument('--build-llvm-only', action='store_true')
+ parser.add_argument('-D', action='append', default=[])
return parser.parse_known_args()
-def build_llvm():
+def build_llvm(cmake_options):
os.chdir('/build')
try:
if is_cmake_needed():
- cmake()
+ cmake(cmake_options)
ninja()
except CalledProcessError:
print("Build failed!")
@@ -55,8 +57,9 @@ def is_cmake_needed():
"-DCLANG_ENABLE_STATIC_ANALYZER=ON"
-def cmake():
- check_call(CMAKE_COMMAND + ' /llvm-project/llvm', shell=True)
+def cmake(cmake_options):
+ check_call(CMAKE_COMMAND + ' '.join(cmake_options) + ' /llvm-project/llvm',
+ shell=True)
def ninja():
More information about the cfe-commits
mailing list