-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pqm: Rewrite Expect to bash, refactor DAPLINK boilerplate
- Loading branch information
Showing
6 changed files
with
217 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,7 @@ | ||
#!/bin/bash | ||
|
||
mountpoint=$(mount | awk '/DAPLINK/ { for (i=1; i<=NF; i++) if ($i ~ "/DAPLINK") print $i }') | ||
echo $mountpoint | ||
SCRIPT_DIR="$(readlink -f $(dirname $0))" | ||
source $SCRIPT_DIR/../lib/utils.sh | ||
|
||
|
||
# Start monitoring the mountpoint | ||
inotifywait -m -e unmount "$mountpoint" | ( | ||
touch $mountpoint/erase.act | ||
sync | ||
|
||
while read -r directory event filename; do | ||
echo "$mountpoint has been unmounted. Waiting for it to be mounted again..." | ||
start_time=$(date +%s) | ||
while true; do | ||
if mountpoint -q "$mountpoint"; then | ||
echo "$mountpoint has been remounted." | ||
pkill -P $$ inotifywait # Send SIGTERM to child inotifywait process | ||
break | ||
fi | ||
current_time=$(date +%s) | ||
elapsed_time=$((current_time - start_time)) | ||
if [ "$elapsed_time" -ge 30 ]; then | ||
echo "Timeout reached. $mountpoint did not remount within 30 seconds." | ||
pkill -P $$ inotifywait # Send SIGTERM to child inotifywait process | ||
break | ||
fi | ||
sleep 1 # Adjust the interval as needed | ||
done | ||
done | ||
) | ||
|
||
if [[ -f "${mountpoint}/FAIL.txt" ]]; then | ||
echo "FAILED" | ||
exit 1 | ||
else | ||
echo "no fail.txt found. SUCCESS" | ||
fi | ||
touch /tmp/erase.act | ||
daplink_upload /tmp/erase.act |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,20 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR="$(readlink -f $(dirname $0))" | ||
source $SCRIPT_DIR/../lib/utils.sh | ||
|
||
#RELEASE_FW=https://swdownloads.analog.com/cse/prod_test_rel/ev_charger_fw/ad-acevsecrdset-sl.zip | ||
FW_DOWNLOAD_PATH=/home/analog/production-tests/main_tests/pqm | ||
|
||
# cp the hex file to daplink | ||
mountpoint=$(mount | awk '/DAPLINK/ { for (i=1; i<=NF; i++) if ($i ~ "/DAPLINK") print $i }') | ||
echo $mountpoint | ||
|
||
# Start monitoring the mountpoint | ||
inotifywait -m -e unmount "$mountpoint" | ( | ||
|
||
#wget -T 5 $RELEASE_FW -O $FW_DOWNLOAD_PATH/ad-acevsecrdset-sl.zip | ||
#unzip $FW_DOWNLOAD_PATH/ad-acevsecrdset-sl.zip -d $FW_DOWNLOAD_PATH | ||
ret=$? | ||
|
||
if [ $ret == 0 ];then | ||
echo "wget success" | ||
rsync -ah -v --progress $FW_DOWNLOAD_PATH/pqm_prod_test.hex $mountpoint | ||
else | ||
echo "wget error" | ||
rsync -ah -v --progress /home/analog/production-tests/main_tests/pqm/pqm_prod_test.hex $mountpoint | ||
fi | ||
|
||
sync | ||
while read -r directory event filename; do | ||
echo "$mountpoint has been unmounted. Waiting for it to be mounted again..." | ||
start_time=$(date +%s) | ||
while true; do | ||
if mountpoint -q "$mountpoint"; then | ||
echo "$mountpoint has been remounted." | ||
pkill -P $$ inotifywait # Send SIGTERM to child inotifywait process | ||
break | ||
fi | ||
current_time=$(date +%s) | ||
elapsed_time=$((current_time - start_time)) | ||
if [ "$elapsed_time" -ge 30 ]; then | ||
echo "Timeout reached. $mountpoint did not remount within 30 seconds." | ||
pkill -P $$ inotifywait # Send SIGTERM to child inotifywait process | ||
break | ||
fi | ||
sleep 1 # Adjust the interval as needed | ||
done | ||
done | ||
) | ||
|
||
# verify if there s a FAIL.txt file | ||
#wget -T 5 $RELEASE_FW -O $FW_DOWNLOAD_PATH/ad-acevsecrdset-sl.zip | ||
#unzip $FW_DOWNLOAD_PATH/ad-acevsecrdset-sl.zip -d $FW_DOWNLOAD_PATH | ||
ret=$? | ||
|
||
if [[ -f "${mountpoint}/FAIL.txt" ]]; then | ||
echo "FAILED" | ||
exit 1 | ||
if [ $ret == 0 ];then | ||
echo "wget success" | ||
daplink_upload $FW_DOWNLOAD_PATH/pqm_prod_test.hex | ||
else | ||
echo "no fail.txt found. SUCCESS" | ||
echo "wget error" | ||
daplink_upload /home/analog/production-tests/main_tests/pqm/pqm_prod_test.hex | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.