Skip to content

Conversation

@achauras-qcom
Copy link
Contributor

The shell script verifies the enumeration of USB Human Interface Devices connected to DUT.

@achauras-qcom achauras-qcom force-pushed the feature/usb-hid branch 2 times, most recently from 9ae698c to 030a8d7 Compare February 1, 2026 21:06
log_info "=== Test Initialization ==="

# Check if grep is installed, else skip test
deps_list="grep"
Copy link
Contributor

Choose a reason for hiding this comment

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

But the script also uses sed sort wc.

Check: grep sed sort wc

else
log_fail "$TESTNAME : Test Failed - No USB 'Human Interface Device' found"
echo "$TESTNAME FAIL" > "$res_file"
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

this can prevent the yaml step from running. always use exit 0 and rely on .res for PASS/FAIL/SKIP

fi

# Only source if not already loaded (idempotent)
if [ -z "${__INIT_ENV_LOADED:-}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

identation.. please have one leading space

test_path=$(find_test_case_by_name "$TESTNAME")
cd "$test_path" || exit 1
# shellcheck disable=SC2034
res_file="./$TESTNAME.res"
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with your existing scripts, prefer RES_FILE="./${TESTNAME}.res"

### Quick Example
```bash
git clone <this-repo>
cd <this-repo>
Copy link
Contributor

Choose a reason for hiding this comment

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

The quick example uses placeholders like and — we usually show:
cd Runner && ./run-test.sh usb_hid
OR direct ./run.sh from the test folder (you already do in YAML).

steps:
- REPO_PATH=$PWD
- cd Runner/suites/Kernel/Baseport/usb_hid
- ./run.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

use ./run.sh || true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per earlier comment, removed || true because send-to-lava can usually be without || true if run.sh always writes res.
Please let me know if I need to add it back?

Copy link
Contributor

Choose a reason for hiding this comment

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

As per earlier comment, removed || true because send-to-lava can usually be without || true if run.sh always writes res. Please let me know if I need to add it back?

earlier comment provided for result updation to lava step. We would be needing || true for run.sh

@achauras-qcom achauras-qcom force-pushed the feature/usb-hid branch 2 times, most recently from 5e14d4d to 2a8c45d Compare February 12, 2026 15:12

if [ -z "$INIT_ENV" ]; then
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
echo "$TESTNAME SKIP" >"$SCRIPT_DIR/${TESTNAME}.res" 2>/dev/null || true
Copy link
Contributor

Choose a reason for hiding this comment

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

The $TESTNAME is defined before it's used. So move TESTNAME="usb_hid" to before it

d=${f%/bInterfaceClass}
echo "${d##*/}"
fi
done 2>/dev/null | sed 's/:.*$//' | sort -u | wc -l
Copy link
Contributor

Choose a reason for hiding this comment

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

small robustness tweak.. ... | wc -l | tr -d '[:space:]' Then your numeric compare is always clean

The shell script verifies the enumeration of USB Human Interface
Devices.

Signed-off-by: “Aanchal <achauras@qti.qualcomm.com>
Added setup information and basic requirements.
This informs the tester of the hardware setup requirement before
starting test.

Signed-off-by: “Aanchal <achauras@qti.qualcomm.com>
Individual test definition is meant to be used for debugging the test
script running in LAVA.

Signed-off-by: “Aanchal <achauras@qti.qualcomm.com>
Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

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

LGTM

@smuppand smuppand merged commit 3725379 into qualcomm-linux:main Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants