windows: Adapt tests to new build infra

wfvm
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> {} { pkgs ? import <nixpkgs> {}
, artiqpkgs ? import ../. { inherit pkgs; } , artiqpkgs ? import ../. { inherit pkgs; }
, diskImage ? "/opt/windows/c.img" , diskImage ? (import ./build.nix { inherit pkgs; })
, qemuMem ? "2G" , qemuMem ? "2G"
, testTimeout ? 180 , testTimeout ? 180
,
}: }:
with pkgs; with pkgs;

View File

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

View File

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