Add CI build with clang sanitizers, increase stack size to 30 MB for builds with sanitizers.

This commit is contained in:
bruvzg 2022-04-01 13:15:35 +03:00
parent f3fe2631da
commit ba0317be04
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
5 changed files with 36 additions and 2 deletions

View file

@ -30,7 +30,7 @@ jobs:
build-mono: true build-mono: true
artifact: true artifact: true
- name: Editor with doubles and sanitizers (target=debug, tools=yes, float=64, tests=yes, use_asan=yes, use_ubsan=yes) - name: Editor with doubles and GCC sanitizers (target=debug, tools=yes, float=64, tests=yes, use_asan=yes, use_ubsan=yes)
cache-name: linux-editor-double-sanitizers cache-name: linux-editor-double-sanitizers
target: debug target: debug
tools: true tools: true
@ -45,6 +45,17 @@ jobs:
# Skip 2GiB artifact speeding up action. # Skip 2GiB artifact speeding up action.
artifact: false artifact: false
- name: Editor with clang sanitizers (target=debug, tools=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes)
cache-name: linux-editor-llvm-sanitizers
target: debug
tools: true
tests: true
sconsflags: use_asan=yes use_ubsan=yes use_llvm=yes
bin: "./bin/godot.linuxbsd.tools.64.llvm.san"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
- name: Template w/ Mono (target=release, tools=no) - name: Template w/ Mono (target=release, tools=no)
cache-name: linux-template-mono cache-name: linux-template-mono
target: release target: release
@ -75,7 +86,8 @@ jobs:
# The actual dependencies # The actual dependencies
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \ sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \ libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip \
llvm
- name: Setup Godot build cache - name: Setup Godot build cache
uses: ./.github/actions/godot-cache uses: ./.github/actions/godot-cache

View file

@ -162,6 +162,7 @@ def configure(env):
if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]:
env.extra_suffix += ".san" env.extra_suffix += ".san"
env.Append(CCFLAGS=["-DSANITIZERS_ENABLED"])
if env["use_ubsan"]: if env["use_ubsan"]:
env.Append( env.Append(

View file

@ -33,10 +33,20 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#if defined(SANITIZERS_ENABLED)
#include <sys/resource.h>
#endif
#include "main/main.h" #include "main/main.h"
#include "os_linuxbsd.h" #include "os_linuxbsd.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
#if defined(SANITIZERS_ENABLED)
// Note: Set stack size to be at least 30 MB (vs 8 MB default) to avoid overflow, address sanitizer can increase stack usage up to 3 times.
struct rlimit stack_lim = { 0x1E00000, 0x1E00000 };
setrlimit(RLIMIT_STACK, &stack_lim);
#endif
OS_LinuxBSD os; OS_LinuxBSD os;
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");

View file

@ -127,6 +127,7 @@ def configure(env):
if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]: if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]:
env.extra_suffix += ".san" env.extra_suffix += ".san"
env.Append(CCFLAGS=["-DSANITIZERS_ENABLED"])
if env["use_ubsan"]: if env["use_ubsan"]:
env.Append( env.Append(

View file

@ -35,12 +35,22 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#if defined(SANITIZERS_ENABLED)
#include <sys/resource.h>
#endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
#if defined(VULKAN_ENABLED) #if defined(VULKAN_ENABLED)
// MoltenVK - enable full component swizzling support. // MoltenVK - enable full component swizzling support.
setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1); setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1);
#endif #endif
#if defined(SANITIZERS_ENABLED)
// Note: Set stack size to be at least 30 MB (vs 8 MB default) to avoid overflow, address sanitizer can increase stack usage up to 3 times.
struct rlimit stack_lim = { 0x1E00000, 0x1E00000 };
setrlimit(RLIMIT_STACK, &stack_lim);
#endif
int first_arg = 1; int first_arg = 1;
const char *dbg_arg = "-NSDocumentRevisionsDebugMode"; const char *dbg_arg = "-NSDocumentRevisionsDebugMode";
printf("arguments\n"); printf("arguments\n");