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,16 +36,15 @@ 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); '';
in makeTest = name: artiqPkg:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "windows-test"; name = "windows-test-${name}";
src = ./.; src = ./.;
buildInputs = [ qemu sshpass openssh ]; buildInputs = [ qemu sshpass openssh ];
buildPhase = '' buildPhase = ''
@ -64,7 +59,9 @@ stdenv.mkDerivation {
echo "Wait for Windows to boot" echo "Wait for Windows to boot"
sleep 10 sleep 10
${ssh "ver"} ${ssh "ver"}
${installCondaPkgs [artiqPkg]} for pkg in ${artiqPkg}/noarch/*.tar.bz2 ; do
${installCondaPkg "$pkg"}
done
# Allow tests to run for 2 minutes # 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"} ${ssh "miniconda\\scripts\\activate && miniconda\\python -m unittest discover -v artiq.test"}
@ -76,4 +73,13 @@ stdenv.mkDerivation {
installPhase = '' installPhase = ''
echo Done 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)