Skip to content

BT_SCAN_PAIR: move arg parsing into run.sh, simplify YAML, add numeric knob validation#208

Closed
smuppand wants to merge 3 commits intoqualcomm-linux:mainfrom
smuppand:lava-friendly
Closed

BT_SCAN_PAIR: move arg parsing into run.sh, simplify YAML, add numeric knob validation#208
smuppand wants to merge 3 commits intoqualcomm-linux:mainfrom
smuppand:lava-friendly

Conversation

@smuppand
Copy link
Contributor

@smuppand smuppand commented Nov 4, 2025

  • run.sh: adds minimal long-option support (--mac/--name/--whitelist, --pair-retries/--scan-attempts) while preserving positional args.
  • run.sh: multi-line numeric validation for PAIR_RETRIES / SCAN_ATTEMPTS (env or params).
  • YAML: drops inline args assembly; exports params and calls script directly.
  • Keeps multi-line logs and existing behavior when no params provided.
  • No breaking changes to CI, cleaner, reusable test definition.

@smuppand smuppand requested a review from mwasilew November 4, 2025 11:23
Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Is there a reason you decided not to use getopts?

@smuppand
Copy link
Contributor Author

smuppand commented Nov 5, 2025

Is there a reason you decided not to use getopts?

POSIX getopts only supports short flags. To keep long flags (--mac, --name, etc.) and be safe on BusyBox/ash systems (no GNU getopt assumptions), I used a tiny hand-rolled long-option parser. Current scripts already rely on positional args, adding a thin long-option layer avoided a broad refactor while keeping exact legacy behavior.

…x-testkit

- Set REPO_ROOT to repo root and resolve utils/ scripts reliably
- Minimal params: bt_mac / bt_name / whitelist + pair/scan knobs
- Export PAIR_RETRIES and SCAN_ATTEMPTS for run.sh consumption
- Pass positional args through unchanged (MAC > NAME, optional whitelist)
- Use utils/send-to-lava.sh and utils/result_parse.sh for reporting
- Keep deps limited to bluez and expect

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
…rify

- Preserve positional-arg model (MAC or NAME, optional whitelist)
- Support PAIR_RETRIES / SCAN_ATTEMPTS via env sensible defaults
- Direct MAC pairing path with post-pair connect + l2ping verification
- Fallback to bt_device_list.txt when no CLI input, whitelist filter
- Clean traps: stop bluetoothctl, unpair cleanup on exit
- Clear, multi-line PASS/SKIP/FAIL result handling to .res
- No getopts/long flags introduced; function names unchanged

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Add a distro-agnostic test-definition to run the BT_ON_FF toggle test
from qcom-linux-testkit. The definition:
- avoids install/params sections (relies on LAVA param export & testkit)
- runs the suite script directly and captures BT_ON_FF.res
- uploads artifacts via utils/send-to-lava.sh and parses results with
  utils/result_parse.sh

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Looks good. Only cosmetic comments. Have you had a chance to run it in the LAB?

os:
- Yocto
- Ubuntu
- Debina
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

scope:
- functional

params:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be useful to add a comment saying that the script uses these parameters from environment.

- RPATH="$REPO_ROOT/suites/Connectivity/Bluetooth/BT_ON_FF/run.sh"
- RESFILE="$REPO_ROOT/suites/Connectivity/Bluetooth/BT_ON_FF/BT_ON_FF.res"
- rm -f "$RESFILE" 2>/dev/null || true
- "$RPATH" || true
Copy link
Contributor

Choose a reason for hiding this comment

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

YAML parser doesn't like these variable substitutions:

>>> y = yaml.safe_load(f.read())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 384, in parse_block_sequence_entry
    if not self.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 239, in fetch_more_tokens
    return self.fetch_literal()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 635, in fetch_literal
    self.fetch_block_scalar(style='|')
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 649, in fetch_block_scalar
    self.tokens.append(self.scan_block_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 989, in scan_block_scalar
    chomping, increment = self.scan_block_scalar_indicators(start_mark)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 1087, in scan_block_scalar_indicators
    raise ScannerError("while scanning a block scalar", start_mark,
yaml.scanner.ScannerError: while scanning a block scalar
  in "<unicode string>", line 17, column 16:
        - "$RPATH" || true
                   ^
expected chomping or indentation indicators, but found '|'
  in "<unicode string>", line 17, column 17:
        - "$RPATH" || true


run:
steps:
- cd qcom-linux-testkit/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR
Copy link
Contributor

Choose a reason for hiding this comment

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

it should be

cd ./qcom-linux-testkit/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR

Tried to run it here: https://lava.infra.foundries.io/scheduler/job/114175

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

This pull request has been marked as stale due to 30 days of inactivity. To prevent automatic closure in 7 days, remove the stale label or add a comment. You can reopen a closed pull request at any time.

@github-actions github-actions bot added the Stale label Dec 6, 2025
@github-actions github-actions bot closed this Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants