1
0
Fork 0

windows tests: run for all artiq conda pkgs

This commit is contained in:
Astro 2019-04-09 20:41:46 +02:00 committed by Sébastien Bourdeauducq
parent 937a27dd48
commit b79576247f
1 changed files with 47 additions and 41 deletions

View File

@ -2,11 +2,7 @@
diskImage ? "/opt/windows/c.img", diskImage ? "/opt/windows/c.img",
qemuMem ? "2G", qemuMem ? "2G",
testTimeout ? 120, testTimeout ? 120,
# This artiqPkg should be a current build passed by the caller artiq ? import ./.. { inherit pkgs; },
artiqPkg ? (pkgs.fetchurl {
url = "https://nixbld.m-labs.hk/build/2316/download/1/artiq-5e.b8e2b82a-0.tar.bz2";
sha256 = "0gisv3a17rnwavsifpz4cfnqvlssv37pysi2qx41k67rmcpqcs98";
}),
}: }:
with pkgs; with pkgs;
@ -40,40 +36,50 @@ let
scp -P 2022 ${sshOpts} \ scp -P 2022 ${sshOpts} \
"${src}" "${sshUser}@localhost:${target}" "${src}" "${sshUser}@localhost:${target}"
''; '';
installCondaPkgs = condaPkgs: installCondaPkg = pkg: ''
builtins.concatStringsSep "\n" (map (pkg: '' F="$(basename ${pkg})"
F="$(basename ${pkg})" ${scp pkg "$F"}
${scp pkg "$F"} ${ssh "miniconda\\Scripts\\conda install $F"}
${ssh "miniconda\\Scripts\\conda install $F"} ${ssh "del $F"}
${ssh "del $F"} '';
'') condaPkgs); makeTest = name: artiqPkg:
stdenv.mkDerivation {
name = "windows-test-${name}";
src = ./.;
buildInputs = [ qemu sshpass openssh ];
buildPhase = ''
# +1 day from last modification of the disk image
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
${runQemu [
"-boot" "order=c"
"-snapshot"
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
"-rtc" "base=$CLOCK"
]} &
echo "Wait for Windows to boot"
sleep 10
${ssh "ver"}
for pkg in ${artiqPkg}/noarch/*.tar.bz2 ; do
${installCondaPkg "$pkg"}
done
# Allow tests to run for 2 minutes
${ssh "shutdown -s -t ${toString testTimeout}"}
${ssh "miniconda\\scripts\\activate && miniconda\\python -m unittest discover -v artiq.test"}
# Abort timeouted shutdown
${ssh "shutdown -a"}
# Power off immediately
${ssh "shutdown -p -f"}
'';
installPhase = ''
echo Done
'';
};
condaPackageNames =
builtins.filter (name: builtins.match "conda-.+" name != null)
(builtins.attrNames artiq);
in in
stdenv.mkDerivation { builtins.listToAttrs
name = "windows-test"; (map (pkgName: {
src = ./.; name = pkgName;
buildInputs = [ qemu sshpass openssh ]; value = makeTest pkgName artiq.${pkgName};
buildPhase = '' }) condaPackageNames)
# +1 day from last modification of the disk image
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
${runQemu [
"-boot" "order=c"
"-snapshot"
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
"-rtc" "base=$CLOCK"
]} &
echo "Wait for Windows to boot"
sleep 10
${ssh "ver"}
${installCondaPkgs [artiqPkg]}
# Allow tests to run for 2 minutes
${ssh "shutdown -s -t $ {toString testTimeout}"}
${ssh "miniconda\\scripts\\activate && miniconda\\python -m unittest discover -v artiq.test"}
# Abort timeouted shutdown
${ssh "shutdown -a"}
# Power off immediately
${ssh "shutdown -p -f"}
'';
installPhase = ''
echo Done
'';
}