Skip to content

Fix remaining shellcheck warnings #44

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

Merged
merged 1 commit into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh

# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear

#!/bin/sh
# Import test suite definitions
set -x
chmod 777 -R /var/common/*
Expand All @@ -25,15 +26,15 @@ NC="\033[0m" # No Color

# Function to log
log_info() {
echo -e "${YELLOW}[INFO]${NC} $1"
echo "${YELLOW}[INFO]${NC} $1"
}

log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
echo "${GREEN}[SUCCESS]${NC} $1"
}

log_error() {
echo -e "${RED}[ERROR]${NC} $1"
echo "${RED}[ERROR]${NC} $1"
}

# Verify app binary exists
Expand Down
14 changes: 7 additions & 7 deletions Runner/suites/Kernel/FunctionalArea/baseport/USBHost/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ echo "$usb_output"

# Check if any USB devices were found
if [ "$device_count" -eq 0 ]; then
    log_fail "$TESTNAME : Test Failed - No USB devices found."
    echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
log_fail "$TESTNAME : Test Failed - No USB devices found."
Copy link
Contributor

Choose a reason for hiding this comment

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

Is log_fail supposed to change to log_error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only change I made was removing the non-printable UTF character. I don't want to change the actual content of the script.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. I saw that log function names had changed and you wanted to fix that. Let me cross-check that on my end and fix if needed,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you can fix the issues you mentioned I can rebase this patch on top and avoid the changes altogether.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cross-checked the log function names in functestlib.sh and they are the same as written in my script. So we're good and additional changes are not required.

echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
elif [ "$non_hub_count" -eq 0 ]; then
    log_fail "$TESTNAME : Test Failed - Only USB hubs detected, no functional USB devices."
    echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
log_fail "$TESTNAME : Test Failed - Only USB hubs detected, no functional USB devices."
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
else
    log_pass "$TESTNAME : Test Passed - $non_hub_count non-hub USB device(s) found."
    echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
log_pass "$TESTNAME : Test Passed - $non_hub_count non-hub USB device(s) found."
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
fi

log_info "-------------------Completed $TESTNAME Testcase----------------------------"
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
5 changes: 5 additions & 0 deletions Runner/utils/platform.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# shellcheck disable=SC2148
# Intentionally not defining shell.

# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear

# Detect Android userland
ANDROID_PATH=/system/build.prop
if [ -f $ANDROID_PATH ]; then
ANDROID=1
# shellcheck disable=SC2209,SC2034
SHELL_CMD=sh
else
ANDROID=0
# shellcheck disable=SC2209,SC2034
SHELL_CMD=bash
fi

Expand Down
Loading