Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twister: add support to testing shell #52889

Closed
desowin opened this issue Dec 8, 2022 · 0 comments · Fixed by #57117
Closed

Twister: add support to testing shell #52889

desowin opened this issue Dec 8, 2022 · 0 comments · Fixed by #57117
Assignees
Labels
area: Twister Twister Enhancement Changes/Updates/Additions to existing features

Comments

@desowin
Copy link

desowin commented Dec 8, 2022

Is your enhancement proposal related to a problem? Please describe.
The problem was noticed in #52818. Twister does not currently support testing shell examples.

Describe the solution you'd like
Shell test harness that could be used to check whether specific command can execute on target.

Describe alternatives you've considered
The alternative is to skip testing by adding some unknown harness, e.g. keyboard.

Additional context
Some automated testing can be achieved using expect and picocom. Example testing script is below. The script expects that the user will reset target after starting the script.

#!/usr/bin/expect

set timeout 10
spawn picocom -b 115200 -f none -q /dev/ttyACM0
#Wait for picocom to open port
sleep 2
#Start the shell, e.g. by pressing reset button
expect "uart:~" {} timeout { puts "Prompt timeout"; exit 1 }
send "help\n"
expect "Please refer to shell documentation for more details." {} timeout { puts "no expected output"; exit 2 }
expect "uart:~" {} timeout { puts "No prompt after command"; exit 3 }
#Type in arbitrary string and check if device echoes it back
send "verify echo"
expect "verify echo" {} timeout { puts "Characters not echoed"; exit 4 }
#Send Ctrl+A and Ctrl+X to exit picocom
send -- "\x01"
send -- "\x0A"
puts "\nPASS"
@desowin desowin added Enhancement Changes/Updates/Additions to existing features area: Twister Twister labels Dec 8, 2022
@nashif nashif self-assigned this Jan 30, 2023
@gopiotr gopiotr mentioned this issue May 10, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Twister Twister Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants