Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize FMCDAQ3, ADRV9361_BOB, SYNCHRONA #20

Open
wants to merge 17 commits into
base: reorganize_tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified main_tests/adrv1_crr_test/crr_test.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/production.sh
100644 → 100755
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_audio.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_clk.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_eth.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_nav.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_periph.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv1_crr_test/test_usb.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/breakout_test.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/dcxo_test.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/mac_write.sh
100755 → 100644
Empty file.
30 changes: 18 additions & 12 deletions main_tests/adrv9361_bob/production.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@
# printf "\033[1;31mPlease run calibration first\033[m\n"
# handle_error_state "$BOARD_SERIAL"
# fi
$SCRIPT_DIR/adrv9361_bob/rf_test.sh
FAILED_TESTS=$?
if [ $FAILED_TESTS -ne 255 ]; then
$SCRIPT_DIR/adrv9361_bob/test_uart.sh
FAILED_UART=$?
if [ $FAILED_UART -ne 255 ]; then
ssh_cmd "sudo /home/analog/adrv9361_bob/breakout_test.sh"
FAILED_MISC=$?
fi
fi
if [ $FAILED_TESTS -ne 0 ] || [ $FAILED_UART -ne 0 ] || [ $FAILED_MISC -ne 0 ]; then

SCRIPT_DIR="$(readlink -f $(dirname $0))"

source $SCRIPT_DIR/../lib/utils.sh

$SCRIPT_DIR/rf_test.sh || {
handle_error_state "$BOARD_SERIAL"
exit 1
}

$SCRIPT_DIR/test_uart.sh || {
handle_error_state "$BOARD_SERIAL"
exit 1
}

ssh_cmd "sudo /home/analog/adrv9361_bob/breakout_test.sh" || {
handle_error_state "$BOARD_SERIAL"
fi
exit 1
}
2 changes: 1 addition & 1 deletion main_tests/adrv9361_bob/rf_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ANSWER=1
SCRIPT_DIR="$(readlink -f $(dirname $0))"

echo
python3 -m pytest --color yes -vs $SCRIPT_DIR/../work/pyadi-iio/test/test_fmcomms2-3_prod.py --uri="ip:analog.local" --adi-hw-map --hw=adrv9361
python3 -m pytest --color yes -vs $SCRIPT_DIR/../work/pyadi-iio/test/test_adrv9361_prod.py --uri="ip:analog.local" --adi-hw-map --hw=adrv9361
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this test_adrv9361_prod.py file actually exist?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added in the fmcomms_scpi branch, commit 476bbcc.

ANSWER=$?
exit $ANSWER
Empty file modified main_tests/adrv9361_bob/test_ethernet.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/test_gpio.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/test_qspi.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/test_usb.sh
100755 → 100644
Empty file.
Empty file modified main_tests/adrv9361_bob/test_util.sh
100755 → 100644
Empty file.
Empty file modified main_tests/autosave_logs.sh
100644 → 100755
Empty file.
19 changes: 19 additions & 0 deletions main_tests/fmcdaq3/production.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

SCRIPT_DIR="$(readlink -f $(dirname $0))"
source "$SCRIPT_DIR/../lib/utils.sh"

MODE="$1"
case $MODE in
"FMCDAQ3 Test")
"$SCRIPT_DIR/rf_test.sh";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the quotation marks?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the quotes to allow for spaces in the file path. Not absolutely necessary for the prodtest images - this is likely a harmless leftover from one of my test runs. Should I remove it the quotes consistency's sake?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

TEST_RESULT=$?
if [ $TEST_RESULT -ne 0 ]; then
handle_error_state "$BOARD_SERIAL"
exit 1;
fi
;;

*) echo "Invalid option $MODE" ;;
esac

7 changes: 7 additions & 0 deletions main_tests/fmcdaq3/rf_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SCRIPT_DIR="$(readlink -f $(dirname $0))"

echo
python3 -m pytest --color yes -vs $SCRIPT_DIR/../work/pyadi-iio/test/test_daq3_prod.py --uri="ip:analog.local" --adi-hw-map --hw=daq3 --snumber="$BOARD_SERIAL"
ANSWER=$?
exit $ANSWER

Empty file modified main_tests/fmcomms2-3/dcxo_test.sh
100644 → 100755
Empty file.
Empty file modified main_tests/fmcomms2-3/production.sh
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion main_tests/lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ show_start_state() {
get_board_serial() {
IS_OKBOARD=1
while [ $IS_OKBOARD -ne 0 ]; do
echo "Please use the scanner to scan the QR/Barcode on your carrier"
echo "Please use the scanner to scan the QR/Barcode on your carrier" 1>&2
read BOARD_SERIAL
echo $BOARD_SERIAL | grep "S[0-9][0-9]" | grep "SN" &>/dev/null
IS_OKBOARD=$?
done
echo $BOARD_SERIAL
}

dut_date_sync() {
Expand Down
38 changes: 38 additions & 0 deletions main_tests/production_FMCDAQ3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Wrapper script for doing a production cycle/routine for fmcdaq3.
# This script handles
#
# Can be called with: ./production_FMCDAQ3.sh
#

SCRIPT_DIR="$(readlink -f $(dirname $0))"

source $SCRIPT_DIR/lib/production.sh
source $SCRIPT_DIR/lib/utils.sh

while true; do
echo_blue "Please enter your choice: "
options=("FMCDAQ3 Test" "Power-Off Carrier" "Power-Off Pi")
select opt in "${options[@]}"; do
case $REPLY in
1)
wait_for_board_online
export BOARD_SERIAL=$(get_board_serial)
echo_blue "Starting FMCDAQ3 Test"
production "crr" "$opt" "FMCDAQ3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's outside the scope of this pull request, but for future reference I think the "crr"/target parameter is redundant, i think only talise uses it for something minor. Perhaps it should be removed in future versions

break ;;
2)
wait_for_board_online
ssh_cmd "sudo poweroff &>/dev/null"
break ;;
3)
enforce_root
poweroff
break ;;

*) echo "invalid option $REPLY";;
esac
done
done

Empty file modified main_tests/production_FMCOMMS2-3.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion main_tests/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source $SCRIPT_DIR/supported_boards.sh
# function to create a directory and test file"
create_board_test_file() {
read -p "Enter a board name: " board
touch &SCRIPT_DIR/production_${board^^}.sh
touch $SCRIPT_DIR/production_${board^^}.sh
chmod +x production_${board^^}.sh
mkdir ${board,,}
touch ${board,,}/production.sh
Expand Down
89 changes: 76 additions & 13 deletions main_tests/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,61 @@ setup_apt_install_prereqs() {
sudo_required
sudo -s <<-EOF
apt-get -y update
apt-get -y install bc sshpass libfftw3-dev librsvg2-dev libgtk-3-dev \
apt-get -y -o DPkg::Lock::Timeout=60 install \
bc sshpass libfftw3-dev librsvg2-dev libgtk-3-dev \
cmake build-essential git libxml2 libxml2-dev bison flex \
expect usbutils dfu-util screen libaio-dev libglib2.0-dev picocom \
wget unzip curl cups cups-bsd intltool itstool libxml2-utils \
libusb-dev libusb-1.0-0-dev htpdate xfce4-terminal libiec16022-dev \
openssh-server gpg dnsmasq libcurl4-gnutls-dev libqrencode-dev pv \
python3-pytest python3-libiio python3-scapy python3-scipy
python3-pytest python3-libiio python3-scapy python3-scipy libzstd-dev \
python3.7 python3-pip
/etc/init.d/htpdate restart
EOF
}

__common_build_tool() {
local c_files
mkdir -p work
setup_pip_install_prereqs() {
sudo_required
sudo -s <<-EOF
pip install --upgrade pip setuptools
EOF
}

for c_file in $tool_c ; do
cp -f "src/$c_file" "work/$c_file"
c_files="$c_files work/$c_file"
done
gcc $c_files -o "work/$tool" $cflags $ldflags
download_to() {
local url="$1"
local file="$2"

wget "$url" -O "$file" || {
echo_red "Download has failed..."
rm -f "$file"
return 1
}

return 0
}

download_and_unzip_to() {
local url="$1"
local dir="$2"

local tmp_file="$(mktemp)"

download_to "$url" "$tmp_file" || return 1

unzip "$tmp_file" -d "$dir" || {
echo_red "Unzip has failed..."
rm -f "$tmp_file"
return 1
}
rm -f "$tmp_file"

return 0
}

get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}

__download_github_common() {
Expand Down Expand Up @@ -100,6 +135,23 @@ setup_libiio() {
popd
}

setup_genalyzer() {
[ ! -d "work/genalyzer" ] || return 0

__download_github_common genalyzer

pushd work
mkdir -p genalyzer/build
pushd genalyzer/build

cmake ../ -DPYTHON_BINDINGS=ON
make -j3
sudo make install

popd
popd
}

setup_adm1266() {
[ ! -d "src/adm1266" ] || return 0
#tbd : remove all redundant if BOARD checks ==removed==
Expand Down Expand Up @@ -300,7 +352,6 @@ hdmi_cvt=800 480 60 6 0 0 0
hdmi_drive=1
max_usb_current=1

dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
# --- end setup_env.sh
EOF
Expand Down Expand Up @@ -391,6 +442,16 @@ dhcp-range=192.168.0.100,192.168.0.150,24h
EOF
}

setup_sync_datetime() {
sudo_required

# Try to use NTP. May fail if there is no timesync service (e.g. systemd-timesyncd)
sudo timedatectl set-ntp true && return

# Alternatively, use a much less precise source, but still good enough for certificates to be valid
sudo date +"%d %b %Y %T %Z" -s "$(curl -s --head http://google.com | grep '^Date:' | cut -d' ' -f 3-)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a nitpick but since this step and prereqs install require internet, maybe it would be useful to add a short connection check in the beginning of the script, to avoid going further if the device is not connected to the internet (maybe just a ping?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does def3e61 look alright?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

}


## Board Function Area ##

Expand Down Expand Up @@ -447,8 +508,8 @@ pushd $SCRIPT_DIR

#TBD: move specific functions from this list into setup_board function
STEPS="bashrc_update disable_sudo_passwd misc_profile_cleanup raspi_config xfce4_power_manager_settings"
STEPS="$STEPS thunar_volman disable_lxde_automount apt_install_prereqs"
STEPS="$STEPS write_autostart_config libiio"
STEPS="$STEPS thunar_volman disable_lxde_automount sync_datetime apt_install_prereqs pip_install_prereqs"
STEPS="$STEPS write_autostart_config libiio genalyzer"
STEPS="$STEPS pi_boot_config disable_pi_screen_blanking"
STEPS="$STEPS dhcp_config telemetry $BOARD"

Expand All @@ -465,6 +526,8 @@ if [ "$RAN_ONCE" == "0" ] ; then
for step in $STEPS ; do
echo_red " $step"
done
else
echo_red "To properly finish the setup, reboot!"
fi

popd
2 changes: 1 addition & 1 deletion main_tests/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Global definitions section #
#----------------------------------#

LD_LIBRARY_PATH="$SCRIPT_DIR/work/libiio/build"
LD_LIBRARY_PATH="$SCRIPT_DIR/work/libiio/build:$LD_LIBRARY_PATH"
PATH="$SCRIPT_DIR/work/libiio/build/tests:$PATH"

export LD_LIBRARY_PATH
Expand Down