|
1 | 1 | from importlib import reload
|
2 | 2 |
|
3 |
| -from buildbot.plugins import util |
| 3 | +from buildbot.plugins import util, steps |
4 | 4 |
|
5 | 5 | from zorg.buildbot.builders import ClangBuilder
|
6 | 6 | from zorg.buildbot.builders import FlangBuilder
|
|
3268 | 3268 | "-DLLVM_ENABLE_LLD=ON",
|
3269 | 3269 | "-DCMAKE_CXX_FLAGS=-gmlt",
|
3270 | 3270 | "-DLLVM_CCACHE_BUILD=ON"])},
|
| 3271 | + |
| 3272 | + # LLDB remote-linux builders. |
| 3273 | + |
| 3274 | + # LLDB remote-linux on Ubuntu Linux host. |
| 3275 | + # The first stage uses pre-installed latest released Clang (see apt.llvm.org for details). |
| 3276 | + # The second stage uses pre-built cross Aarch64 Clang toolchain from the latest release branch |
| 3277 | + # (see llvm-clang-win-x-aarch64 builder configuration for the details). |
| 3278 | + # The remote host is ARM Cortex A76/A78 board with Ubuntu Linux. |
| 3279 | + {'name': "lldb-remote-linux-ubuntu", |
| 3280 | + 'tags' : ["llvm", "clang", "lldb", "cross", "aarch64"], |
| 3281 | + 'collapseRequests': True, |
| 3282 | + 'workernames': ["as-builder-9"], |
| 3283 | + 'builddir': "lldb-remote-linux-ubuntu", |
| 3284 | + 'factory': UnifiedTreeBuilder.getCmakeExBuildFactory( |
| 3285 | + depends_on_projects = ["llvm", "clang", "lld", "lldb"], |
| 3286 | + enable_runtimes = None, |
| 3287 | + checks = [ |
| 3288 | + "check-lldb-unit", |
| 3289 | + "check-lldb-api", |
| 3290 | + "check-lldb-shell", |
| 3291 | + ], |
| 3292 | + clean = True, |
| 3293 | + cmake_definitions = { |
| 3294 | + "CMAKE_BUILD_TYPE" : "Release", |
| 3295 | + "CMAKE_C_COMPILER_LAUNCHER" : "ccache", |
| 3296 | + "CMAKE_CXX_COMPILER_LAUNCHER" : "ccache", |
| 3297 | + "CMAKE_C_COMPILER" : "clang-18", |
| 3298 | + "CMAKE_CXX_COMPILER" : "clang++-18", |
| 3299 | + "CMAKE_CXX_FLAGS" : "-D__OPTIMIZE__", |
| 3300 | + "LLVM_TARGETS_TO_BUILD" : "AArch64", |
| 3301 | + "LLVM_DEFAULT_TARGET_TRIPLE" : "aarch64-unknown-linux-gnu", |
| 3302 | + "LLVM_INCLUDE_BENCHMARKS" : "OFF", |
| 3303 | + "LLVM_PARALLEL_LINK_JOBS" : 8, |
| 3304 | + "CLANG_DEFAULT_LINKER" : "lld", |
| 3305 | + |
| 3306 | + "LLDB_TEST_ARCH" : "aarch64", |
| 3307 | + "LLDB_TEST_COMPILER" : util.Interpolate("%(prop:tools_root_path)s/aarch64-clang-18/bin/clang"), |
| 3308 | + "LLDB_ENABLE_PYTHON" : "ON", |
| 3309 | + "LLDB_ENABLE_SWIG" : "ON", |
| 3310 | + "LLDB_ENABLE_LIBEDIT" : "OFF", |
| 3311 | + "LLDB_ENABLE_CURSES" : "OFF", |
| 3312 | + "LLDB_ENABLE_LZMA" : "OFF", |
| 3313 | + "LLDB_ENABLE_LIBXML2" : "OFF", |
| 3314 | + # No need to build lldb-server during the first stage. |
| 3315 | + # We are going to build it for the target platform later. |
| 3316 | + "LLDB_CAN_USE_LLDB_SERVER" : "OFF", |
| 3317 | + "LLDB_TEST_USER_ARGS" : util.Interpolate( |
| 3318 | + "--env;USE_LLVM_TOOLS=1;--env;ARCH_CFLAGS=-mcpu=cortex-a78;" \ |
| 3319 | + "--sysroot=%(prop:sysroot_path_aarch64)s;" \ |
| 3320 | + "--platform-name;remote-linux;" \ |
| 3321 | + "--platform-url;connect://%(prop:remote_test_host)s:1234;" \ |
| 3322 | + "--platform-working-dir;/home/ubuntu/lldb-tests"), |
| 3323 | + }, |
| 3324 | + cmake_options = { |
| 3325 | + }, |
| 3326 | + install_dir = "native", |
| 3327 | + post_build_steps = |
| 3328 | + # Stage 2. |
| 3329 | + # Build the target's lldb-server (cross compilation with pre-installed/pre-built aarch64 clang). |
| 3330 | + UnifiedTreeBuilder.getCmakeExBuildFactory( |
| 3331 | + depends_on_projects = ["clang", "lldb"], |
| 3332 | + enable_runtimes = None, |
| 3333 | + checks = None, |
| 3334 | + clean = True, |
| 3335 | + repo_profiles = None, |
| 3336 | + allow_cmake_defaults = False, |
| 3337 | + hint = "aarch64-lldb", |
| 3338 | + cmake_definitions = { |
| 3339 | + "CMAKE_BUILD_TYPE" : "Release", |
| 3340 | + "CMAKE_C_COMPILER_LAUNCHER" : "ccache", |
| 3341 | + "CMAKE_CXX_COMPILER_LAUNCHER" : "ccache", |
| 3342 | + "CMAKE_CXX_FLAGS" : "-mcpu=cortex-a78 -D__OPTIMIZE__ -fPIC --stdlib=libc++", |
| 3343 | + "CMAKE_C_FLAGS" : "-mcpu=cortex-a78 -D__OPTIMIZE__ -fPIC", |
| 3344 | + "CMAKE_EXE_LINKER_FLAGS" : "-Wl,-l:libc++abi.a -Wl,-l:libc++.a -Wl,-l:libunwind.a", |
| 3345 | + "CMAKE_SHARED_LINKER_FLAGS" : "-Wl,-l:libc++abi.a -Wl,-l:libc++.a -Wl,-l:libunwind.a", |
| 3346 | + "CMAKE_CXX_COMPILER" : util.Interpolate("%(prop:tools_root_path)s/aarch64-clang-18/bin/clang++"), |
| 3347 | + "CMAKE_C_COMPILER" : util.Interpolate("%(prop:tools_root_path)s/aarch64-clang-18/bin/clang"), |
| 3348 | + "CMAKE_ASM_COMPILER" : util.Interpolate("%(prop:tools_root_path)s/aarch64-clang-18/bin/clang"), |
| 3349 | + "CMAKE_SYSTEM_NAME" : "Linux", |
| 3350 | + "CMAKE_SYSTEM_PROCESSOR" : "aarch64", |
| 3351 | + "CMAKE_CROSSCOMPILING" : "ON", |
| 3352 | + |
| 3353 | + # Required for the native table-gen |
| 3354 | + "LLVM_NATIVE_TOOL_DIR" : util.Interpolate("%(prop:builddir)s/build/bin"), |
| 3355 | + |
| 3356 | + "LLVM_DEFAULT_TARGET_TRIPLE" : "aarch64-unknown-linux-gnu", |
| 3357 | + "LLVM_HOST_TRIPLE" : "aarch64-unknown-linux-gnu", |
| 3358 | + "LLVM_TARGETS_TO_BUILD" : "AArch64", |
| 3359 | + "LLVM_ENABLE_ASSERTIONS" : "ON", |
| 3360 | + "LLVM_INCLUDE_BENCHMARKS" : "OFF", |
| 3361 | + "LLVM_PARALLEL_LINK_JOBS" : 8, |
| 3362 | + "CLANG_DEFAULT_LINKER" : "lld", |
| 3363 | + |
| 3364 | + "LLDB_INCLUDE_TESTS" : "OFF", |
| 3365 | + "LLDB_ENABLE_PYTHON" : "OFF", |
| 3366 | + "LLDB_ENABLE_LIBEDIT" : "OFF", |
| 3367 | + "LLDB_ENABLE_CURSES" : "OFF", |
| 3368 | + "LLDB_ENABLE_LZMA" : "OFF", |
| 3369 | + |
| 3370 | + "LLVM_ENABLE_ZLIB" : "OFF", |
| 3371 | + }, |
| 3372 | + obj_dir = "build-lldb-server", |
| 3373 | + targets = ["lldb-server"], |
| 3374 | + install_dir = util.Interpolate("%(prop:builddir)s/lldb-server-install"), |
| 3375 | + install_targets = ["install-lldb-server"], |
| 3376 | + post_finalize_steps = [ |
| 3377 | + steps.ShellSequence(name = "exec-lldb-server", |
| 3378 | + commands = [ |
| 3379 | + util.ShellArg(command=[ "ssh", util.Interpolate("%(prop:remote_test_user)s@%(prop:remote_test_host)s"), "killall lldb-server ; exit 0;" ], logname="stdio"), |
| 3380 | + util.ShellArg(command=[ "scp", "lldb-server", util.Interpolate("%(prop:remote_test_user)s@%(prop:remote_test_host)s:~/lldb-server") ], logname="stdio"), |
| 3381 | + util.ShellArg(command=[ "ssh", util.Interpolate("%(prop:remote_test_user)s@%(prop:remote_test_host)s"), "chmod +x ~/lldb-server" ], logname="stdio"), |
| 3382 | + util.ShellArg(command=[ "ssh", util.Interpolate("%(prop:remote_test_user)s@%(prop:remote_test_host)s"), |
| 3383 | + "~/lldb-server p --log-channels 'lldb all' --listen '*:1234' " \ |
| 3384 | + "--server --min-gdbserver-port 1236 --max-gdbserver-port 1246 " \ |
| 3385 | + "--log-file ./lldb-server.log > /dev/null 2>&1 &" ], logname="stdio"), |
| 3386 | + ], |
| 3387 | + workdir = util.Interpolate("%(prop:builddir)s/lldb-server-install/bin"), |
| 3388 | + description = "execute lldb-server on remote target", |
| 3389 | + haltOnFailure = True, |
| 3390 | + ), |
| 3391 | + ], |
| 3392 | + ), |
| 3393 | + post_finalize_steps = [ |
| 3394 | + #Note: add the following line into the /etc/sudoers file on the remote target |
| 3395 | + # to allow rebooting without entering the sudo's password: |
| 3396 | + # [/etc/sudoers] |
| 3397 | + # ... |
| 3398 | + # ubuntu ALL=NOPASSWD:/sbin/reboot |
| 3399 | + steps.ShellCommand(name = "restart-target-finalize", |
| 3400 | + command = [ "ssh", util.Interpolate("%(prop:remote_test_user)s@%(prop:remote_test_host)s"), |
| 3401 | + "((sleep 5 && sudo reboot) > /dev/null 2>&1 &); exit 0;" |
| 3402 | + ], |
| 3403 | + alwaysRun = True, |
| 3404 | + ), |
| 3405 | + ], |
| 3406 | + env = { |
| 3407 | + 'CCACHE_DIR' : util.Interpolate("%(prop:builddir)s/ccache-db"), |
| 3408 | + # TMP/TEMP within the build dir (to utilize a ramdisk). |
| 3409 | + 'TMP' : util.Interpolate("%(prop:builddir)s/build"), |
| 3410 | + 'TEMP' : util.Interpolate("%(prop:builddir)s/build"), |
| 3411 | + 'LIT_OPTS' : "-a -v --threads=8", |
| 3412 | + }, |
| 3413 | + ) |
| 3414 | + }, |
3271 | 3415 | ]
|
0 commit comments