1
0
Fork 0

windows tests: run tests for standalone and kc705_nist_clock

This commit is contained in:
Astro 2019-04-14 01:54:36 +02:00 committed by Sébastien Bourdeauducq
parent f3fca76dd6
commit 858b3de2e4
2 changed files with 52 additions and 37 deletions

View File

@ -34,46 +34,62 @@ let
ssh = qemu.ssh; ssh = qemu.ssh;
scp = qemu.scp; scp = qemu.scp;
condaEnv = "artiq-env"; condaEnv = "artiq-env";
in
stdenv.mkDerivation {
name = "windows-test-conda-artiq";
outputHashAlgo = "sha256"; makeTest = name: testCommand:
outputHashMode = "recursive"; stdenv.mkDerivation {
outputHash = import generateTestOkHash; name = "windows-test-conda-artiq-${name}";
__hydraRetry = false;
phases = [ "buildPhase" ]; outputHashAlgo = "sha256";
buildInputs = qemu.inputs; outputHashMode = "recursive";
buildPhase = '' outputHash = import generateTestOkHash;
# +1 day from last modification of the disk image __hydraRetry = false;
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"
]} &
echo "Wait for Windows to boot" phases = [ "buildPhase" ];
sleep 10 buildInputs = qemu.inputs;
${ssh "ver"} buildPhase = ''
for pkg in ${artiqPkg}/noarch/artiq*.tar.bz2 ; do # +1 day from last modification of the disk image
${scp "\$pkg" "artiq.tar.bz2"} CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install artiq.tar.bz2"} ${qemu.runQemu [
done "-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 echo "Wait for Windows to boot"
${ssh "shutdown -s -t ${toString testTimeout}"} 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 ${testCommand}
${ssh "shutdown -a"}
# Power off immediately
${ssh "shutdown -p -f"}
mkdir $out # Abort timeouted shutdown
cp ${artiqVersion} $out/passed ${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
''));
}

View File

@ -15,7 +15,6 @@ let
args = [ args = [
"-enable-kvm" "-enable-kvm"
"-m" qemuMem "-m" qemuMem
"-display" "none"
"-bios" "${OVMF.fd}/FV/OVMF.fd" "-bios" "${OVMF.fd}/FV/OVMF.fd"
"-netdev" "user,id=n1,restrict=on,hostfwd=tcp::2022-:22" "-device" "e1000,netdev=n1" "-netdev" "user,id=n1,restrict=on,hostfwd=tcp::2022-:22" "-device" "e1000,netdev=n1"
]; ];