JDevlieghere updated this revision to Diff 223888.
JDevlieghere added a comment.

We discussed this on IRC a bit and this is my updated proposal for the 
directory names:

- API
- Shell
- Unit

The corresponding targets are `lldb-check-unit` (unchanged), `lldb-check-shell` 
(runs just the FileCheck / ShTests) and `lldb-check-api` (runs just the 
dotest.py tests). I've also added a README to both `API` and `Unit` explaining 
where the actual tests can be found.


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

https://reviews.llvm.org/D68606

Files:
  lldb/lit/API/README.md
  lldb/lit/API/lit.cfg
  lldb/lit/API/lit.site.cfg.in
  lldb/lit/API/lldbtest.py
  lldb/lit/Breakpoint/Inputs/case-sensitive.c
  lldb/lit/Breakpoint/Inputs/debug_addrx.yaml
  lldb/lit/Breakpoint/Inputs/debug_rnglist_basic.yaml
  lldb/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml
  lldb/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml
  lldb/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml
  lldb/lit/Breakpoint/Inputs/implicit_const_form_support.yaml
  lldb/lit/Breakpoint/Inputs/jitbp.cpp
  lldb/lit/Breakpoint/Inputs/ppc64-localentry.s
  lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml
  lldb/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml
  lldb/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml
  lldb/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
  lldb/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file1.dwo.yaml
  lldb/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file2.dwo.yaml
  lldb/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-main.yaml
  lldb/lit/Breakpoint/case-insensitive.test
  lldb/lit/Breakpoint/case-sensitive.test
  lldb/lit/Breakpoint/debug_addrx.test
  lldb/lit/Breakpoint/debug_rnglist_basic.test
  lldb/lit/Breakpoint/debug_rnglist_offset_pair.test
  lldb/lit/Breakpoint/debug_rnglist_rlestartend.test
  lldb/lit/Breakpoint/debug_rnglistx_rlex.test
  lldb/lit/Breakpoint/implicit_const_form_support.test
  lldb/lit/Breakpoint/jitbp_elf.test
  lldb/lit/Breakpoint/ppc64-localentry.test
  lldb/lit/Breakpoint/single-file-split-dwarf.test
  lldb/lit/Breakpoint/split-dwarf-5-addrbase.test
  lldb/lit/Breakpoint/split-dwarf5-debug-stroffsets.test
  lldb/lit/BuildScript/compiler-full-path.test
  lldb/lit/BuildScript/modes.test
  lldb/lit/BuildScript/script-args.test
  lldb/lit/BuildScript/toolchain-clang-cl.test
  lldb/lit/BuildScript/toolchain-clang.test
  lldb/lit/BuildScript/toolchain-msvc.test
  lldb/lit/CMakeLists.txt
  
lldb/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputConsole.test
  
lldb/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test
  lldb/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py
  lldb/lit/Commands/CommandScriptImmediateOutput/lit.local.cfg
  lldb/lit/Commands/Inputs/frame.py
  lldb/lit/Commands/Inputs/main.c
  lldb/lit/Commands/command-backtrace.test
  lldb/lit/Commands/command-regex-delete.test
  lldb/lit/Commands/command-regex-unalias.test
  lldb/lit/Commands/command-script-import.test
  lldb/lit/Commands/command-source.test
  lldb/lit/Driver/Inputs/.lldbinit
  lldb/lit/Driver/Inputs/Print0.in
  lldb/lit/Driver/Inputs/Print2.in
  lldb/lit/Driver/Inputs/Print4.in
  lldb/lit/Driver/Inputs/Print6.in
  lldb/lit/Driver/Inputs/convenience.in
  lldb/lit/Driver/Inputs/hello.c
  lldb/lit/Driver/Inputs/hello.cpp
  lldb/lit/Driver/Inputs/process_attach_pid.in
  lldb/lit/Driver/Inputs/syntax_error.py
  lldb/lit/Driver/LocalLLDBInit.test
  lldb/lit/Driver/TestCommands.test
  lldb/lit/Driver/TestConvenienceVariables.test
  lldb/lit/Driver/TestCore.test
  lldb/lit/Driver/TestFile.test
  lldb/lit/Driver/TestNoUseColor.test
  lldb/lit/Driver/TestProcessAttach.test
  lldb/lit/Driver/TestRepl.test
  lldb/lit/Driver/TestSingleQuote.test
  lldb/lit/Driver/TestTarget.test
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
  lldb/lit/ExecControl/StopHook/Inputs/stop-hook.c
  lldb/lit/ExecControl/StopHook/stop-hook-threads.test
  lldb/lit/ExecControl/StopHook/stop-hook.test
  lldb/lit/Expr/Inputs/call-function.cpp
  lldb/lit/Expr/Inputs/ir-memory-map-basic
  lldb/lit/Expr/Inputs/ir-memory-map-mix-malloc-free
  lldb/lit/Expr/Inputs/ir-memory-map-overlap1
  lldb/lit/Expr/TestIRMemoryMap.test
  lldb/lit/Expr/TestIRMemoryMapWindows.test
  lldb/lit/Expr/TestMultilineExpr.test
  lldb/lit/Expr/TestTypeOfDeclTypeExpr.test
  lldb/lit/Heap/Inputs/cstr.c
  lldb/lit/Heap/heap-cstr.test
  lldb/lit/Host/Inputs/simple.c
  lldb/lit/Host/TestCustomShell.test
  lldb/lit/Minidump/Inputs/linux-x86_64.syms
  lldb/lit/Minidump/Inputs/linux-x86_64.yaml
  lldb/lit/Minidump/Windows/Inputs/find-module.dmp.yaml
  lldb/lit/Minidump/Windows/Inputs/find-module.exe.yaml
  lldb/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.cpp
  lldb/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.dmp
  lldb/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.lldbinit
  lldb/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.pdb
  lldb/lit/Minidump/Windows/Sigsegv/sigsegv.test
  lldb/lit/Minidump/Windows/find-module.test
  lldb/lit/Minidump/breakpad-symbols.test
  lldb/lit/Minidump/disassemble-no-module.yaml
  lldb/lit/Minidump/dump-all.test
  lldb/lit/Minidump/fb-dump.test
  lldb/lit/Minidump/lit.local.cfg
  lldb/lit/ObjectFile/Breakpad/Inputs/bad-module-id-1.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/bad-module-id-2.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/bad-module-id-3.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/discontiguous-sections.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/identification-linux.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/identification-macosx-arm64e.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/identification-macosx.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/identification-windows.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/sections-trailing-func.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/sections.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/uuid-matching-mac.syms
  lldb/lit/ObjectFile/Breakpad/Inputs/uuid-matching-mac.yaml
  lldb/lit/ObjectFile/Breakpad/breakpad-identification.test
  lldb/lit/ObjectFile/Breakpad/discontiguous-sections.test
  lldb/lit/ObjectFile/Breakpad/lit.local.cfg
  lldb/lit/ObjectFile/Breakpad/sections-trailing-func.test
  lldb/lit/ObjectFile/Breakpad/sections.test
  lldb/lit/ObjectFile/Breakpad/uuid-matching-mac.test
  lldb/lit/ObjectFile/ELF/Inputs/PT_LOAD-overlap-section.elf
  lldb/lit/ObjectFile/ELF/Inputs/minidebuginfo-main.c
  lldb/lit/ObjectFile/ELF/Inputs/netbsd-amd64.core
  lldb/lit/ObjectFile/ELF/PT_LOAD-empty.yaml
  lldb/lit/ObjectFile/ELF/PT_LOAD-overlap-PT_INTERP.yaml
  lldb/lit/ObjectFile/ELF/PT_LOAD-overlap-PT_TLS.yaml
  lldb/lit/ObjectFile/ELF/PT_LOAD-overlap-section.yaml
  lldb/lit/ObjectFile/ELF/PT_LOAD-overlap.yaml
  lldb/lit/ObjectFile/ELF/PT_LOAD.yaml
  lldb/lit/ObjectFile/ELF/PT_TLS-overlap-PT_LOAD.yaml
  lldb/lit/ObjectFile/ELF/aarch64-relocations.yaml
  lldb/lit/ObjectFile/ELF/base-address.yaml
  lldb/lit/ObjectFile/ELF/basic-info.yaml
  lldb/lit/ObjectFile/ELF/build-id-case.yaml
  lldb/lit/ObjectFile/ELF/compressed-sections.yaml
  lldb/lit/ObjectFile/ELF/duplicate-section.yaml
  lldb/lit/ObjectFile/ELF/gnu-debuglink.yaml
  lldb/lit/ObjectFile/ELF/many-sections.s
  lldb/lit/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml
  lldb/lit/ObjectFile/ELF/minidebuginfo-find-symbols.yaml
  lldb/lit/ObjectFile/ELF/minidebuginfo-no-lzma.yaml
  lldb/lit/ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test
  lldb/lit/ObjectFile/ELF/netbsd-core-amd64.test
  lldb/lit/ObjectFile/ELF/netbsd-exec-8.99.30-amd64.yaml
  lldb/lit/ObjectFile/ELF/section-addresses.yaml
  lldb/lit/ObjectFile/ELF/section-overlap.yaml
  lldb/lit/ObjectFile/ELF/section-permissions.yaml
  lldb/lit/ObjectFile/ELF/section-types-edgecases.yaml
  lldb/lit/ObjectFile/ELF/section-types.yaml
  lldb/lit/ObjectFile/ELF/short-build-id.yaml
  lldb/lit/ObjectFile/MachO/lc_build_version.yaml
  lldb/lit/ObjectFile/MachO/lc_build_version_notools.yaml
  lldb/lit/ObjectFile/MachO/lc_version_min.yaml
  lldb/lit/ObjectFile/MachO/subsections.yaml
  lldb/lit/ObjectFile/PECOFF/basic-info-arm.yaml
  lldb/lit/ObjectFile/PECOFF/basic-info-arm64.yaml
  lldb/lit/ObjectFile/PECOFF/basic-info.yaml
  lldb/lit/ObjectFile/PECOFF/dep-modules.yaml
  lldb/lit/ObjectFile/PECOFF/export-dllfunc.yaml
  lldb/lit/ObjectFile/PECOFF/lit.local.cfg
  lldb/lit/ObjectFile/PECOFF/sections-names.yaml
  lldb/lit/ObjectFile/PECOFF/subsections.yaml
  lldb/lit/ObjectFile/PECOFF/uuid.yaml
  lldb/lit/ObjectFile/lit.local.cfg
  lldb/lit/Process/Inputs/env.cpp
  lldb/lit/Process/TestEnvironment.test
  lldb/lit/Process/Windows/exception_access_violation.cpp
  lldb/lit/Python/crashlog.test
  lldb/lit/Quit/TestQuitExitCode-30.test
  lldb/lit/Quit/TestQuitExitCode0.test
  lldb/lit/Quit/TestQuitExitCode30.test
  lldb/lit/Quit/TestQuitExitCodeHex0.test
  lldb/lit/Quit/TestQuitExitCodeHexA.test
  lldb/lit/Quit/TestQuitExitCodeImplicit0.test
  lldb/lit/Quit/TestQuitExitCodeNonInt.test
  lldb/lit/Quit/TestQuitExitCodeTooManyArgs.test
  lldb/lit/Quit/expect_exit_code.py
  lldb/lit/Register/Inputs/x86-64-gp-read.cpp
  lldb/lit/Register/Inputs/x86-64-gp-write.cpp
  lldb/lit/Register/Inputs/x86-64-read.cpp
  lldb/lit/Register/Inputs/x86-64-write.cpp
  lldb/lit/Register/Inputs/x86-gp-read.cpp
  lldb/lit/Register/Inputs/x86-gp-write.cpp
  lldb/lit/Register/Inputs/x86-mm-xmm-read.cpp
  lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
  lldb/lit/Register/Inputs/x86-ymm-read.cpp
  lldb/lit/Register/Inputs/x86-ymm-write.cpp
  lldb/lit/Register/Inputs/x86-zmm-read.cpp
  lldb/lit/Register/Inputs/x86-zmm-write.cpp
  lldb/lit/Register/x86-64-gp-read.test
  lldb/lit/Register/x86-64-gp-write.test
  lldb/lit/Register/x86-64-read.test
  lldb/lit/Register/x86-64-write.test
  lldb/lit/Register/x86-64-xmm16-read.test
  lldb/lit/Register/x86-64-xmm16-write.test
  lldb/lit/Register/x86-64-ymm-read.test
  lldb/lit/Register/x86-64-ymm-write.test
  lldb/lit/Register/x86-64-ymm16-read.test
  lldb/lit/Register/x86-64-ymm16-write.test
  lldb/lit/Register/x86-64-zmm-read.test
  lldb/lit/Register/x86-64-zmm-write.test
  lldb/lit/Register/x86-gp-read.test
  lldb/lit/Register/x86-gp-write.test
  lldb/lit/Register/x86-mm-xmm-read.test
  lldb/lit/Register/x86-mm-xmm-write.test
  lldb/lit/Register/x86-ymm-read.test
  lldb/lit/Register/x86-ymm-write.test
  lldb/lit/Register/x86-zmm-read.test
  lldb/lit/Register/x86-zmm-write.test
  lldb/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
  lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp
  lldb/lit/Reproducer/Functionalities/Inputs/stepping.c
  lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
  lldb/lit/Reproducer/Functionalities/TestImageList.test
  lldb/lit/Reproducer/Functionalities/TestStepping.test
  lldb/lit/Reproducer/Inputs/FileCapture.in
  lldb/lit/Reproducer/Inputs/GDBRemoteCapture.in
  lldb/lit/Reproducer/Inputs/simple.c
  lldb/lit/Reproducer/Modules/Inputs/Bar.h
  lldb/lit/Reproducer/Modules/Inputs/Foo.h
  lldb/lit/Reproducer/Modules/Inputs/ModuleCXX.in
  lldb/lit/Reproducer/Modules/Inputs/main.cpp
  lldb/lit/Reproducer/Modules/Inputs/module.modulemap
  lldb/lit/Reproducer/Modules/TestModuleCXX.test
  lldb/lit/Reproducer/TestDriverOptions.test
  lldb/lit/Reproducer/TestDump.test
  lldb/lit/Reproducer/TestFileRepro.test
  lldb/lit/Reproducer/TestGDBRemoteRepro.test
  lldb/lit/Reproducer/TestRelativePath.test
  lldb/lit/Reproducer/TestReuseDirectory.test
  lldb/lit/Reproducer/TestSynchronous.test
  lldb/lit/Settings/Inputs/DontStopCommandSource.in
  lldb/lit/Settings/Inputs/EchoCommandsAll.out
  lldb/lit/Settings/Inputs/EchoCommandsNoComments.out
  lldb/lit/Settings/Inputs/EchoCommandsNone.out
  lldb/lit/Settings/Inputs/EchoCommandsQuiet.out
  lldb/lit/Settings/Inputs/EchoCommandsTest.in
  lldb/lit/Settings/Inputs/StopCommandSource.in
  lldb/lit/Settings/Inputs/main.c
  lldb/lit/Settings/TestDisableColor.test
  lldb/lit/Settings/TestDisassemblyFormat.test
  lldb/lit/Settings/TestEchoCommands.test
  lldb/lit/Settings/TestFrameFormatColor.test
  lldb/lit/Settings/TestFrameFormatNoColor.test
  lldb/lit/Settings/TestModuleCacheSanity.test
  (624 more files...)

Index: lldb/lit/lit.cfg.py
===================================================================
--- lldb/lit/lit.cfg.py
+++ lldb/lit/lit.cfg.py
@@ -13,11 +13,12 @@
 from lit.llvm.subst import ToolSubst
 from distutils.spawn import find_executable
 
-site.addsitedir(os.path.dirname(__file__))
-from helper import toolchain
+# This is the top level configuration. Most of these configuration options will
+# be overriden by individual lit configuration files in the test
+# subdirectories.
 
 # name: The name of this test suite.
-config.name = 'LLDB'
+config.name = 'lldb'
 
 # testFormat: The test format to use to interpret tests.
 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
@@ -37,71 +38,4 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
 
-
 llvm_config.use_default_substitutions()
-
-toolchain.use_lldb_substitutions(config)
-
-toolchain.use_support_substitutions(config)
-
-
-if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
-    config.available_features.add("armhf-linux")
-
-def calculate_arch_features(arch_string):
-    # This will add a feature such as x86, arm, mips, etc for each built
-    # target
-    features = []
-    for arch in arch_string.split():
-        features.append(arch.lower())
-    return features
-
-# Run llvm-config and add automatically add features for whether we have
-# assertions enabled, whether we are in debug mode, and what targets we
-# are built for.
-llvm_config.feature_config(
-    [('--assertion-mode', {'ON': 'asserts'}),
-     ('--build-mode', {'DEBUG': 'debug'}),
-     ('--targets-built', calculate_arch_features)
-     ])
-
-# Clean the module caches in the test build directory. This is necessary in an
-# incremental build whenever clang changes underneath, so doing it once per
-# lit.py invocation is close enough.
-for cachedir in [config.clang_module_cache, config.lldb_module_cache]:
-    if os.path.isdir(cachedir):
-        print("Deleting module cache at %s."%cachedir)
-        shutil.rmtree(cachedir)
-
-# Set a default per-test timeout of 10 minutes. Setting a timeout per test
-# requires that killProcessAndChildren() is supported on the platform and
-# lit complains if the value is set but it is not supported.
-supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
-if supported:
-    lit_config.maxIndividualTestTime = 600
-else:
-    lit_config.warning("Could not set a default per-test timeout. " + errormsg)
-
-
-# If running tests natively, check for CPU features needed for some tests.
-
-if 'native' in config.available_features:
-    cpuid_exe = lit.util.which('lit-cpuid', config.lldb_tools_dir)
-    if cpuid_exe is None:
-        lit_config.warning("lit-cpuid not found, tests requiring CPU extensions will be skipped")
-    else:
-        out, err, exitcode = lit.util.executeCommand([cpuid_exe])
-        if exitcode == 0:
-            for x in out.split():
-                config.available_features.add('native-cpu-%s' % x)
-        else:
-            lit_config.warning("lit-cpuid failed: %s" % err)
-
-if not config.lldb_disable_python:
-    config.available_features.add('python')
-
-if config.lldb_enable_lzma:
-    config.available_features.add('lzma')
-
-if find_executable('xz') != None:
-    config.available_features.add('xz')
Index: lldb/lit/Unit/lit.cfg.py
===================================================================
--- lldb/lit/Unit/lit.cfg.py
+++ lldb/lit/Unit/lit.cfg.py
@@ -9,7 +9,7 @@
 from lit.llvm import llvm_config
 
 # name: The name of this test suite.
-config.name = 'lldb-Unit'
+config.name = 'lldb-unit'
 
 # suffixes: A list of file extensions to treat as test files.
 config.suffixes =  []
Index: lldb/lit/Unit/README.md
===================================================================
--- /dev/null
+++ lldb/lit/Unit/README.md
@@ -0,0 +1,4 @@
+# LLDB Unit Tests
+
+This directory only exists for the lit test driver. The actual tests live in
+the `unittest` directory in top level LLDB directory.
Index: lldb/lit/Shell/lit.site.cfg.py.in
===================================================================
--- lldb/lit/Shell/lit.site.cfg.py.in
+++ lldb/lit/Shell/lit.site.cfg.py.in
@@ -41,4 +41,4 @@
 lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
-lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg.py")
+lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Shell/lit.cfg.py")
Index: lldb/lit/Shell/lit.cfg.py
===================================================================
--- /dev/null
+++ lldb/lit/Shell/lit.cfg.py
@@ -0,0 +1,107 @@
+# -*- Python -*-
+
+import os
+import platform
+import re
+import shutil
+import site
+import sys
+
+import lit.formats
+from lit.llvm import llvm_config
+from lit.llvm.subst import FindTool
+from lit.llvm.subst import ToolSubst
+from distutils.spawn import find_executable
+
+site.addsitedir(os.path.dirname(__file__))
+from helper import toolchain
+
+# name: The name of this test suite.
+config.name = 'lldb-shell'
+
+# testFormat: The test format to use to interpret tests.
+config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
+
+# suffixes: A list of file extensions to treat as test files. This is overriden
+# by individual lit.local.cfg files in the test subdirectories.
+config.suffixes = ['.test', '.cpp', '.s']
+
+# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
+# subdirectories contain auxiliary inputs for various tests in their parent
+# directories.
+config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
+
+# test_source_root: The root path where tests are located.
+config.test_source_root = os.path.dirname(__file__)
+
+# test_exec_root: The root path where tests should be run.
+config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
+
+
+llvm_config.use_default_substitutions()
+
+toolchain.use_lldb_substitutions(config)
+
+toolchain.use_support_substitutions(config)
+
+
+if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
+    config.available_features.add("armhf-linux")
+
+def calculate_arch_features(arch_string):
+    # This will add a feature such as x86, arm, mips, etc for each built
+    # target
+    features = []
+    for arch in arch_string.split():
+        features.append(arch.lower())
+    return features
+
+# Run llvm-config and add automatically add features for whether we have
+# assertions enabled, whether we are in debug mode, and what targets we
+# are built for.
+llvm_config.feature_config(
+    [('--assertion-mode', {'ON': 'asserts'}),
+     ('--build-mode', {'DEBUG': 'debug'}),
+     ('--targets-built', calculate_arch_features)
+     ])
+
+# Clean the module caches in the test build directory. This is necessary in an
+# incremental build whenever clang changes underneath, so doing it once per
+# lit.py invocation is close enough.
+for cachedir in [config.clang_module_cache, config.lldb_module_cache]:
+    if os.path.isdir(cachedir):
+        print("Deleting module cache at %s."%cachedir)
+        shutil.rmtree(cachedir)
+
+# Set a default per-test timeout of 10 minutes. Setting a timeout per test
+# requires that killProcessAndChildren() is supported on the platform and
+# lit complains if the value is set but it is not supported.
+supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
+if supported:
+    lit_config.maxIndividualTestTime = 600
+else:
+    lit_config.warning("Could not set a default per-test timeout. " + errormsg)
+
+
+# If running tests natively, check for CPU features needed for some tests.
+
+if 'native' in config.available_features:
+    cpuid_exe = lit.util.which('lit-cpuid', config.lldb_tools_dir)
+    if cpuid_exe is None:
+        lit_config.warning("lit-cpuid not found, tests requiring CPU extensions will be skipped")
+    else:
+        out, err, exitcode = lit.util.executeCommand([cpuid_exe])
+        if exitcode == 0:
+            for x in out.split():
+                config.available_features.add('native-cpu-%s' % x)
+        else:
+            lit_config.warning("lit-cpuid failed: %s" % err)
+
+if not config.lldb_disable_python:
+    config.available_features.add('python')
+
+if config.lldb_enable_lzma:
+    config.available_features.add('lzma')
+
+if find_executable('xz') != None:
+    config.available_features.add('xz')
Index: lldb/lit/Shell/helper/toolchain.py
===================================================================
--- lldb/lit/Shell/helper/toolchain.py
+++ lldb/lit/Shell/helper/toolchain.py
@@ -29,7 +29,7 @@
     if config.llvm_libs_dir:
         build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 
-    lldb_init = os.path.join(config.test_exec_root, 'lit-lldb-init')
+    lldb_init = os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
 
     primary_tools = [
         ToolSubst('%lldb',
Index: lldb/lit/Shell/Python/crashlog.test
===================================================================
--- lldb/lit/Shell/Python/crashlog.test
+++ lldb/lit/Shell/Python/crashlog.test
@@ -1,6 +1,6 @@
 #                                                                 -*- python -*-
 # REQUIRES: system-darwin
-# RUN: cd %S/../../examples/python && cat %s | %lldb | FileCheck %s
+# RUN: cd %S/../../../examples/python && cat %s | %lldb | FileCheck %s
 # CHECK-LABEL: {{S}}KIP BEYOND CHECKS
 script
 import crashlog
@@ -44,7 +44,7 @@
 # CHECK: (0)
 # CHECK: 01234
 # CHECK: /tmp/MyApp Pro.app/MyApp Pro
-    
+
 "0x7fff63f20000 - 0x7fff63f77ff7  libc++.1.dylib (400.9.4) /usr/lib/libc++.1.dylib"
 # CHECK: 0x7fff63f20000
 # CHECK: 0x7fff63f77ff7
Index: lldb/lit/CMakeLists.txt
===================================================================
--- lldb/lit/CMakeLists.txt
+++ lldb/lit/CMakeLists.txt
@@ -75,22 +75,22 @@
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Shell/lit.site.cfg.py
   MAIN_CONFIG
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+  ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit.cfg.py)
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
   MAIN_CONFIG
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py)
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg)
+  ${CMAKE_CURRENT_SOURCE_DIR}/API/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/API/lit.site.cfg)
 
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
+  ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit-lldb-init.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Shell/lit-lldb-init)
 
 if(NOT LLDB_BUILT_STANDALONE)
   list(APPEND LLDB_TEST_DEPS
Index: lldb/lit/API/lit.site.cfg.in
===================================================================
--- lldb/lit/API/lit.site.cfg.in
+++ lldb/lit/API/lit.site.cfg.in
@@ -43,4 +43,4 @@
     lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
 
 # Let the main config do the real work.
-lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Suite/lit.cfg")
+lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/API/lit.cfg")
Index: lldb/lit/API/lit.cfg
===================================================================
--- lldb/lit/API/lit.cfg
+++ lldb/lit/API/lit.cfg
@@ -9,7 +9,7 @@
 import lit.formats
 
 # name: The name of this test suite.
-config.name = 'lldb-Suite'
+config.name = 'lldb-api'
 
 # suffixes: A list of file extensions to treat as test files.
 config.suffixes = ['.py']
@@ -73,7 +73,7 @@
   dotest_cmd += ['--module-cache-dir', config.lldb_module_cache]
 
 # Load LLDB test format.
-sys.path.append(os.path.join(config.lldb_src_root, "lit", "Suite"))
+sys.path.append(os.path.join(config.lldb_src_root, "lit", "API"))
 import lldbtest
 
 # testFormat: The test format to use to interpret tests.
Index: lldb/lit/API/README.md
===================================================================
--- /dev/null
+++ lldb/lit/API/README.md
@@ -0,0 +1,4 @@
+# LLDB API Tests
+
+This directory only exists for the lit test driver. The actual tests live in
+the `tests` directory in top level LLDB directory.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to