Simplify nix-build and enable verbose tests

This commit is contained in:
Rodrigo Arias 2022-01-13 13:17:32 +01:00
parent afc4ed48b5
commit ce9a68fc7e
3 changed files with 35 additions and 52 deletions

View File

@ -12,8 +12,8 @@ build:debian-latest:
paths: paths:
- install/ - install/
build:nixpkgs-glibc-2.26: build:old-glibc:
image: nixos/nix:latest image: nixos/nix:latest
stage: build stage: build
script: script:
- nix-build nix/shell-glibc-2.26.nix -A ovni - nix-build nix/old-glibc.nix

33
nix/old-glibc.nix Normal file
View File

@ -0,0 +1,33 @@
# Build with `nix-build nix/old-glibc.nix`
let
# Define the set of packages from the old 2018.03 nixos release, so we get a
# glibc 2.26 which doesn't define the gettid() function, and one of the lowest
# cmake versions supported (3.10.2).
url = "https://github.com/NixOS/nixpkgs/archive/3e1be2206b4c1eb3299fb633b8ce9f5ac1c32898.tar.gz";
pkgs = import (builtins.fetchTarball { inherit url; }) {};
in
with pkgs;
stdenv.mkDerivation rec {
name = "ovni";
buildInputs = [ cmake openmpi ];
# Prevent accidental reutilization of previous builds, as we are taking the
# current directory as-is
preConfigure = ''
rm -rf build install
'';
cmakeBuildType = "Debug";
cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
buildFlags = [ "VERBOSE=1" ];
checkFlags = [ "CTEST_OUTPUT_ON_FAILURE=1" "ARGS=-V" ];
dontStrip = true;
doCheck = true;
checkTarget = "test";
src = ../.;
}

View File

@ -1,50 +0,0 @@
{
pkgs ? import (
builtins.fetchTarball {
# Use nixpkgs 18.03 with old glibc and cmake
url = "https://github.com/NixOS/nixpkgs/archive/3e1be2206b4c1eb3299fb633b8ce9f5ac1c32898.tar.gz";
}
) {}
# By default use debug
, enableDebug ? true
}:
with pkgs;
{
ovni = stdenv.mkDerivation rec {
name = "ovni";
buildInputs = [ cmake openmpi ];
cmakeBuildType = if (enableDebug) then "Debug" else "Release";
cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
buildFlags = [ "VERBOSE=1" ];
checkFlags = [ "CTEST_OUTPUT_ON_FAILURE=1" ];
dontStrip = true;
doCheck = true;
checkTarget = "test";
src = ../.;
};
shell = pkgs.mkShell {
nativeBuildInputs = [ cmake openmpi ];
NIX_ENFORCE_PURITY = 0;
shellHook = ''
set -e
curdir=$(pwd)
rm -rf build install
mkdir build install
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DENABLE_DEBUG_LOG=ON \
-DCMAKE_INSTALL_PREFIX="$curdir/install" ..
make VERBOSE=1
make test CTEST_OUTPUT_ON_FAILURE=1
make install
exit 0
'';
};
}