bear: 3.1.3 -> 3.1.5 (#349267)

This commit is contained in:
Ramses
2024-10-20 18:22:35 +02:00
committed by GitHub
4 changed files with 70 additions and 52 deletions
@@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1ecfe0..9056f9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,8 +83,9 @@ ExternalProject_Add(BearSource
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
-DROOT_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
${CMAKE_CACHE_ARGS_EXTRA}
- TEST_BEFORE_INSTALL
+ TEST_EXCLUDE_FROM_MAIN
1
+ STEP_TARGETS test
TEST_COMMAND
ctest # or `ctest -T memcheck`
)
@@ -100,7 +101,8 @@ if (ENABLE_FUNC_TESTS)
-DCMAKE_INSTALL_LIBDIR:PATH=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_BINDIR:PATH=${CMAKE_INSTALL_BINDIR}
-DSTAGED_INSTALL_PREFIX:PATH=${STAGED_INSTALL_PREFIX}
- TEST_BEFORE_INSTALL
+ TEST_EXCLUDE_FROM_MAIN
+ STEP_TARGETS test
1
INSTALL_COMMAND
""
@@ -6,7 +6,7 @@
ninja,
pkg-config,
grpc,
protobuf_25,
protobuf,
openssl,
nlohmann_json,
gtest,
@@ -20,33 +20,28 @@
coreutils,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "bear";
version = "3.1.3";
version = "3.1.5";
src = fetchFromGitHub {
owner = "rizsotto";
repo = pname;
rev = version;
hash = "sha256-1nZPzgLWcmaRkOUXdm16IW2Nw/p1w8GBGEfZX/v+En0=";
repo = "bear";
rev = finalAttrs.version;
hash = "sha256-pwdjytP+kmTwozRl1Gd0jUqRs3wfvcYPqiQvVwa6s9c=";
};
nativeBuildInputs = [
cmake
ninja
pkg-config
# Used for functional tests, which run during buildPhase.
lit
python3
];
buildInputs = [
grpc
protobuf_25
protobuf
openssl
nlohmann_json
gtest
spdlog
c-ares
zlib
@@ -54,20 +49,52 @@ stdenv.mkDerivation rec {
re2
];
patches = [
# This patch is necessary to run tests in a separate phase. By default
# test targets are run with ALL, which is not what we want. This patch creates
# separate 'test' step targets for each cmake ExternalProject:
# - BearTest-test (functional lit tests)
# - BearSource-test (unit tests via gtest)
./0001-exclude-tests-from-all.patch
];
nativeCheckInputs = [
lit
python3
];
checkInputs = [
gtest
];
cmakeFlags = [
# Build system and generated files concatenate install prefix and
# CMAKE_INSTALL_{BIN,LIB}DIR, which breaks if these are absolute paths.
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
(lib.cmakeBool "ENABLE_UNIT_TESTS" false)
(lib.cmakeBool "ENABLE_FUNC_TESTS" false)
(lib.cmakeBool "ENABLE_UNIT_TESTS" finalAttrs.doCheck)
(lib.cmakeBool "ENABLE_FUNC_TESTS" finalAttrs.doCheck)
];
patches = [
# Fix toolchain environment variable handling and the Darwin SIP check.
./fix-functional-tests.patch
checkTarget = lib.concatStringsSep " " [
"BearTest-test"
"BearSource-test"
];
doCheck = true;
env = {
# Disable failing tests. The cause is not immediately clear.
LIT_FILTER_OUT = lib.concatStringsSep "|" [
"cases/compilation/output/config/filter_compilers.sh"
"cases/intercept/preload/posix/execvpe/success_to_resolve.c"
"cases/intercept/preload/posix/popen/success.c"
"cases/intercept/preload/posix/posix_spawnp/success_to_resolve.c"
"cases/intercept/preload/posix/system/success.c"
"cases/intercept/preload/shell_commands_intercepted_without_shebang.sh"
];
};
postPatch = ''
patchShebangs test/bin
@@ -92,4 +119,4 @@ stdenv.mkDerivation rec {
platforms = platforms.unix;
maintainers = with maintainers; [ DieracDelta ];
};
}
})
@@ -1,32 +0,0 @@
diff --git a/test/lit.cfg b/test/lit.cfg
index 118c979..b69fecc 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -207,13 +207,8 @@ def is_preload_disabled():
if is_windows:
return True
elif sys.platform == 'darwin':
- command = ['csrutil', 'status']
- pattern = re.compile(r'System Integrity Protection status:\s+enabled')
- try:
- output = subprocess.check_output(command, stderr=subprocess.STDOUT)
- return any(pattern.match(line) for line in output.decode('utf-8').splitlines())
- except (OSError, subprocess.CalledProcessError):
- return False
+ # csrutil(8) isn't available in the Nix build sandbox.
+ return True
else:
return False
@@ -221,6 +216,11 @@ def is_preload_disabled():
if not is_preload_disabled():
config.available_features.add('preload')
+# Preserve the variables required for the Nix toolchain wrappers.
+for var, value in os.environ.items():
+ if var.startswith('NIX_'):
+ config.environment[var] = value
+
print(config.substitutions)
print(config.environment)
print(config.available_features)
-2
View File
@@ -17022,8 +17022,6 @@ with pkgs;
buildBazelPackage = darwin.apple_sdk_11_0.callPackage ../build-support/build-bazel-package { };
bear = callPackage ../development/tools/build-managers/bear { };
bingrep = callPackage ../development/tools/analysis/bingrep { };
binutils-unwrapped = callPackage ../development/tools/misc/binutils {