diff --git a/jupyter-notebooks/test_template.ipynb b/jupyter-notebooks/test_template.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..9d3553517b38f2a6ebdd1f54dc8cb5a461de4909 --- /dev/null +++ b/jupyter-notebooks/test_template.ipynb @@ -0,0 +1,328 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6bdc7054", + "metadata": {}, + "source": [ + "# Test LRx.y: Test Name\n", + "\n", + "This notebook documents test output.\n", + "\n", + "Instructions:\n", + "\n", + "1. *PRESS File -> Make a Copy*,\n", + "1. Rename the notebook to the name of the test,\n", + "1. Update the title at the top of this section,\n", + "1. Fill in the sections with empty blocks with code and text,\n", + "1. Execute the provided initialisation code,\n", + "1. Run the tests,\n", + "1. *Rerun everything top to bottom to make sure the notebook is correct*,\n", + "1. Fill in the results & verdict.\n", + "1. Export the Jupyter Notebook to PDF and upload the file to the Polarion test results page.\n", + "1. ...and you're done!" + ] + }, + { + "cell_type": "markdown", + "id": "63785004", + "metadata": {}, + "source": [ + "## Author\n", + "Descibe who ran this test, and who helped (if applicable):" + ] + }, + { + "cell_type": "markdown", + "id": "3c720d4b", + "metadata": {}, + "source": [ + "(your name)" + ] + }, + { + "cell_type": "markdown", + "id": "ff837bcb", + "metadata": {}, + "source": [ + "## Timestamp\n", + "\n", + "This test was executed at:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00418ee4", + "metadata": {}, + "outputs": [], + "source": [ + "# Run this code\n", + "import datetime\n", + "print(f\"Test was executed at {datetime.datetime.isoformat(datetime.datetime.now(), ' ')}\")" + ] + }, + { + "cell_type": "markdown", + "id": "0b4a59a5", + "metadata": {}, + "source": [ + "## Purpose\n", + "\n", + "Describe the purpose and context of this notebook, possibly including any links to external references, e.g. the Polarion reference number:" + ] + }, + { + "cell_type": "markdown", + "id": "09d4d0a1", + "metadata": {}, + "source": [ + "(purpose)" + ] + }, + { + "cell_type": "markdown", + "id": "4c6489f3", + "metadata": {}, + "source": [ + "## Methodology\n", + "\n", + "Provide a summary of how we are going to prove compliance:" + ] + }, + { + "cell_type": "markdown", + "id": "ceae21d4", + "metadata": {}, + "source": [ + "(methodology)" + ] + }, + { + "cell_type": "markdown", + "id": "9033f262", + "metadata": {}, + "source": [ + "## Initialisation\n", + "\n", + "The following sections contain boilerplate code to get the station to a well-defined state. If this is not applicable or broken, just note that here:" + ] + }, + { + "cell_type": "markdown", + "id": "00d4e336", + "metadata": {}, + "source": [] + }, + { + "cell_type": "markdown", + "id": "7532d05e", + "metadata": {}, + "source": [ + "### Hot reboot\n", + "\n", + "Makes sure the software and hardware are all in a known state." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "c7a3effa", + "metadata": {}, + "outputs": [], + "source": [ + "# Restart boot device\n", + "boot.off()\n", + "boot.initialise()\n", + "boot.on()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "b4dd21b1", + "metadata": {}, + "outputs": [], + "source": [ + "# Reboot the station\n", + "boot.boot()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "78a4db84", + "metadata": {}, + "outputs": [], + "source": [ + "# Wait for reboot to complete\n", + "import time\n", + "while boot.booting_R:\n", + " time.sleep(2)\n", + " print(f\"Initialisation at {boot.progress_R}%: {boot.status_R}\")\n", + " \n", + "assert boot.progress_R == 100, f\"Failed to fully initialise station: {boot.status_R}\"\n", + "if boot.uninitialised_devices_R:\n", + " print(f\"Warning! Did not initialise {boot.uninitialised_devices_R}. This might be inconsequential for this test.\")" + ] + }, + { + "cell_type": "markdown", + "id": "9bc072af", + "metadata": {}, + "source": [ + "### Active versions\n", + "\n", + "List the versions currently running on the station." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "35b815d4", + "metadata": {}, + "outputs": [], + "source": [ + "def summarise(l: list) -> list:\n", + " return [f\"{idx}: {version}\" for idx,version in enumerate(l) if version] or [\"no versions reported\"]\n", + "\n", + "versions = {\n", + " \"SC\": {dev.name():dev.version_R for dev in devices},\n", + " \"SDP\": {\n", + " \"FPGA firmware\": summarise(sdp.FPGA_firmware_version_R),\n", + " \"FPGA hardware\": summarise(sdp.FPGA_hardware_version_R),\n", + " \"SDPTR\": sdp.TR_software_version_R,\n", + " },\n", + " \"RECV\": {\n", + " \"PCB\": summarise(recv.RCU_PCB_version_R),\n", + " },\n", + " \"APSCT\": {\n", + " \"PCB\": apsct.APSCT_PCB_version_R,\n", + " },\n", + " \"APSPU\": {\n", + " \"PCB\": apspu.APSPU_PCB_version_R,\n", + " },\n", + " \"UNB2\": {\n", + " \"PCB\": summarise(unb2.UNB2_PCB_version_R),\n", + " }\n", + "}\n", + "\n", + "from pprint import pprint\n", + "pprint(versions, width=120)" + ] + }, + { + "cell_type": "markdown", + "id": "e51a06b7", + "metadata": {}, + "source": [ + "## Test setup\n", + "\n", + "Setup the hardware for the test:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e72dc2df", + "metadata": {}, + "outputs": [], + "source": [ + "# Your code to configure the station for this test" + ] + }, + { + "cell_type": "markdown", + "id": "772dff7c", + "metadata": {}, + "source": [ + "## Run test" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26570aea", + "metadata": {}, + "outputs": [], + "source": [ + "# Your code that triggers the actual test (if this is an explicit step)" + ] + }, + { + "cell_type": "markdown", + "id": "6c604116", + "metadata": {}, + "source": [ + "## Test results" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d290d8dd", + "metadata": {}, + "outputs": [], + "source": [ + "# plot sst in after " + ] + }, + { + "cell_type": "markdown", + "id": "d3cdb620", + "metadata": {}, + "source": [ + "## Discuss results\n", + "\n", + "How should the results be interpreted? Are there remaining worries and todo's based on this result?" + ] + }, + { + "cell_type": "markdown", + "id": "6e082c7c", + "metadata": {}, + "source": [ + "(Explain results, and caveats)" + ] + }, + { + "cell_type": "markdown", + "id": "a95fbf48", + "metadata": {}, + "source": [ + "## Verdict\n", + "\n", + "The test passed/did not pass:" + ] + }, + { + "cell_type": "markdown", + "id": "9a2a7a97", + "metadata": {}, + "source": [ + "(Explain whether the result is good enough, or what needs to be done to improve)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "StationControl", + "language": "python", + "name": "stationcontrol" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}