-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* burns eeprom if contents is empty * flashes firmware if to flash if empty * starts test runner on login * test runner executes certain scripts prefixed with 000- * added first couple of tests
- Loading branch information
1 parent
04acfc8
commit bddf4df
Showing
9 changed files
with
164 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
# Copyright (C) 2023 Sam Edwards <CFSworks@gmail.com> | ||
# Copyright (C) 2024 Sven Rademakers <sven.rademakers@gmail.com> | ||
|
||
installer_marker=/install.txt | ||
# load EEPROM data | ||
tpi_info | ||
|
||
# The installer doesn't have any concept of "safe mode," so if this is | ||
# requested, the user is most likely trying to say that the installer should | ||
# NOT run. Perhaps the user is trying to get into safe mode to erase the | ||
# installer microSD card because it's too inconvenient to remove? | ||
if test "${bootmode}" != "safemode"; then | ||
echo Checking ${installer_marker}... | ||
if test -e ${devtype} ${devnum}:${distro_bootpart} ${installer_marker}; then | ||
echo ...exists: entering installer | ||
if test -z "${tpi_crc_ok}"; then | ||
echo new eeprom detected, burning default.. | ||
run burn_eeprom | ||
|
||
# read hardware version from EEPROM | ||
tpi_info hw_version tpi_hw_version | ||
linux_bootpart=2 | ||
linux_bootpart=2 | ||
|
||
# Load image, initramfs, and FDT | ||
if load ${devtype} ${devnum}:${linux_bootpart} ${loadaddr} /boot/turing-pi2.itb \ | ||
&& load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/install.img | ||
then | ||
env set bootargs loglevel=4 | ||
bootm ${loadaddr}#config-${tpi_hw_version:-v2.4.0} ${ramdisk_addr_r} | ||
fi | ||
else | ||
echo ...does not exist: proceeding with normal boot | ||
# Load image, initramfs, and FDT | ||
if load ${devtype} ${devnum}:${linux_bootpart} ${loadaddr} /boot/turing-pi3.itb && \ | ||
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/install.img; then | ||
env set bootargs loglevel=4 skip_confirm | ||
bootm ${loadaddr}#config-${tpi_hw_version} ${ramdisk_addr_r} | ||
fi | ||
else | ||
echo firmware already burned, continuing with boot.. | ||
fi |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Prompt the user for input | ||
echo "Please enter some text:" | ||
|
||
# Read the user input | ||
read user_input | ||
|
||
# Echo the input back to the user | ||
echo "You entered: $user_input" | ||
|
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Extract the gateway address for the eth0 interface | ||
gateway=$(ip route show dev eth0 | grep default | awk '{print $3}') | ||
|
||
# Check if the gateway was found | ||
if [ -z "$gateway" ]; then | ||
echo "No gateway found for eth0" | ||
exit 1 | ||
fi | ||
|
||
ping -c 4 "${gateway}" | ||
|
||
tpi power on | ||
|
||
echo "go to your router and verify all 4 nodes are present in the DHCP client list" | ||
echo "Press Enter to continue..." | ||
read -r |
28 changes: 28 additions & 0 deletions
28
tp2bmc/board/tp2bmc/overlay/factory/003-nodes_usb_and_power_test.sh
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
source helpers.sh | ||
|
||
for n in (0..3) | ||
do | ||
tpi advanced msd --node "${n}" | ||
exit_code=$? | ||
sleep 3 | ||
echo "Node ${n} is exposed as a mass storage device. Go to your computer and verify you can connect to the drive." | ||
|
||
if [[ $exit_code -ne 0 ]]; then | ||
if try_again; then | ||
tpi advanced msd --node "${n}" | ||
sleep 8 | ||
else | ||
tpi advanced normal --node "${n}" | ||
exit 1 | ||
fi | ||
else | ||
if ! confirm; then | ||
tpi advanced normal --node "${n}" | ||
exit 1 | ||
fi | ||
fi | ||
tpi advanced normal --node "${n}" | ||
done | ||
|
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# | ||
try_again() { | ||
while true; do | ||
read -p "Do you want to try again? [Y/n]: " -r REPLY | ||
# If the user presses Enter or types 'y'/'Y' | ||
if [[ -z "$REPLY" || "$REPLY" =~ ^[Yy]$ ]]; then | ||
return 0 | ||
# If the user types 'n'/'N' | ||
elif [[ "$REPLY" =~ ^[Nn]$ ]]; then | ||
return 1 | ||
else | ||
# Prompt the user to try again for invalid input | ||
echo "Invalid input, please try again." | ||
fi | ||
done | ||
} | ||
|
||
confirm() { | ||
while true; do | ||
read -p "Do you want to continue? [Y/n]: " -r REPLY | ||
# If the user presses Enter or types 'y'/'Y' | ||
if [[ -z "$REPLY" || "$REPLY" =~ ^[Yy]$ ]]; then | ||
echo "Confirmed" | ||
return 0 | ||
# If the user types 'n'/'N' | ||
elif [[ "$REPLY" =~ ^[Nn]$ ]]; then | ||
echo "Cancelled" | ||
return 1 | ||
else | ||
# Prompt the user to try again for invalid input | ||
echo "Invalid input, please try again." | ||
fi | ||
done | ||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
# Define color codes | ||
RED='\033[0;31m' | ||
YELLOW='\033[0;33m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
|
||
# Define the directory to search | ||
TEST_DIR="/factory" | ||
NON_EXECUTABLE_FILES=() | ||
EXIT_CODE=0 | ||
|
||
nr_of_executed_tests=0 | ||
# Iterate over files in the test directory that are prefixed with 3 numbers | ||
# followed by a dash. e.g. "999-" | ||
for FILE in "$TEST_DIR"/[0-9][0-9][0-9]-*; do | ||
# Check if the file exists and is executable | ||
if [[ -x "$FILE" ]]; then | ||
FILENAME=$(basename "$FILE") | ||
test_id="${FILENAME:0:3}" | ||
test_name="${FILENAME:4}" | ||
test_name="${test_name%%.*}" | ||
test_name="${test_name//_/ }" | ||
|
||
echo -e " [${test_id}] Running ${test_name}...\t" | ||
"$FILE" | ||
EXIT_CODE=$? | ||
|
||
# Increment the counter | ||
((nr_of_executed_tests++)) | ||
echo -ne " [${test_id}] ${test_name} => " | ||
if [[ $EXIT_CODE -ne 0 ]]; then | ||
echo -e "${RED}FAIL:${NC} exited with code $EXIT_CODE" | ||
break | ||
else | ||
echo -e "${GREEN}OK${NC}" | ||
fi | ||
else | ||
NON_EXECUTABLE_FILES+=("$FILE") | ||
fi | ||
done | ||
|
||
if [[ ${#NON_EXECUTABLE_FILES[@]} -ne 0 ]]; then | ||
echo -e "${YELLOW}Warning: skipped the following files as they are not executable or do not exist:${NC}" | ||
for NON_EXECUTABLE_FILE in "${NON_EXECUTABLE_FILES[@]}"; do | ||
echo -e "\t$NON_EXECUTABLE_FILE" | ||
done | ||
fi | ||
|
||
if [[ $EXIT_CODE -eq 0 ]]; then | ||
echo -e "${GREEN}${nr_of_executed_tests} tests executed successfully.${NC}" | ||
fi | ||
exit $EXIT_CODE | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/factory/run_all_tests.sh |
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