-
Notifications
You must be signed in to change notification settings - Fork 30
Add test script to validate USB HID #259
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
Conversation
9ae698c to
030a8d7
Compare
030a8d7 to
be2fccc
Compare
| log_info "=== Test Initialization ===" | ||
|
|
||
| # Check if grep is installed, else skip test | ||
| deps_list="grep" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ./run.sh || true
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
5e14d4d to
2a8c45d
Compare
|
|
||
| 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
2a8c45d to
bf9fd72
Compare
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>
bf9fd72 to
db1fdad
Compare
smuppand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The shell script verifies the enumeration of USB Human Interface Devices connected to DUT.