Disable leak detection in test_autosuggest_suggest_special() under CI

This is a false positive as a result of disabling TLS support in LSAN due to an
incompatibility with newer versions of glibc.

Also remove the older workaround (because it didn't work).
This commit is contained in:
Mahmoud Al-Qudsi 2022-10-24 15:54:46 -05:00
parent bfa172852f
commit 44c9c51841
2 changed files with 12 additions and 5 deletions

View File

@ -75,7 +75,7 @@ jobs:
env: env:
CC: clang CC: clang
CXX: clang++ CXX: clang++
CXXFLAGS: "-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address" CXXFLAGS: "-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -DFISH_CI_SAN"
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..

View File

@ -42,6 +42,10 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#ifdef FISH_CI_SAN
#include <sanitizer/lsan_interface.h>
#endif
#include "ast.h" #include "ast.h"
#include "autoload.h" #include "autoload.h"
#include "builtin.h" #include "builtin.h"
@ -3721,9 +3725,13 @@ static void perform_one_completion_cd_test(const wcstring &command, const wcstri
// Testing test_autosuggest_suggest_special, in particular for properly handling quotes and // Testing test_autosuggest_suggest_special, in particular for properly handling quotes and
// backslashes. // backslashes.
static void test_autosuggest_suggest_special() { static void test_autosuggest_suggest_special() {
// This manages to crash the asan on Ubuntu 20.04 // We execute LSAN with use_tls=0 under CI to avoid a SIGSEGV crash in LSAN itself.
// So just skip it. // Unfortunately, this causes it to incorrectly flag a memory leak here that doesn't reproduce
#ifndef __SANITIZE_ADDRESS__ // locally with use_tls=1.
#ifdef FISH_CI_SAN
__lsan::ScopedDisabler disable_leak_detection{};
#endif
if (system("mkdir -p 'test/autosuggest_test/0foobar'")) err(L"mkdir failed"); if (system("mkdir -p 'test/autosuggest_test/0foobar'")) err(L"mkdir failed");
if (system("mkdir -p 'test/autosuggest_test/1foo bar'")) err(L"mkdir failed"); if (system("mkdir -p 'test/autosuggest_test/1foo bar'")) err(L"mkdir failed");
if (system("mkdir -p 'test/autosuggest_test/2foo bar'")) err(L"mkdir failed"); if (system("mkdir -p 'test/autosuggest_test/2foo bar'")) err(L"mkdir failed");
@ -3845,7 +3853,6 @@ static void test_autosuggest_suggest_special() {
parser_t::principal_parser().vars().remove(L"HOME", ENV_LOCAL | ENV_EXPORT); parser_t::principal_parser().vars().remove(L"HOME", ENV_LOCAL | ENV_EXPORT);
popd(); popd();
#endif // ndef SANITIZE_ADDRESS
} }
static void perform_one_autosuggestion_should_ignore_test(const wcstring &command, long line) { static void perform_one_autosuggestion_should_ignore_test(const wcstring &command, long line) {