tests/clang-tidy: Run on all supported platforms

Fixes #1013

Change-Id: I7388e4eb4728c34f2e21756438020e28b4f1cfca
This commit is contained in:
Tom Hubrecht
2025-11-24 07:22:15 +00:00
parent 0f3a66f856
commit 395fe68127
7 changed files with 37 additions and 7 deletions
+11 -5
View File
@@ -222,7 +222,10 @@
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
};
lix-clang-tidy = final.callPackage ./subprojects/lix-clang-tidy { };
lix-clang-tidy = final.callPackage ./subprojects/lix-clang-tidy {
# FIXME: To be removed when switching to nixos-25.11-small
llvmPackages = final.llvmPackages_20;
};
nix-eval-jobs = final.callPackage ./subprojects/nix-eval-jobs {
srcDir = ./subprojects/nix-eval-jobs;
@@ -427,17 +430,20 @@
'';
# clang-tidy run against the Lix codebase using the Lix clang-tidy plugin
clang-tidy =
clang-tidy = forAllSystems (
system:
let
nixpkgs = nixpkgsFor.x86_64-linux.native;
inherit (nixpkgs) pkgs;
pkgs = nixpkgsFor.${system}.native;
in
pkgs.callPackage ./package.nix {
# Required since we don't support gcc stdenv
stdenv = pkgs.clangStdenv;
# FIXME: To be removed when switching to nixos-25.11-small
llvmPackages = pkgs.llvmPackages_20;
versionSuffix = "";
lintInsteadOfBuild = true;
};
}
);
# Make sure that nix-env still produces the exact same result
# on a particular version of Nixpkgs.
+2
View File
@@ -97,6 +97,8 @@ public:
res.reserve(size_);
for (Size n = 0; n < size_; n++)
res.emplace_back(&attrs[n]);
// NOTE: this sort uses a total order, so the iteration over pointers is not an issue
// NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order)
std::sort(res.begin(), res.end(), [&](const Attr * a, const Attr * b) {
std::string_view sa = symbols[a->name], sb = symbols[b->name];
return sa < sb;
+2
View File
@@ -116,6 +116,8 @@ void ExprAttrs::addBindingsToJSON(JSON & out, const SymbolTable & symbols) const
typedef const decltype(attrs)::value_type * Attr;
std::vector<Attr> sorted;
for (auto & i : attrs) sorted.push_back(&i);
// NOTE: this sort uses a total order, so the iteration over pointers is not an issue
// NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order)
std::sort(sorted.begin(), sorted.end(), [&](Attr a, Attr b) {
std::string_view sa = symbols[a->first], sb = symbols[b->first];
return sa < sb;
+2
View File
@@ -95,6 +95,8 @@ try {
std::vector<const StorePath *> willSubstituteSorted = {};
std::for_each(willSubstitute.begin(), willSubstitute.end(),
[&](const StorePath &p) { willSubstituteSorted.push_back(&p); });
// NOTE: this sort uses a total order, so the iteration over pointers is not an issue
// NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order)
std::sort(willSubstituteSorted.begin(), willSubstituteSorted.end(),
[](const StorePath *lhs, const StorePath *rhs) {
if (lhs->name() == rhs->name())
+1
View File
@@ -18,6 +18,7 @@
#include <kj/async.h>
#include <queue>
#include <regex>
#include <thread>
#include <errno.h>
#include <fcntl.h>
+13
View File
@@ -0,0 +1,13 @@
diff --git i/include/rapidcheck/Gen.hpp w/include/rapidcheck/Gen.hpp
index 0c48004..2eb143f 100644
--- i/include/rapidcheck/Gen.hpp
+++ w/include/rapidcheck/Gen.hpp
@@ -2,6 +2,8 @@
#include <cassert>
+#include <exception>
+
#include "rapidcheck/detail/Any.h"
#include "rapidcheck/detail/ImplicitParam.h"
#include "rapidcheck/gen/detail/GenerationHandler.h"
+6 -2
View File
@@ -287,7 +287,9 @@ stdenv.mkDerivation (finalAttrs: {
# musl doesn't support fibers, and we can't detect this with meson alone.
++ lib.optional hostPlatform.isMusl "-Ddisable-fibers=true"
++ lib.optional (finalAttrs.dontBuild && !lintInsteadOfBuild) "-Denable-build=false"
++ lib.optional lintInsteadOfBuild "-Dlix-clang-tidy-checks-path=${lix-clang-tidy}/lib/liblix-clang-tidy.so"
++ lib.optional lintInsteadOfBuild "-Dlix-clang-tidy-checks-path=${lix-clang-tidy}/lib/liblix-clang-tidy.${
if hostPlatform.isDarwin then "dylib" else "so"
}"
++ [
# mesonConfigurePhase automatically passes -Dauto_features=enabled,
# so we must explicitly enable or disable features that we are not passing
@@ -383,7 +385,9 @@ stdenv.mkDerivation (finalAttrs: {
checkInputs = [
gtest
rapidcheck
(rapidcheck.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ ./misc/rapidcheck-gen-hpp.patch ];
}))
];
propagatedBuildInputs = lib.optionals (!finalAttrs.dontBuild) maybePropagatedInputs;