[Lldb-commits] [PATCH] D151269: [lldb] Pass CMAKE_SYSROOT through to LLDB shell tests

2023-05-26 Thread Daniel Thornburgh via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb22965df1304: [lldb] Pass CMAKE_SYSROOT through to LLDB 
shell tests (authored by mysterymath).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151269/new/

https://reviews.llvm.org/D151269

Files:
  lldb/test/Shell/helper/build.py
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.site.cfg.py.in


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -47,6 +47,8 @@
 build_script_args.append(
 '--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir)
 )
+if config.cmake_sysroot:
+build_script_args.append("--sysroot={0}".format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -160,6 +162,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ["-fmodules-cache-path={}".format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ["--sysroot={}".format(config.cmake_sysroot)]
+
 host_flags = " ".join(host_flags)
 config.substitutions.append(("%clang_host", "%clang " + host_flags))
 config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags))
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -73,6 +73,14 @@
 help="Include and link GNUstep libobjc2 (Windows and Linux only)",
 )
 
+parser.add_argument(
+"--sysroot",
+metavar="directory",
+dest="sysroot",
+required=False,
+help="If specified, a sysroot to be passed via --sysroot",
+)
+
 if sys.platform == "darwin":
 parser.add_argument(
 "--apple-sdk",
@@ -305,6 +313,7 @@
 if args.objc_gnustep_dir
 else None
 )
+self.sysroot = args.sysroot
 
 def _exe_file_name(self):
 assert self.mode != "compile"
@@ -761,6 +770,8 @@
 args.extend(
 ["-Xclang", "-gcodeview", "-Xclang", 
"--dependent-lib=msvcrtd"]
 )
+elif self.sysroot:
+args.extend(["--sysroot", self.sysroot])
 
 if self.std:
 args.append("-std={0}".format(self.std))
@@ -797,6 +808,8 @@
 args.extend(
 ["-fuse-ld=lld-link", "-g", "-Xclang", 
"--dependent-lib=msvcrtd"]
 )
+elif self.sysroot:
+args.extend(["--sysroot", self.sysroot])
 
 return ("linking", self._obj_file_names(), self._exe_file_name(), 
None, args)
 


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -47,6 +47,8 @@
 build_script_args.append(
 '--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir)
 )
+if config.cmake_sysroot:
+build_script_args.append("--sysroot={0}".format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -160,6 +162,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ["-fmodules-cache-path={}".format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ["--sysroot={}".format(config.cmake_sysroot)]
+
 host_flags = " ".join(host_flags)
 config.substitutions.append(("%clang_host", "%clang " + host_flags))
 config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags))
Index: lldb/test/Shell/helper/build.py

[Lldb-commits] [PATCH] D151269: [lldb] Pass CMAKE_SYSROOT through to LLDB shell tests

2023-05-26 Thread Daniel Thornburgh via Phabricator via lldb-commits
mysterymath updated this revision to Diff 526140.
mysterymath added a comment.

Apply black formatting to resolve merge conflict.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151269/new/

https://reviews.llvm.org/D151269

Files:
  lldb/test/Shell/helper/build.py
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.site.cfg.py.in


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -47,6 +47,8 @@
 build_script_args.append(
 '--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir)
 )
+if config.cmake_sysroot:
+build_script_args.append("--sysroot={0}".format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -160,6 +162,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ["-fmodules-cache-path={}".format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ["--sysroot={}".format(config.cmake_sysroot)]
+
 host_flags = " ".join(host_flags)
 config.substitutions.append(("%clang_host", "%clang " + host_flags))
 config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags))
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -73,6 +73,14 @@
 help="Include and link GNUstep libobjc2 (Windows and Linux only)",
 )
 
+parser.add_argument(
+"--sysroot",
+metavar="directory",
+dest="sysroot",
+required=False,
+help="If specified, a sysroot to be passed via --sysroot",
+)
+
 if sys.platform == "darwin":
 parser.add_argument(
 "--apple-sdk",
@@ -305,6 +313,7 @@
 if args.objc_gnustep_dir
 else None
 )
+self.sysroot = args.sysroot
 
 def _exe_file_name(self):
 assert self.mode != "compile"
@@ -761,6 +770,8 @@
 args.extend(
 ["-Xclang", "-gcodeview", "-Xclang", 
"--dependent-lib=msvcrtd"]
 )
+elif self.sysroot:
+args.extend(["--sysroot", self.sysroot])
 
 if self.std:
 args.append("-std={0}".format(self.std))
@@ -797,6 +808,8 @@
 args.extend(
 ["-fuse-ld=lld-link", "-g", "-Xclang", 
"--dependent-lib=msvcrtd"]
 )
+elif self.sysroot:
+args.extend(["--sysroot", self.sysroot])
 
 return ("linking", self._obj_file_names(), self._exe_file_name(), 
None, args)
 


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -47,6 +47,8 @@
 build_script_args.append(
 '--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir)
 )
+if config.cmake_sysroot:
+build_script_args.append("--sysroot={0}".format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -160,6 +162,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ["-fmodules-cache-path={}".format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ["--sysroot={}".format(config.cmake_sysroot)]
+
 host_flags = " ".join(host_flags)
 config.substitutions.append(("%clang_host", "%clang " + host_flags))
 config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags))
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/

[Lldb-commits] [PATCH] D151269: [lldb] Pass CMAKE_SYSROOT through to LLDB shell tests

2023-05-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM. I suspect you'll run into the same problem when you get the API tests 
working, but we can deal with that when the time comes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151269/new/

https://reviews.llvm.org/D151269

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151269: [lldb] Pass CMAKE_SYSROOT through to LLDB shell tests

2023-05-24 Thread Daniel Thornburgh via Phabricator via lldb-commits
mysterymath updated this revision to Diff 525283.
mysterymath added a comment.

Fixed commit message typo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151269/new/

https://reviews.llvm.org/D151269

Files:
  lldb/test/Shell/helper/build.py
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.site.cfg.py.in


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -44,6 +44,8 @@
 build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 if config.objc_gnustep_dir:
 
build_script_args.append('--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir))
+if config.cmake_sysroot:
+build_script_args.append('--sysroot={0}'.format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -140,6 +142,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ['-fmodules-cache-path={}'.format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ['--sysroot={}'.format(config.cmake_sysroot)]
+
 host_flags = ' '.join(host_flags)
 config.substitutions.append(('%clang_host', '%clang ' + host_flags))
 config.substitutions.append(('%clangxx_host', '%clangxx ' + host_flags))
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -61,6 +61,12 @@
 default=False,
 help='Include and link GNUstep libobjc2 (Windows and Linux 
only)')
 
+parser.add_argument('--sysroot',
+metavar='directory',
+dest='sysroot',
+required=False,
+help='If specified, a sysroot to be passed via --sysroot')
+
 if sys.platform == 'darwin':
 parser.add_argument('--apple-sdk',
 metavar='apple_sdk',
@@ -254,6 +260,7 @@
"--objc-gnustep specified without path to libobjc2"
 self.objc_gnustep_inc = os.path.join(args.objc_gnustep_dir, 'include') 
if args.objc_gnustep_dir else None
 self.objc_gnustep_lib = os.path.join(args.objc_gnustep_dir, 'lib') if 
args.objc_gnustep_dir else None
+self.sysroot = args.sysroot
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -679,6 +686,8 @@
 args.extend(['-fobjc-runtime=gnustep-2.0', '-I', 
self.objc_gnustep_inc])
 if sys.platform == "win32":
 args.extend(['-Xclang', '-gcodeview', '-Xclang', 
'--dependent-lib=msvcrtd'])
+elif self.sysroot:
+args.extend(['--sysroot', self.sysroot])
 
 if self.std:
 args.append('-std={0}'.format(self.std))
@@ -713,6 +722,8 @@
 args.extend(['-Wl,-rpath,' + self.objc_gnustep_lib])
 elif sys.platform == 'win32':
 args.extend(['-fuse-ld=lld-link', '-g', '-Xclang', 
'--dependent-lib=msvcrtd'])
+elif self.sysroot:
+args.extend(['--sysroot', self.sysroot])
 
 return ('linking', self._obj_file_names(), self._exe_file_name(), 
None, args)
 


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -44,6 +44,8 @@
 build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 if config.objc_gnustep_dir:
 build_script_args.append('--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir))
+if config.cmake_sysroot:
+build_script_args.append('--sysroot={0}'.form