Compare commits

...

2 Commits

Author SHA1 Message Date
Harry Ho 00d47de59a Update README 2021-06-18 15:49:39 +08:00
Harry Ho 0ef521c516 Add auto test scripts for M-Labs and Creotech setups 2021-06-18 15:49:21 +08:00
3 changed files with 105 additions and 7 deletions

View File

@ -1,20 +1,30 @@
## Scripts
## Automatic Test Scripts
### Python
#### Shell
(Remember to **edit the settings** in `rp_ping_test` and `rp_shutdown` and the **test arguments** passed to `get_and_plot_sayma_data` according to your own setup!)
* `test_mlabs`: Run an automatically-timed test using M-Labs' current setup
* `test_creotech`: Run an automatically-timed test using Creotech's current setup
## Data Collection & Analytics Tools
#### Python
(To see detailed usage, add `--help` as an argument when running the script.)
* `rp_get_sayma_data.py`: Acquire and save data from RedPitayas over local network
* `plot_sayma_data.py`: Load saved data and output phase skew analysis and data plots
### Shell
#### Shell
* `get_and_plot_sayma_data`: Acquire and analyse data from RedPitayas over local network
* `get_and_plot_remote_sayma_data`: Acquire and analyse data from remote RedPitayas via SSH (often over different networks) to the local file system
* Requires Python testsuite scripts present on the remote host
## System Utilities
#### Shell
* `mch_start`: Power on the MCH and start logging serial outputs from Metlino and Saymas
* `mch_stop`: Power off the MCH and stop logging serial outputs from Metlino and Saymas
* `rp_ping_test`: Loop to ping a RedPitaya until it succeeds
* The exit condition is where the RedPitaya is ready-to-use
* `rp_shutdown`: Shut down the OS of a RedPitaya and loop to ping it until it fails
* The exit condition is where the RedPitaya is ready for hardware power-off
* `get_and_plot_sayma_data`: Acquire and analyse data from RedPitayas over local network
* `get_and_plot_remote_sayma_data`: Acquire and analyse data from remote RedPitayas via SSH (often over different networks) to the local file system
* Requires Python testsuite scripts present on the remote host

37
test_creotech Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
# Simultaneously, start testing RP's network connectivity, while
# powering on MCH and RP using ~/power_strip/ scripts
# Display power-on time
TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S')
echo "MCH & RP powered on at $TIMESTAMP_PRETTY."
# Test RP network connectivity
# NOTE: Change $RP_HOST inside `rp_ping_test` for your own setup!
./rp_ping_test &
# Power on MCH
./mch_start &
# Wait 2 minutes before measurement
sleep 120
# Get and plot Sayma data
# (Assumption: numpy, matplotlib and scipy have been installed on local)
# (Assumption: directory ./creotech-raw exists)
# NOTE: Change the RP hostname and LV/HV arguments according to
# which two channels you are measuring!
./get_and_plot_sayma_data creotech-raw creotech-1 1 creotech-1 2 creotech-1:LV,LV &
# Wait 1 minute before powering off MCH and RP
sleep 60
# Issue shutdown on RP, and wait until RP is disconnected
# NOTE: Change $RP_HOST, $RP_USER & $RP_KEY inside
# `rp_shutdown` for your own setup!
./rp_shutdown &
# Wait 30 seconds
sleep 30
# Simultaneously power off MCH and RP
# Display power-off time
TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S')
echo "MCH & RP powered off at $TIMESTAMP_PRETTY."
# Power off MCH
./mch_stop

51
test_mlabs Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
# tnetplug host
export TNETPLUG_HOST=192.168.1.31
export TNETPLUG_PORT=3131
# Smart USB hub host
# (uhubctl must be installed on the host)
export HOST=rpi-3
export HOSTPORT=22
# Hub port where the RedPitaya is connected
export HUBPORT=4
# Simultaneously, start testing RP's network connectivity, while
# powering on MCH using tnetplug, and RP using uhubctl
# Display power-on time
TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S')
echo "MCH & RP powered on at $TIMESTAMP_PRETTY."
# Test RP network connectivity
# NOTE: Change $RP_HOST inside `rp_ping_test` for your own setup!
./rp_ping_test &
# Power on MCH
echo "A" | nc -W1 $TNETPLUG_HOST $TNETPLUG_PORT &
# Power on RedPitaya connected to the smart USB hub
# (assume that only 1 hub is connected)
ssh -p $HOSTPORT $HOST "uhubctl -a on -p $HUBPORT" &
# Wait 2 minutes before measurement
sleep 120
# Get and plot Sayma data
# NOTE: Change the RP hostname and LV/HV arguments according to
# which two channels you are measuring!
nix-shell -p python3Packages.matplotlib python3Packages.numpy python3Packages.scipy --run "./get_and_plot_sayma_data mlabs-raw mlabs-1 1 mlabs-1 2 mlabs-1:LV,LV" &
# Wait 1 minute before powering off MCH and RP
sleep 60
# Issue shutdown on RP, and wait until RP is disconnected
# NOTE: Change $RP_HOST, $RP_USER & $RP_KEY inside
# `rp_shutdown` for your own setup!
./rp_shutdown &
# Wait 30 seconds
sleep 30
# Simultaneously power off MCH and RP
# Display power-off time
TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S')
echo "MCH & RP powered off at $TIMESTAMP_PRETTY."
# Power off MCH
echo "a" | nc -W1 $TNETPLUG_HOST $TNETPLUG_PORT &
# Power off RedPitaya connected to the smart USB hub
ssh -p $HOSTPORT $HOST "uhubctl -a off -p $HUBPORT"