From: Jonas Devlieghere Date: Mon, 5 Mar 2018 10:03:44 +0000 (+0000) Subject: [test] Add dotest wrapper X-Git-Tag: llvmorg-7.0.0-rc1~11428 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a52cb80db6b6d7429e9364c2d852b51d051464bf;p=platform%2Fupstream%2Fllvm.git [test] Add dotest wrapper This adds a wrapper around dotest, similar to llvm-lit in llvm. The wrapper is created in the binary directory, next to LLDB and allows you to invoke dotest without having to pass any of the configuration arguments yourself. I think this could also be useful for re-running a particular test case when it fails, as an alternative to "Command Invoked". The motivation for this is that I'd like to replace the driver part of dotest with lit. As a first step, I'd like to have lit invoke dotest, which would just run the complete test suite, completely identical to what the CMake target does today. Once this is in place, we can have lit run dotest for the different test directories, and ultimately once per python file. Along the way we can strip out driver functionality from dotest where appropriate. https://reviews.llvm.org/D44002 llvm-svn: 326687 --- diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index d41e75f..38a50a9 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -25,7 +25,7 @@ endif() if(TARGET lldb-server) list(APPEND LLDB_TEST_DEPS lldb-server) endif() - + if(TARGET debugserver) if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY) list(APPEND LLDB_TEST_DEPS debugserver) @@ -78,7 +78,7 @@ set(LLDB_TEST_COMMON_ARGS if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) # All tests are currently flaky on Windows, so rerun them all once when they fail. set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --rerun-all-issues) - + set(LLDB_TEST_DEBUG_TEST_CRASHES 0 CACHE BOOL "(Windows only) Enables debugging of tests in the test suite by showing the crash dialog when lldb crashes") @@ -129,6 +129,21 @@ add_python_test_target(check-lldb "Testing LLDB (parallel execution, with a separate subprocess per test)" ) +# Generate a wrapper for dotest.py in the bin directory. +string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR "${LLDB_DOTEST_ARGS}") +# We need this to substitute variables. +configure_file( + llvm-dotest.in + ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured + ) +# We need this to expand the generator expressions. +file(GENERATE + OUTPUT + $/llvm-dotest + INPUT + ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured + ) + # If we're building with an in-tree clang, then list clang as a dependency # to run tests. if (TARGET clang) diff --git a/lldb/test/llvm-dotest.in b/lldb/test/llvm-dotest.in new file mode 100755 index 0000000..b6a1080 --- /dev/null +++ b/lldb/test/llvm-dotest.in @@ -0,0 +1,14 @@ +#!/usr/bin/env python +import sys +import os + +dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py' +dotest_args = '@LLDB_DOTEST_ARGS_STR@' + +if __name__ == '__main__': + # FIXME: It would be nice if we can mimic the approach taken by llvm-lit + # and pass a python configuration straight to dotest, rather than going + # through the operating system. + command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join( + sys.argv[1:])) + os.system(command)