Linaro / lite-lava-docker-compose

LITE Team LAVA docker dispatcher
MIT License
5 stars 10 forks source link

example/micropython-interactive: More precise response matches. #43

Closed pfalcon closed 4 years ago

pfalcon commented 4 years ago

"interactive" tests use pexpect, which in turn uses substring (actually, regex search) matching. So, "4" would match any string with "4" inside, e.g. "14", "41", etc. To match exactly "4", we must match also virtual delimters, line end of lines, paying attention that pexpect matches regexes "on streams" (not on finite strings), and thus standard regex assertions like "^", "$" won't (necessarily) work as expected. Here, we include explicit end-of-previous-line and end-of-this-line characters (which are taken to be those output by micropython, and may potentially be different with other software/hardware (e.g., with virual docker devices)).

Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org

pfalcon commented 4 years ago

FYI. I've been spending some time to figure out not just how to write tests which pass, but also how to write them to fail reliably. That's one of the points noticed. Ideally, this should be emphasized in the LAVA docs, hope to get to that too...