forked from M-Labs/nix-scripts
windows tests: run tests for standalone and kc705_nist_clock
This commit is contained in:
parent
f3fca76dd6
commit
858b3de2e4
|
@ -34,46 +34,62 @@ let
|
|||
ssh = qemu.ssh;
|
||||
scp = qemu.scp;
|
||||
condaEnv = "artiq-env";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "windows-test-conda-artiq";
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = import generateTestOkHash;
|
||||
__hydraRetry = false;
|
||||
makeTest = name: testCommand:
|
||||
stdenv.mkDerivation {
|
||||
name = "windows-test-conda-artiq-${name}";
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
buildInputs = qemu.inputs;
|
||||
buildPhase = ''
|
||||
# +1 day from last modification of the disk image
|
||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||
${qemu.runQemu [
|
||||
"-boot" "order=c"
|
||||
"-snapshot"
|
||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||
"-rtc" "base=$CLOCK"
|
||||
]} &
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = import generateTestOkHash;
|
||||
__hydraRetry = false;
|
||||
|
||||
echo "Wait for Windows to boot"
|
||||
sleep 10
|
||||
${ssh "ver"}
|
||||
for pkg in ${artiqPkg}/noarch/artiq*.tar.bz2 ; do
|
||||
${scp "\$pkg" "artiq.tar.bz2"}
|
||||
${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install artiq.tar.bz2"}
|
||||
done
|
||||
phases = [ "buildPhase" ];
|
||||
buildInputs = qemu.inputs;
|
||||
buildPhase = ''
|
||||
# +1 day from last modification of the disk image
|
||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||
${qemu.runQemu [
|
||||
"-boot" "order=c"
|
||||
"-snapshot"
|
||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||
"-rtc" "base=$CLOCK"
|
||||
"-display" "none"
|
||||
]} &
|
||||
|
||||
# Allow tests to run for 2 minutes
|
||||
${ssh "shutdown -s -t ${toString testTimeout}"}
|
||||
echo "Wait for Windows to boot"
|
||||
sleep 10
|
||||
${ssh "ver"}
|
||||
for pkg in ${artiqPkg}/noarch/artiq*.tar.bz2 ; do
|
||||
${scp "\$pkg" "artiq.tar.bz2"}
|
||||
${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install artiq.tar.bz2"}
|
||||
done
|
||||
|
||||
${ssh "anaconda\\scripts\\activate ${condaEnv} && python -m unittest discover -v artiq.test"}
|
||||
# Allow tests to run for 2 minutes
|
||||
${ssh "shutdown -s -t ${toString testTimeout}"}
|
||||
|
||||
# Abort timeouted shutdown
|
||||
${ssh "shutdown -a"}
|
||||
# Power off immediately
|
||||
${ssh "shutdown -p -f"}
|
||||
${testCommand}
|
||||
|
||||
mkdir $out
|
||||
cp ${artiqVersion} $out/passed
|
||||
'';
|
||||
}
|
||||
# Abort timeouted shutdown
|
||||
${ssh "shutdown -a"}
|
||||
# Power off immediately
|
||||
${ssh "shutdown -p -f"}
|
||||
|
||||
mkdir $out
|
||||
cp ${artiqVersion} $out/passed
|
||||
'';
|
||||
};
|
||||
in {
|
||||
standalone =
|
||||
makeTest "standalone"
|
||||
(ssh "anaconda\\scripts\\activate ${condaEnv} && python -m unittest discover -v artiq.test");
|
||||
kc705 =
|
||||
makeTest "kc705"
|
||||
# This weirdly mangled syntax is legit for Windows
|
||||
(ssh (builtins.replaceStrings [ "\n" ] [ "" ] ''
|
||||
anaconda\scripts\activate ${condaEnv}
|
||||
&& set ARTIQ_ROOT=%cd%\anaconda\envs\artiq-env\Lib\site-packages\artiq\examples\kc705_nist_clock
|
||||
&& set ARTIQ_LOW_LATENCY=1
|
||||
&& python -m unittest discover -v artiq.test.coredevice
|
||||
''));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ let
|
|||
args = [
|
||||
"-enable-kvm"
|
||||
"-m" qemuMem
|
||||
"-display" "none"
|
||||
"-bios" "${OVMF.fd}/FV/OVMF.fd"
|
||||
"-netdev" "user,id=n1,restrict=on,hostfwd=tcp::2022-:22" "-device" "e1000,netdev=n1"
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue