From a0aa821dea0c2fedcbe4ed9b11890b3a177b727f Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Sat, 13 Apr 2019 15:50:58 +0200 Subject: [PATCH] windows tests: run for only conda-artiq Reverts b660ad6, addresses https://github.com/astro/nix-scripts/commit/b660ad672377c72faac22e325c0bd2e7894737a1#commitcomment-33133559 --- artiq/windows/default.nix | 85 +++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 47 deletions(-) diff --git a/artiq/windows/default.nix b/artiq/windows/default.nix index 5eb72e3..8ae311c 100644 --- a/artiq/windows/default.nix +++ b/artiq/windows/default.nix @@ -2,7 +2,7 @@ diskImage ? "/opt/windows/c.img", qemuMem ? "2G", testTimeout ? 120, - artiq ? import ./.. { inherit pkgs; }, + artiqPkg ? import ../conda-artiq.nix { inherit pkgs; }, }: with pkgs; @@ -43,50 +43,41 @@ let ${ssh "miniconda\\Scripts\\conda install -y -n ${condaEnv} $F"} ${ssh "del $F"} ''; - makeTest = name: artiqPkg: - stdenv.mkDerivation { - name = "windows-test-${name}"; - src = ./.; - dontBuild = true; - installPhase = '' - mkdir $out - ''; - doCheck = true; - checkInputs = [ qemu sshpass openssh ]; - checkPhase = '' - # +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 ${condaEnv} && miniconda\\envs\\${condaEnv}\\python -m unittest discover -v artiq.test"} - - # Abort timeouted shutdown - ${ssh "shutdown -a"} - # Power off immediately - ${ssh "shutdown -p -f"} - ''; - }; - 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) + stdenv.mkDerivation { + name = "windows-test-conda-artiq"; + src = ./.; + dontBuild = true; + installPhase = '' + mkdir $out + ''; + doCheck = true; + checkInputs = [ qemu sshpass openssh ]; + checkPhase = '' + # +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 ${condaEnv} && miniconda\\envs\\${condaEnv}\\python -m unittest discover -v artiq.test"} + + # Abort timeouted shutdown + ${ssh "shutdown -a"} + # Power off immediately + ${ssh "shutdown -p -f"} + ''; + }