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",
qemuMem ? "2G",
testTimeout ? 120,
# This artiqPkg should be a current build passed by the caller
artiqPkg ? (pkgs.fetchurl {
url = "https://nixbld.m-labs.hk/build/2316/download/1/artiq-5e.b8e2b82a-0.tar.bz2";
sha256 = "0gisv3a17rnwavsifpz4cfnqvlssv37pysi2qx41k67rmcpqcs98";
}),
artiq ? import ./.. { inherit pkgs; },
}:
with pkgs;
@ -40,16 +36,15 @@ let
scp -P 2022 ${sshOpts} \
"${src}" "${sshUser}@localhost:${target}"
'';
installCondaPkgs = condaPkgs:
builtins.concatStringsSep "\n" (map (pkg: ''
installCondaPkg = pkg: ''
F="$(basename ${pkg})"
${scp pkg "$F"}
${ssh "miniconda\\Scripts\\conda install $F"}
${ssh "del $F"}
'') condaPkgs);
in
stdenv.mkDerivation {
name = "windows-test";
'';
makeTest = name: artiqPkg:
stdenv.mkDerivation {
name = "windows-test-${name}";
src = ./.;
buildInputs = [ qemu sshpass openssh ];
buildPhase = ''
@ -64,9 +59,11 @@ stdenv.mkDerivation {
echo "Wait for Windows to boot"
sleep 10
${ssh "ver"}
${installCondaPkgs [artiqPkg]}
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 "shutdown -s -t ${toString testTimeout}"}
${ssh "miniconda\\scripts\\activate && miniconda\\python -m unittest discover -v artiq.test"}
# Abort timeouted shutdown
${ssh "shutdown -a"}
@ -76,4 +73,13 @@ stdenv.mkDerivation {
installPhase = ''
echo Done
'';
}
};
condaPackageNames =
builtins.filter (name: builtins.match "conda-.+" name != null)
(builtins.attrNames artiq);
in
builtins.listToAttrs
(map (pkgName: {
name = pkgName;
value = makeTest pkgName artiq.${pkgName};
}) condaPackageNames)