Skip to content

Commit

Permalink
fixed shellcheck issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando79513 committed Mar 18, 2024
1 parent fefa2d0 commit 3f8ed0e
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 37 deletions.
2 changes: 1 addition & 1 deletion contrib/genio/bin/set_as_performance_mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ get_current_setting() {
for i in {0..2}
do
# shellcheck disable=SC2027
echo "- /sys/class/thermal/thermal_zone0/trip_point_"$i"_temp"
echo "- /sys/class/thermal/thermal_zone0/trip_point_""$i""_temp"
cat /sys/class/thermal/thermal_zone0/trip_point_"$i"_temp
done
elif [ "${1}" == "G350" ]; then
Expand Down
11 changes: 11 additions & 0 deletions contrib/genio/bin/test_1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

output=$(tr -d '\0' < /proc/device-tree/compatible)
# Set comma as delimiter
IFS=','
read -ra output_arr <<< "$output"
# Set dash as delimiter
IFS='-'
read -ra s <<< "${output_arr[1]}"
echo "SoC: ${s[0]}"
echo
2 changes: 1 addition & 1 deletion contrib/genio/bin/verify-mt8188-ccf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if [ "${NR_MISSING_CLKS}" -ne "0" ]; then
printf "[-] Missing clocks: \n"
cat missing-clocks.txt

printf "\n[-] Count missing clocks: "${NR_MISSING_CLKS}"\n"
printf "\n[-] Count missing clocks: %s\n" "${NR_MISSING_CLKS}"
else
printf "[-] Success, all clocks are mapped !\n"
fi
Expand Down
2 changes: 1 addition & 1 deletion contrib/genio/bin/verify-mt8195-ccf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if [ "${NR_MISSING_CLKS}" -ne "0" ]; then
printf "[-] Missing clocks: \n"
cat missing-clocks.txt

printf "\n[-] Count missing clocks: "${NR_MISSING_CLKS}"\n"
printf "\n[-] Count missing clocks: %s\n" "${NR_MISSING_CLKS}"
else
printf "[-] Success, all clocks are mapped !\n"
fi
Expand Down
4 changes: 2 additions & 2 deletions contrib/genio/units/device/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ command:
output=$(tr -d '\0' < /proc/device-tree/compatible)
# Set comma as delimiter
IFS=','
read -a output_arr <<< "$output"
read -ra output_arr <<< "$output"
# Set dash as delimiter
IFS='-'
read -a s <<< "${output_arr[1]}"
read -ra s <<< "${output_arr[1]}"
echo "SoC: ${s[0]}"
echo
2 changes: 1 addition & 1 deletion contrib/genio/units/graphic/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ _purpose:
The resolution of glmark2-es2-wayland is 1920x1080
command:
set -e
output=$(glmark2-es2-wayland -s 1920x1080 --data-path $SNAP/usr/share/glmark2)
output=$(glmark2-es2-wayland -s 1920x1080 --data-path "$SNAP"/usr/share/glmark2)
echo "$output"
if ! echo "$output" | grep "GL_VENDOR" | grep -q "ARM"; then
echo "FAIL: Wrong vendor!"
Expand Down
59 changes: 29 additions & 30 deletions contrib/genio/units/hdmi-rx/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ user: root
_summary: Check the mtk_hdmirx module has been loaded
command:
echo "Check the mtk_hdmirx module has been loaded..."
lsmod | grep -w mtk_hdmirx
if [[ "$?" -ne 0 ]]; then
if ! lsmod | grep -w mtk_hdmirx; then
echo "Failed: The 'mtk_hdmirx' module isn't loaded!"
exit 1
fi
Expand All @@ -32,13 +31,13 @@ user: root
command:
EXIT=0
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log start_observing
hdmirx_tool_runner.sh "$temp_log" start_observing
echo
expected_events='HDMI_RX_PWR_5V_CHANGE HDMI_RX_PLUG_IN HDMI_RX_TIMING_LOCK HDMI_RX_AUD_LOCK'
for event in $expected_events
do
echo "Checking event: $event..."
if [ "$(grep -w $event $temp_log)" == "" ]; then
if [ "$(grep -w "$event" "$temp_log")" == "" ]; then
echo "- FAIL: Unable to find the '$event' event"
EXIT=1
else
Expand Down Expand Up @@ -74,9 +73,9 @@ flags: also-after-suspend
user: root
command:
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log check_cable
hdmirx_tool_runner.sh "$temp_log" check_cable
echo
hdmirx_output_checker.sh $temp_log verify_check_cable_output "hdmi connected"
hdmirx_output_checker.sh "$temp_log" verify_check_cable_output "hdmi connected"
_summary: Check the HDMI connection by using hdmi_rx tool
_description:
This test checks the hdmi_rx tool should shows the "hdmi connected" information after
Expand All @@ -99,14 +98,14 @@ flags: also-after-suspend
user: root
command:
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log check_video_locked
hdmirx_tool_runner.sh "$temp_log" check_video_locked
echo
hdmirx_output_checker.sh $temp_log verify_check_video_locked_output "video locked"
hdmirx_output_checker.sh "$temp_log" verify_check_video_locked_output "video locked"
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log get_video_info
hdmirx_tool_runner.sh "$temp_log" get_video_info
echo
expected_values="1920 1080 60"
hdmirx_output_checker.sh $temp_log verify_get_video_info_output "${expected_values}"
hdmirx_output_checker.sh "$temp_log" verify_get_video_info_output "${expected_values}"
_summary: Check the event by hdmi_rx tool while plugging the HDMI cable to HDMI RX port
_description:
This test checks some video information from hdmi_rx tool should match the expectation.
Expand All @@ -130,14 +129,14 @@ flags: also-after-suspend
user: root
command:
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log check_audio_locked
hdmirx_tool_runner.sh "$temp_log" check_audio_locked
echo
hdmirx_output_checker.sh $temp_log verify_check_audio_locked_output "video locked"
hdmirx_output_checker.sh "$temp_log" verify_check_audio_locked_output "video locked"
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log get_audio_info
hdmirx_tool_runner.sh "$temp_log" get_audio_info
echo
expected_values="24 bits, Channel Number [2], 48.0 kHz"
hdmirx_output_checker.sh $temp_log verify_get_audio_info_output "${expected_values}"
hdmirx_output_checker.sh "$temp_log" verify_get_audio_info_output "${expected_values}"
_summary: Check the event by hdmi_rx tool while plugging the HDMI cable to HDMI RX port
_description:
This test checks some audio information from hdmi_rx tool should match the expectation.
Expand All @@ -161,10 +160,10 @@ flags: also-after-suspend
user: root
command:
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log disable_hdmi
hdmirx_tool_runner.sh $temp_log check_cable
hdmirx_tool_runner.sh "$temp_log" disable_hdmi
hdmirx_tool_runner.sh "$temp_log" check_cable
echo
hdmirx_output_checker.sh $temp_log verify_check_cable_output "hdmi disconnected"
hdmirx_output_checker.sh "$temp_log" verify_check_cable_output "hdmi disconnected"
_summary: Disable the HDMI RX functionaliy by hdmi_rx tool
_description:
This test will disable the functionaliy of HDMI RX by using hdmi_rx tool and the HDMI RX port still be connected.
Expand All @@ -186,30 +185,30 @@ flags: also-after-suspend
user: root
command:
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log enable_hdmi
hdmirx_tool_runner.sh $temp_log check_cable
hdmirx_tool_runner.sh "$temp_log" enable_hdmi
hdmirx_tool_runner.sh "$temp_log" check_cable
echo
hdmirx_output_checker.sh $temp_log verify_check_cable_output "hdmi connected"
hdmirx_output_checker.sh "$temp_log" verify_check_cable_output "hdmi connected"
# Verify Video info
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log check_video_locked
hdmirx_tool_runner.sh "$temp_log" check_video_locked
echo
hdmirx_output_checker.sh $temp_log verify_check_video_locked_output "video locked"
hdmirx_output_checker.sh "$temp_log" verify_check_video_locked_output "video locked"
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log get_video_info
hdmirx_tool_runner.sh "$temp_log" get_video_info
echo
expected_values="1920 1080 60"
hdmirx_output_checker.sh $temp_log verify_get_video_info_output "${expected_values}"
hdmirx_output_checker.sh "$temp_log" verify_get_video_info_output "${expected_values}"
# Verify Audio info
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log check_audio_locked
hdmirx_tool_runner.sh "$temp_log" check_audio_locked
echo
hdmirx_output_checker.sh $temp_log verify_check_audio_locked_output "video locked"
hdmirx_output_checker.sh "$temp_log" verify_check_audio_locked_output "video locked"
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log get_audio_info
hdmirx_tool_runner.sh "$temp_log" get_audio_info
echo
expected_values="24 bits, Channel Number [2], 48.0 kHz"
hdmirx_output_checker.sh $temp_log verify_get_audio_info_output "${expected_values}"
hdmirx_output_checker.sh "$temp_log" verify_get_audio_info_output "${expected_values}"
_summary: Enable the HDMI RX functionaliy by hdmi_rx tool
_description:
This test will enable the functionaliy of HDMI RX by using hdmi_rx tool and the HDMI RX port still be connected.
Expand All @@ -230,13 +229,13 @@ user: root
command:
EXIT=0
temp_log=$( mktemp )
hdmirx_tool_runner.sh $temp_log start_observing
hdmirx_tool_runner.sh "$temp_log" start_observing
echo
expected_events='HDMI_RX_AUD_UNLOCK HDMI_RX_TIMING_UNLOCK HDMI_RX_PWR_5V_CHANGE HDMI_RX_PLUG_OUT'
for event in $expected_events
do
echo "Checking event: $event ..."
if [ "$(grep -w $event $temp_log)" == "" ]; then
if [ "$(grep -w "$event" "$temp_log")" == "" ]; then
echo "- FAIL: Unable to find the '$event' event"
EXIT=1
else
Expand Down
2 changes: 1 addition & 1 deletion contrib/genio/units/thermal/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ command:
fi
# Thermal is functional, dump the journal of previous boot
temp_log=$( mktemp )
journalctl -b -1 | tee $temp_log
journalctl -b -1 | tee "$temp_log"
golden_message="reboot: HARDWARE PROTECTION shutdown (Temperature too high)"
if ! grep -qw "$golden_message" "$temp_log" ; then
echo "FAIL: no '$golden_message' message be found in journal"
Expand Down

0 comments on commit 3f8ed0e

Please sign in to comment.