Hi. I'm trying to write bootloader test case.


1. My test case

To run the test, enter bootloader and run below command.

=> rpmb test

[RTC: 14813.864257][ARCH:     3.624273] [RPMB] get_RPMB_key, error in CryptoManager F/W: 0x40205

  1. Key status shall not be RPMB_KEY_STATUS_UNKNOWN if ldfw is loaded (0x2 != 0x0) [PASSED]

  2. Key shall be blocked if not explicitly unprogrammed (0x1 == 0x1) [PASSED]

  3. avb_get_lock_state() shall be success if ldfw is loaded and key is programmed (0x0 == 0x0) [PASSED]

  4. RPMB Write args (16,0,1). Check return (0x0 == 0x0) [PASSED]

  5. RPMB Read args (16,0,1). Check return (0x0 == 0x0) [PASSED]

  6. Check read == written          (0x0 == 0x0) [PASSED]

  7. RPMB Write args (16,0,5). Check return (0x0 == 0x0) [PASSED]

  8. RPMB Read args (16,0,5). Check return (0x0 == 0x0) [PASSED]

  9. Check read == written          (0x0 == 0x0) [PASSED]

 10. Writing bootmode: 0x8b0c4217   (0x0 == 0x0) [PASSED]

 11. Reading bootmode               (0x0 == 0x0) [PASSED]

 12. Check read == written          (0x8b0c4217 == 0x8b0c4217) [PASSED]

[RPMB][PASSED] 12 tests

[RPMB][SKIPPED] 0 tests

[RPMB][FAILED] 0 tests


I want to treat the result as pass when device output is "[RPMB][PASSED] 12 tests"


2. LAVA job yaml

device_type: exynosauto

job_name: bootloader-parsing-test

timeouts:

  job:

    minutes: 60

priority: medium

visibility: public


actions:


- boot:

    method: bootloader

    bootloader: u-boot

    commands: []

    prompts:

    - "]"

    - '=>'

    timeout:

      minutes: 5


- test:

    timeout:

      minutes: 60

    interactive:

    - name: lkboot-command-test

      prompts:

      - '=>'

#      echo: discard


      script:

      - name: rpmb-status

        command: rpmb test

        successes:

        - message: "[RPMB][PASSEED] 12 tests"


When I run this job, test case is fail despite test output include the string.

This is LAVA test case result log.



start: 2 lava-test-interactive-retry (timeout 00:59:42) [common]start: 2.1 lava-test-interactive (timeout 00:59:42) [common]Setting prompt string to ['=>']Sending 'rpmb test'rpmb test => rpmb test[SEOJI] expect: ['=>', '\\[RPMB\\]\\[PASSEED\\] 12 tests']Waiting for '=>', '\[RPMB\]\[PASSEED\] 12 tests'rpmb test[RTC: 11508.859863][ARCH: 0.370156] [RPMB] get_RPMB_key, error in CryptoManager F/W: 0x40205 1. Key status shall not be RPMB_KEY_STATUS_UNKNOWN if ldfw is loaded (0x2 != 0x0) [PASSED] 2. Key shall be blocked if not explicitly unprogrammed (0x1 == 0x1) [PASSED] 3. avb_get_lock_state() shall be success if ldfw is loaded and key is programmed (0x0 == 0x0) [PASSED] 4. RPMB Write args (16,0,1). Check return (0x0 == 0x0) [PASSED] 5. RPMB Read args (16,0,1). Check return (0x0 == 0x0) [PASSED] 6. Check read == written (0x0 == 0x0) [PASSED] 7. RPMB Write args (16,0,5). Check return (0x0 == 0x0) [PASSED] 8. RPMB Read args (16,0,5). Check return (0x0 == 0x0) [PASSED] 9. Check read == written (0x0 == 0x0) [PASSED] 10. Writing bootmode: 0x8b0c4217 (0x0 == 0x0) [PASSED] 11. Reading bootmode (0x0 == 0x0) [PASSED] 12. Check read == written (0x8b0c4217 == 0x8b0c4217) [PASSED][RPMB][PASSED] 12 tests[RPMB][SKIPPED] 0 tests[RPMB][FAILED] 0 testsMatched a prompt (was expecting a success): '=>'case: rpmb-status
case_id: 5339
definition: 0_lkboot-command-test
duration: 0.24
result: fail


I wrote simple pexpect code to know whether the string I use is detected.

This is my test code and it detect "[RPMB][PASSEED] 12 tests" string well.


import pexpect


child = pexpect.spawn('minicom -D /dev/ttyUSB0')

child.sendline('rpmb test')

child.expect("\\[RPMB\\]\\[PASSED\\] 12 tests")

print('yes')

So I tried to use successes message as below.

- test:

    timeout:

      minutes: 60

    interactive:

    - name: lkboot-command-test

      prompts:

      - '=>'

#      echo: discard


      script:

      - name: rpmb-status

        command: rpmb test

        successes:

        - message: "\\[RPMB\\]\\[PASSEED\\] 12 tests"

However test case still fail. 

How can I use square brackets in yaml?