ci: use run-tests.sh

This commit is contained in:
Erik Arvstedt 2020-12-11 13:26:10 +01:00
parent a82f0f5f48
commit 9977fa69af
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 37 additions and 39 deletions

View File

@ -1,12 +0,0 @@
let
pkgs = import <nixpkgs> {};
nbPkgs = import ../pkgs { inherit pkgs; };
ciPkgs = with nbPkgs; [
electrs
elementsd
hwi
joinmarket
lightning-loop
];
in
pkgs.writeText "ci-pkgs" (pkgs.lib.concatMapStringsSep "\n" toString ciPkgs)

View File

@ -21,9 +21,9 @@ fi
echo "$NIX_PATH ($(nix eval --raw nixpkgs.lib.version))"
if [[ $scenario ]]; then
buildExpr=$(../test/run-tests.sh --scenario $scenario exprForCI)
testArgs="--scenario $scenario"
else
buildExpr="import ./build.nix"
testArgs=pkgsUnstable
fi
"${BASH_SOURCE[0]%/*}/build-to-cachix.sh" -E "$buildExpr"
"${BASH_SOURCE[0]%/*}/../test/run-tests.sh" --ci $testArgs

View File

@ -44,6 +44,7 @@ scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
scenario=
outLinkPrefix=
ciBuild=
while :; do
case $1 in
--scenario|-s)
@ -66,6 +67,10 @@ while :; do
exit 1
fi
;;
--ci)
shift
ciBuild=1
;;
*)
break
esac
@ -135,12 +140,16 @@ container() {
doBuild() {
name=$1
shift
if [[ $ciBuild ]]; then
"$scriptDir/../ci/build-to-cachix.sh" "$@"
else
if [[ $outLinkPrefix ]]; then
outLink="--out-link $outLinkPrefix-$name"
else
outLink=--no-out-link
fi
nix-build $outLink "$@"
fi
}
# Run the test by building the test derivation
@ -148,9 +157,12 @@ buildTest() {
vmTestNixExpr | doBuild $scenario $outLinkArg "$@" -
}
# On continuous integration nodes there are few other processes running alongside the
# test, so use more memory here for maximum performance.
exprForCI() {
vmTestNixExpr() {
extraQEMUOpts=
if [[ $ciBuild ]]; then
# On continuous integration nodes there are few other processes running alongside the
# test, so use more memory here for maximum performance.
memoryMiB=4096
memTotalKiB=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
memAvailableKiB=$(awk '/MemAvailable/ { print $2 }' /proc/meminfo)
@ -163,11 +175,9 @@ exprForCI() {
# VMX is usually not available on CI nodes due to recursive virtualisation.
# Explicitly disable VMX, otherwise QEMU 4.20 fails with message
# "error: failed to set MSR 0x48b to 0x159ff00000000"
vmTestNixExpr "-cpu host,-vmx"
}
extraQEMUOpts="-cpu host,-vmx"
fi
vmTestNixExpr() {
extraQEMUOpts="$1"
cat <<EOF
((import "$scriptDir/tests.nix" { scenario = "$scenario"; }).vm {}).overrideAttrs (old: rec {
buildCommand = ''