.MISC_CASE: &MISC_CASE
  SDK: ESP32_IDF
  Test App: SSC_BLE_WIFI
  auto test: 'Yes'
  category: Function
  test point 1: basic function
  initial condition: BLE_DEINIT1
  test environment: SSC_T1_4
  execution time: 0
  module: BT Stack
  sub module: Misc
  version: v1 (2016-12-31)
  CI ready: 'Yes'
  level: Integration
  allow fail: ''

test cases:
- ID: BTSTK_MISC_0101
  <<: *MISC_CASE
  test point 2: bt host init and enable
  summary: correct host init and deinit flow
  steps: |
    1. disable and deinit bt
    2. init bt
    3. deinit bt
    4. init and enable bt
    5. disable and deinit bt
  expected result: |
    1. succeed
    2. succeed
    3. succeed
    4. succeed
    5. succeed
  cmd set:
  - ""
  - - "SSC SSC1 bt -D -z stop"
    - ["R SSC1 C +BT"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z start"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z stop"
    - ["R SSC1 C +BT:OK"]
- ID: BTSTK_MISC_0102
  <<: *MISC_CASE
  test point 2: bt host init and enable
  summary: incorrect host deinit disable flow
  steps: |
    1. disable and deinit bt
    2. init and enable bt
    3. deinit bt
    4. disable bt
    5. disable bt
    6. deinit bt
    7. deinit bt
    8. disable bt
  expected result: |
    1. succeed
    2. succeed
    3. fail
    4. succeed
    5. fail
    6. succeed
    7. fail
    8. fail
  cmd set:
  - ""
  - - "SSC SSC1 bt -D -z stop"
    - ["R SSC1 C +BT"]
  - - "SSC SSC1 bt -D -z start"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z disable"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z disable"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z disable"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_0103
  <<: *MISC_CASE
  test point 2: bt host init and enable
  summary: incorrect host init enable flow
  steps: |
    1. disable and deinit bt
    2. enable bt
    3. init bt
    4. init bt
    5. enable bt
    6. enable bt
    7. init bt
  expected result: |
    1. succeed
    2. fail
    3. succeed
    4. fail
    5. succeed
    6. fail
    7. fail
  cmd set:
  - ""
  - - "SSC SSC1 bt -D -z stop"
    - ["R SSC1 C +BT"]
  - - "SSC SSC1 bt -D -z enable"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z enable"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z enable"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_0201
  <<: *MISC_CASE
  test point 2: bt controller init test
  summary: bt controller init test
  steps: |
    1. bt controller init
  expected result: |
    1. OK
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
- ID: BTSTK_MISC_0202
  <<: *MISC_CASE
  test point 2: bt controller deinit test
  summary: bt controller deinit test
  steps: |
    1. bt controller init
    2. bt controller deinit
  expected result: |
    1. OK
    2. OK
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z deinit"
    - ["R SSC1 C +BTC:OK"]
- ID: BTSTK_MISC_0203
  <<: *MISC_CASE
  test point 2: bt host init test
  summary: bt host init test
  steps: |
    1. bt controller init
    2. bt controller enable
    3. bt host init
  expected result: |
    1. +BTC:OK
    2. +BTC:OK
    3. +BT:OK
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
- ID: BTSTK_MISC_0204
  <<: *MISC_CASE
  test point 2: bt host deinit test
  summary: bt host deinit test
  steps: |
    1. bt controller init
    2. bt controller enable
    3. bt host init
    4. bt host deinit
  expected result: |
    1. OK
    2. OK
    3. OK
    4. OK
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:OK"]
- ID: BTSTK_MISC_0301
  <<: *MISC_CASE
  test point 2: heap size unchanged after bt controller stop
  summary: heap size unchanged after bt controller stop
  steps: |
    1.get current heap size
    2.bt controller init
    3.enable bt controller
    4.bt host init
    5.enable bt host
    6.disable bt host
    7.bt host deinit
    8.disable bt controller
    9.bt controller deinit
    10.check current heap size
  expected result: |
    1. +FREEHEAP
    2.OK
    3.OK
    4.OK
    5.OK
    6.OK
    7.OK
    8.OK
    9.OK
    10.heap size unchanged
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 ram -Q"
    - ['R SSC1 A <heapsize>:\+FREEHEAP:(\d+)\r\n']
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z enable"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z disable"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z deinit"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 btc -D -z disable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z deinit"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 ram -Q"
    - ['R SSC1 P <heapsize>']
- ID: BTSTK_MISC_0401
  <<: *MISC_CASE
  test point 2: bt controller init and enable
  summary: incorrect controller init enable flow
  steps: |
    1. disable and deinit btc
    2. enable btc
    3. init btc
    4. init btc
    5. enable btc
    6. enable btc
    7. init btc
  expected result: |
    1. succeed
    2. fail
    3. succeed
    4. fail
    5. succeed
    6. fail
    7. fail
  initial condition: WIFIBTSTOP
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z stop"
    - ["R SSC1 C +BTC"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:ERROR"]
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:ERROR"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:ERROR"]
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:ERROR"]
- ID: BTSTK_MISC_0402
  <<: *MISC_CASE
  test point 2: bt controller init and enable
  summary: correct controller init and deinit flow
  steps: |
    1. disable and deinit btc
    2. init btc
    3. deinit btc
    4. init and enable btc
    5. disable and deinit btc
  expected result: |
    1. succeed
    2. succeed
    3. succeed
    4. succeed
    5. succeed
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z stop"
    - ["R SSC1 C +BTC"]
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z deinit"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z start"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z stop"
    - ["R SSC1 C +BTC:OK"]
- ID: BTSTK_MISC_0403
  <<: *MISC_CASE
  test point 2: bt controller init and enable
  summary: incorrect controller deinit disable flow
  steps: |
    1. disable and deinit btc
    2. init and enable btc
    3. deinit btc
    4. disable btc
    5. disable btc
  expected result: |
    1. succeed
    2. succeed
    3. fail
    4. succeed
    5. fail
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z stop"
    - ["R SSC1 C +BTC"]
  - - "SSC SSC1 btc -D -z start"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z deinit"
    - ["R SSC1 C +BTC:ERROR"]
  - - "SSC SSC1 btc -D -z disable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z disable"
    - ["R SSC1 C +BTC:ERROR"]
- ID: BTSTK_MISC_0501
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT memory
  steps: |
    1. DUT1 release BT mem
    2. DUT1 init and enable btc
  expected result: |
    1. succeed
    2. fail
  initial condition: BTC_DEINIT1
  cmd set:
  - ""
  - - "SSC SSC1 bt -R -m 1"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 btc -D -z start -m 2"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z start -m 1"
    - ["R SSC1 C +BTC:ERROR"]
- ID: BTSTK_MISC_0502
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BLE memory
  steps: |
    1. DUT1 release BT mem
    2. DUT1 init and enable btc
  expected result: |
    1. succeed
    2. fail
  initial condition: BTC_DEINIT1
  cmd set:
  - ""
  - - "SSC SSC1 bt -R -m 2"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 btc -D -z start -m 1"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z start -m 2"
    - ["R SSC1 C +BTC:ERROR"]
- ID: BTSTK_MISC_0503
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT and BLE memory
  steps: |
    1. DUT1 release BT mem
    2. DUT1 init and enable btc
  expected result: |
    1. succeed
    2. fail
  initial condition: BTC_DEINIT1
  cmd set:
  - ""
  - - "SSC SSC1 bt -R -m 3"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 btc -D -z start -m 3"
    - ["R SSC1 C +BTC:ERROR"]
- ID: BTSTK_MISC_0504
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT memory after bt controller init
  initial condition: BTC_DEINIT1
  steps: |
    1. DUT1 init bt controller
    2. DUT1 release BT memory
    3. DUT1 release BLE memory
    4. DUT1 release BT and BLE memory
  expected result: |
    1. succeed
    2. fail
    3. fail
    4. fail
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 bt -R -m 1"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 2"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 3"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_0505
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT memory after bt controller enable and bluedriod disable
  initial condition: BTC_DEINIT1
  steps: |
    1. DUT1 init and enable bt controller
    2. DUT1 release BT memory
    3. DUT1 release BLE memory
    4. DUT1 release BT and BLE memory
  expected result: |
    1. succeed
    2. fail
    3. fail
    4. fail
  cmd set:
  - ""
  - - "SSC SSC1 btc -D -z init"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 btc -D -z enable"
    - ["R SSC1 C +BTC:OK"]
  - - "SSC SSC1 bt -R -m 1"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 2"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 3"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_0506
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT memory after bt controller enable and bluedriod init
  steps: |
    1. DUT1 init bluedriod
    2. DUT1 release BT memory
    3. DUT1 release BLE memory
    4. DUT1 release BT and BLE memory
  expected result: |
    1. succeed
    2. fail
    3. fail
    4. fail
  cmd set:
  - ""
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -R -m 1"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 2"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 3"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_0507
  <<: *MISC_CASE
  test point 2: bt mem release
  summary: release BT memory after bt controller enable and bluedriod enable
  steps: |
    1. DUT1 init and enable bluedriod
    2. DUT1 release BT memory
    3. DUT1 release BLE memory
    4. DUT1 release BT and BLE memory
  expected result: |
    1. succeed
    2. fail
    3. fail
    4. fail
  cmd set:
  - ""
  - - "SSC SSC1 bt -D -z init"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -D -z enable"
    - ["R SSC1 C +BT:OK"]
  - - "SSC SSC1 bt -R -m 1"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 2"
    - ["R SSC1 C +BT:ERROR"]
  - - "SSC SSC1 bt -R -m 3"
    - ["R SSC1 C +BT:ERROR"]
- ID: BTSTK_MISC_5001
  <<: *MISC_CASE
  category: Performance
  test point 1: performance + stress
  test point 2: BT Controller Performance test
  summary: bt controller init and deinit Performance test
  execution time: 6
  steps: |
    1.get current heap size
    2.bt controller init
    3.enable bt controller
    4.bt host init
    5.enable bt host
    6.disable bt host
    7.bt host deinit
    8.disable bt controller
    9.bt controller deinit
    10.loop step1 to step 9
  expected result: |
    1. +FREEHEAP
    2.OK
    3.OK
    4.OK
    5.OK
    6.OK
    7.OK
    8.OK
    9.OK
    10.heap size unchanged
  cmd set:
  - "BLEStress/BLEInitDeinitPerformance"
  - - "test_time = 420"
    - ""
