windows tests: forward ports
This commit is contained in:
parent
82dcdaeec8
commit
e5125a85e8
@ -52,7 +52,7 @@ stdenv.mkDerivation {
|
||||
set -e -m
|
||||
|
||||
${qemu.qemu-img} create -f qcow2 c.img ${diskImageSize}
|
||||
${qemu.runQemu false [
|
||||
${qemu.runQemu false [] [
|
||||
"-boot" "order=d"
|
||||
"-drive" "file=c.img,index=0,media=disk,cache=unsafe"
|
||||
"-drive" "file=$out/data/windows.iso,index=1,media=cdrom,cache=unsafe"
|
||||
@ -65,7 +65,7 @@ stdenv.mkDerivation {
|
||||
#!/usr/bin/env bash
|
||||
set -e -m
|
||||
|
||||
${qemu.runQemu false [
|
||||
${qemu.runQemu false [] [
|
||||
"-boot" "order=c"
|
||||
"-drive" "file=c.img,index=0,media=disk"
|
||||
]} &
|
||||
|
@ -9,17 +9,24 @@ with pkgs;
|
||||
|
||||
let
|
||||
qemu-img = "${qemu_kvm}/bin/qemu-img";
|
||||
runQemu = isolateNetwork: extraArgs:
|
||||
runQemu = isolateNetwork: forwardedPorts: extraArgs:
|
||||
let
|
||||
restrict =
|
||||
if isolateNetwork
|
||||
then "on"
|
||||
else "off";
|
||||
nc = "${netcat}/bin/nc";
|
||||
# use netcat instead of `tcp:…` to allow multiple connections
|
||||
guestfwds =
|
||||
builtins.concatStringsSep ""
|
||||
(map ({ listenAddr, targetAddr, port }:
|
||||
",guestfwd=tcp:${listenAddr}:${toString port}-cmd:${nc}\\ ${targetAddr}\\ ${toString port}"
|
||||
) forwardedPorts);
|
||||
args = [
|
||||
"-enable-kvm"
|
||||
"-m" qemuMem
|
||||
"-bios" "${OVMF.fd}/FV/OVMF.fd"
|
||||
"-netdev" "user,id=n1,restrict=${restrict},hostfwd=tcp::2022-:22"
|
||||
"-netdev" "user,id=n1,net=192.168.1.0/24,restrict=${restrict},hostfwd=tcp::2022-:22${guestfwds}"
|
||||
"-device" "e1000,netdev=n1"
|
||||
];
|
||||
argStr = builtins.concatStringsSep " " (args ++ extraArgs);
|
||||
|
@ -18,6 +18,13 @@ let
|
||||
ssh = cmd: qemu.ssh (escape cmd);
|
||||
scp = qemu.scp;
|
||||
condaEnv = "artiq-env";
|
||||
tcpPorts = [ 1380 1381 1382 1383 ];
|
||||
forwardedPorts =
|
||||
map (port: {
|
||||
listenAddr = "192.168.1.50";
|
||||
targetAddr = "192.168.1.50";
|
||||
inherit port;
|
||||
}) tcpPorts;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
@ -31,7 +38,7 @@ stdenv.mkDerivation {
|
||||
cat > $out/bin/run.sh << EOF
|
||||
# +1 day from last modification of the disk image
|
||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||
${qemu.runQemu true [
|
||||
${qemu.runQemu true forwardedPorts [
|
||||
"-boot" "order=c"
|
||||
"-snapshot"
|
||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||
|
Loading…
Reference in New Issue
Block a user