Skip to content

Commit 825a39a

Browse files
committed
[build-script] Cleanup the LLDB test phase
This removes some redundant code from the LLDB test phase and simplifies the remaining code. This is the first step in moving the test arguments up to the CMake configuration phase, so we can just run check-lldb.
1 parent c379bdd commit 825a39a

File tree

1 file changed

+26
-46
lines changed

1 file changed

+26
-46
lines changed

utils/build-script-impl

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ KNOWN_SETTINGS=(
5454
cmark-build-type "Debug" "the CMake build variant for CommonMark (Debug, RelWithDebInfo, Release, MinSizeRel). Defaults to Debug."
5555
lldb-extra-cmake-args "" "extra command line args to pass to lldb cmake"
5656
lldb-test-cc "" "CC to use for building LLDB testsuite test inferiors. Defaults to just-built, in-tree clang. If set to 'host-toolchain', sets it to same as host-cc."
57-
lldb-test-with-curses "" "run test lldb test runner using curses terminal control"
5857
lldb-test-swift-only "0" "when running lldb tests, only include Swift-specific tests"
5958
lldb-no-debugserver "" "delete debugserver after building it, and don't try to codesign it"
6059
lldb-use-system-debugserver "" "don't try to codesign debugserver, and use the system's debugserver instead"
@@ -2982,42 +2981,23 @@ for host in "${ALL_HOSTS[@]}"; do
29822981
lldb_build_dir=$(build_directory ${host} lldb)
29832982
swift_build_dir=$(build_directory ${host} swift)
29842983
module_cache="${build_dir}/module-cache"
2985-
29862984
lldb_executable="${lldb_build_dir}"/bin/lldb
29872985
results_dir="${lldb_build_dir}/test-results"
29882986

2989-
# Handle test results formatter
2990-
if [[ "${LLDB_TEST_WITH_CURSES}" ]]; then
2991-
# Setup the curses results formatter.
2992-
LLDB_FORMATTER_OPTS="\
2993-
--results-formatter lldbsuite.test_event.formatter.curses.Curses \
2994-
--results-file /dev/stdout"
2995-
else
2996-
LLDB_FORMATTER_OPTS="\
2997-
--results-formatter lldbsuite.test_event.formatter.xunit.XunitFormatter \
2998-
--results-file ${results_dir}/results.xml \
2999-
-O--xpass=success \
3000-
-O--xfail=success"
3001-
# Setup the xUnit results formatter.
3002-
if [[ "$(uname -s)" != "Darwin" ]] ; then
3003-
# On non-Darwin, we ignore skipped tests entirely
3004-
# so that they don't pollute our xUnit results with
3005-
# non-actionable content.
3006-
LLDB_FORMATTER_OPTS="${LLDB_FORMATTER_OPTS} -O-ndsym -O-rdebugserver -O-rlibc\\\\+\\\\+ -O-rlong.running -O-rbenchmarks -O-rrequires.one?.of.darwin"
3007-
fi
3008-
fi
2987+
LLDB_FORMATTER_OPTS="--results-formatter lldbsuite.test_event.formatter.xunit.XunitFormatter \
2988+
--results-file ${results_dir}/results.xml \
2989+
-O--xpass=success \
2990+
-O--xfail=success"
30092991

3010-
# Optionally specify a test subdirectory and category filters.
3011-
# Watchpoint testing is currently disabled: see rdar://38566150.
3012-
if [[ "$(true_false ${LLDB_TEST_SWIFT_ONLY})" == "TRUE" ]]; then
3013-
LLDB_TEST_SUBDIR_CLAUSE="--test-subdir lang/swift"
3014-
LLDB_TEST_CATEGORIES="--skip-category=watchpoint --skip-category=dwo"
3015-
else
3016-
LLDB_TEST_SUBDIR_CLAUSE=""
3017-
LLDB_TEST_CATEGORIES="--skip-category=watchpoint"
2992+
# Setup the xUnit results formatter.
2993+
if [[ "$(uname -s)" != "Darwin" ]] ; then
2994+
# On non-Darwin, we ignore skipped tests entirely
2995+
# so that they don't pollute our xUnit results with
2996+
# non-actionable content.
2997+
LLDB_FORMATTER_OPTS="${LLDB_FORMATTER_OPTS} -O-ndsym -O-rdebugserver -O-rlibc\\\\+\\\\+ -O-rlong.running -O-rbenchmarks -O-rrequires.one?.of.darwin"
30182998
fi
30192999

3020-
# figure out which C/C++ compiler we should use for building test inferiors.
3000+
# Figure out which C/C++ compiler we should use for building test inferiors.
30213001
if [[ "${LLDB_TEST_CC}" == "host-toolchain" ]]; then
30223002
# Use the host toolchain: i.e. the toolchain specified by HOST_CC
30233003
LLDB_DOTEST_CC_OPTS="-C ${HOST_CC}"
@@ -3029,13 +3009,6 @@ for host in "${ALL_HOSTS[@]}"; do
30293009
LLDB_DOTEST_CC_OPTS="-C $(build_directory $LOCAL_HOST llvm)"/bin/clang
30303010
fi
30313011

3032-
# If we need to use the system debugserver, do so explicitly.
3033-
if [[ "$(uname -s)" == "Darwin" && "${LLDB_USE_SYSTEM_DEBUGSERVER}" ]] ; then
3034-
LLDB_TEST_DEBUG_SERVER="--server $(xcode-select -p)/../SharedFrameworks/LLDB.framework/Resources/debugserver --out-of-tree-debugserver"
3035-
else
3036-
LLDB_TEST_DEBUG_SERVER=""
3037-
fi
3038-
30393012
# Options to find the just-built libddispatch and Foundation.
30403013
if [[ "$(uname -s)" == "Darwin" || "${SKIP_BUILD_FOUNDATION}" ]] ; then
30413014
DOTEST_EXTRA=""
@@ -3054,23 +3027,29 @@ for host in "${ALL_HOSTS[@]}"; do
30543027
DOTEST_EXTRA="${DOTEST_EXTRA} -Xlinker -rpath -Xlinker ${LIBDISPATCH_BUILD_DIR}"
30553028
DOTEST_EXTRA="${DOTEST_EXTRA} -Xlinker -rpath -Xlinker ${FOUNDATION_BUILD_DIR}"
30563029
fi
3057-
call mkdir -p "${results_dir}"
30583030

3059-
# Prefer to use lldb-dotest, as building it guarantees that we build all
3060-
# test dependencies. Ultimately we want to delete as much lldb-specific logic
3061-
# from this file as possible and just have a single call to lldb-dotest.
3031+
call mkdir -p "${results_dir}"
3032+
LLVM_LIT_ARG="${LLVM_LIT_ARGS} --xunit-xml-output=${results_dir}/results.xml"
30623033

30633034
if [[ "${ENABLE_ASAN}" ]] ; then
30643035
# Limit the number of parallel tests
30653036
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} -j $(sysctl hw.physicalcpu | awk -v N=${BUILD_JOBS} '{ print (N < $2) ? N : $2 }')"
30663037
fi
30673038

3039+
# Watchpoint testing is currently disabled: see rdar://38566150.
3040+
LLDB_TEST_CATEGORIES="--skip-category=watchpoint"
3041+
30683042
if [[ "$(true_false ${LLDB_TEST_SWIFT_ONLY})" == "TRUE" ]]; then
30693043
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} --filter=[sS]wift"
3044+
LLDB_TEST_CATEGORIES="${LLDB_TEST_CATEGORIES} --skip-category=dwo"
30703045
fi
30713046

3047+
# Construct dotest arguments.
3048+
DOTEST_ARGS="--build-dir ${lldb_build_dir}/lldb-test-build.noindex ${LLDB_TEST_SUBDIR_CLAUSE} ${LLDB_TEST_CATEGORIES} -t -E \"${DOTEST_EXTRA}\""
3049+
30723050
# Record the times test took and report the slowest.
30733051
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} -v --time-tests"
3052+
30743053
with_pushd ${lldb_build_dir} \
30753054
call ${NINJA_BIN} -j ${BUILD_JOBS} unittests/LLDBUnitTests
30763055
with_pushd ${lldb_build_dir} \
@@ -3079,17 +3058,18 @@ for host in "${ALL_HOSTS[@]}"; do
30793058
call "${llvm_build_dir}/bin/llvm-lit" \
30803059
"${lldb_build_dir}/lit" \
30813060
${LLVM_LIT_ARGS} \
3082-
--xunit-xml-output=${results_dir}/results.xml \
3083-
--param dotest-args="--build-dir ${lldb_build_dir}/lldb-test-build.noindex ${LLDB_TEST_SUBDIR_CLAUSE} ${LLDB_TEST_CATEGORIES} -t -E \"${DOTEST_EXTRA}\""
3061+
--param dotest-args="${DOTEST_ARGS}"
3062+
30843063
if [[ -x "${LLDB_TEST_SWIFT_COMPATIBILITY}" ]] ; then
30853064
echo "Running LLDB swift compatibility tests against" \
30863065
"${LLDB_TEST_SWIFT_COMPATIBILITY}"
3066+
DOTEST_ARGS="${DOTEST_ARGS} -G swift-history --swift-compiler \"${LLDB_TEST_SWIFT_COMPATIBILITY}\""
30873067
with_pushd ${results_dir} \
30883068
call "${llvm_build_dir}/bin/llvm-lit" \
30893069
"${lldb_build_dir}/lit" \
30903070
${LLVM_LIT_ARGS} \
3091-
--xunit-xml-output=${results_dir}/results.xml \
3092-
--param dotest-args="--build-dir ${lldb_build_dir}/lldb-test-build.noindex ${LLDB_TEST_SUBDIR_CLAUSE} ${LLDB_TEST_CATEGORIES} -G swift-history --swift-compiler \"${LLDB_TEST_SWIFT_COMPATIBILITY}\" -t -E \"${DOTEST_EXTRA}\"" --filter=compat
3071+
--param dotest-args="${DOTEST_ARGS}" \
3072+
--filter=compat
30933073
fi
30943074
continue
30953075
;;

0 commit comments

Comments
 (0)