windows: Adapt tests to new build infra

This commit is contained in:
adisbladis 2020-01-27 10:31:26 +00:00 committed by Stephan Maka
parent 9f3e515c01
commit 738ce24d9c
3 changed files with 8 additions and 11 deletions

View File

@ -2,10 +2,9 @@
{ pkgs ? import <nixpkgs> {}
, artiqpkgs ? import ../. { inherit pkgs; }
, diskImage ? "/opt/windows/c.img"
, diskImage ? (import ./build.nix { inherit pkgs; })
, qemuMem ? "2G"
, testTimeout ? 180
,
}:
with pkgs;

View File

@ -1,5 +1,4 @@
{ pkgs
, diskImage
, qemuMem
, sshUser ? "user"
, sshPassword ? "user"

View File

@ -1,7 +1,7 @@
{ pkgs
, sipycoPkg
, artiqPkg
, diskImage ? "/opt/windows/c.img"
, diskImage ? (import ./build.nix { inherit pkgs; })
, qemuMem ? "2G"
, testTimeout ? 600
, testCommand ? "python -m unittest discover -v sipyco.test && python -m unittest discover -v artiq.test"
@ -14,7 +14,6 @@ let
escape = builtins.replaceStrings [ "\\" ] [ "\\\\" ];
qemu = import ./qemu.nix {
inherit pkgs qemuMem;
diskImage = "c.img";
};
# Double-escape because we produce a script from a shell heredoc
ssh = cmd: qemu.ssh (escape cmd);
@ -34,7 +33,9 @@ in
stdenv.mkDerivation {
name = "windows-test-runner";
src = ./.;
# Dummy sources
src = pkgs.runCommandNoCC "" {} "touch $out";
propagatedBuildInputs = qemu.inputs;
dontBuild = true;
@ -44,16 +45,14 @@ stdenv.mkDerivation {
#!/usr/bin/env bash
set -e -m
# +1 day from last modification of the disk image
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
cp ${diskImage} c.img
${qemu.runQemu true forwardedPorts [
"-boot"
"order=c"
"-snapshot"
"-drive"
"file=${diskImage},index=0,media=disk,cache=unsafe"
"-rtc"
"base=\\$CLOCK"
"file=c.img,index=0,media=disk,cache=unsafe"
"-display"
"none"
]} &