You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.8 KiB

  1. let
  2. pkgs = import <nixpkgs> { overlays = [ (import ./artiq-fast/mozilla-overlay.nix) ]; };
  3. artiq-zynq = import <artiq-zynq>;
  4. artiq-fast = import <artiq-fast> { inherit pkgs; };
  5. zynq-rs = import artiq-zynq.zynq-rs;
  6. # New zynq-rs versions with Kasli-SoC support have the multiboard "szl" package.
  7. # Older versions need the SZL environment variable set to the SZL ELF to be loaded.
  8. szlEnv = if zynq-rs ? "szl" then "${zynq-rs.szl}" else "${zynq-rs.zc706-szl}/szl.elf";
  9. in
  10. (
  11. builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiq-zynq
  12. ) // {
  13. gateware-sim = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
  14. name = "gateware-sim";
  15. buildInputs = [ artiq-fast.migen artiq-fast.migen-axi artiq-fast.artiq ];
  16. phases = [ "buildPhase" ];
  17. buildPhase =
  18. ''
  19. python -m unittest discover ${<artiq-zynq>}/src/gateware -v
  20. touch $out
  21. '';
  22. });
  23. zc706-hitl-tests = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
  24. name = "zc706-hitl-tests";
  25. # requires patched Nix
  26. __networked = true;
  27. buildInputs = [
  28. pkgs.netcat pkgs.openssh pkgs.rsync artiq-fast.artiq artiq-fast.artiq-netboot
  29. ];
  30. phases = [ "buildPhase" ];
  31. buildPhase =
  32. ''
  33. export NIX_SSHOPTS="-F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -i /opt/hydra_id_rsa"
  34. LOCKCTL=$(mktemp -d)
  35. mkfifo $LOCKCTL/lockctl
  36. cat $LOCKCTL/lockctl | ${pkgs.openssh}/bin/ssh \
  37. $NIX_SSHOPTS \
  38. rpi-4 \
  39. 'mkdir -p /tmp/board_lock && flock /tmp/board_lock/zc706-1 -c "echo Ok; cat"' \
  40. | (
  41. # End remote flock via FIFO
  42. atexit_unlock() {
  43. echo > $LOCKCTL/lockctl
  44. }
  45. trap atexit_unlock EXIT
  46. # Read "Ok" line when remote successfully locked
  47. read LOCK_OK
  48. echo Power cycling board...
  49. (echo b; sleep 5; echo B; sleep 5) | nc -N -w6 192.168.1.31 3131
  50. echo Power cycle done.
  51. export USER=hydra
  52. export OPENOCD_ZYNQ=${artiq-zynq.zynq-rs}/openocd
  53. export SZL=${szlEnv}
  54. pushd ${<artiq-zynq>}
  55. bash ${<artiq-zynq>}/remote_run.sh -h rpi-4 -o "$NIX_SSHOPTS" -d ${artiq-zynq.zc706-nist_qc2-jtag}
  56. popd
  57. echo Waiting for the firmware to boot...
  58. sleep 15
  59. echo Running test kernel...
  60. artiq_run --device-db ${<artiq-zynq>}/examples/device_db.py ${<artiq-zynq>}/examples/mandelbrot.py
  61. echo Running ARTIQ unit tests...
  62. export ARTIQ_ROOT=${<artiq-zynq>}/examples
  63. export ARTIQ_LOW_LATENCY=1
  64. python -m unittest discover artiq.test.coredevice -v
  65. touch $out
  66. echo Completed
  67. (echo b; sleep 5) | nc -N -w6 192.168.1.31 3131
  68. echo Board powered off
  69. )
  70. '';
  71. });
  72. }