# Main
################################################################################
main:
  name:                               Serial Terminal bug reproducer
  version:                            0.1
  steps:
    - group:
        name:                         Test preparation
        steps:
          - console:
              name:             Open RSL Simulator Terminal
              console_name:     RSL_simulator
              steps:
                  - open:
                      protocol:   terminal
                      terminal_path: $(rslsimulatorpath)
                  - writeln: "pwd"
                  - read_until: {expected: "$", timeout: 5}
                  - writeln: "./RSverify $(rsTx)" # /dev/ttyMUE1
                  - read_until: {expected: "RSL controller>", timeout: 5}
                  - writeln: "setportconf 0 115200 none 8 1 1 255"
                  - read_until: {expected: "RSL controller>", timeout: 5}
                  - writeln: "send4ever 0 0"
                  - read_until: {expected: "RSL controller>", timeout: 5}

          - console:
              name:                   Open the EUT console
              console_name:           cons_target
              doc:                    Initiates the console of the target in order
                                      to be ready to capture its traces.
              stop_on_failure:        True
              steps:
                - open:
                    protocol:         serial
                    serial_port:      $(rsRx) # /dev/ttyMUE2
                    serial_baudrate:  115200

    - loop:
        name:                         Qualification loop
        stop_on_failure:              False
        steps:
          - py_func:
              name:                   Capture the RS serial output
              file:                   $(test_directory)/terminal_bug_reproducer.py
              func_name:              RetreiveData
              param:
                - cons_target

          - sleep: {timeout: 1}

# Cleanup sequence
#-------------------------------------------------------------------------------
    - group:
        name:                         Cleanup
        execute_on_stop:              True
        steps:
          - console:
              name:                   Close the target console
              console_name:           cons_target
              execute_on_stop:        True
              steps:
                - close:

          - console:
              name:                   Close the RSL_simulator
              console_name:           RSL_simulator
              execute_on_stop:        True
              steps:
                - close: