Actions
action #45785
closed[security] Interactive command support as an utils function
Start date:
2019-01-08
Due date:
% Done:
0%
Estimated time:
Difficulty:
Description
Background¶
- Some commands only can be used within interactive mode, eg. passwd, aa-genprof.
- Sometime we really want to test the interactive mode.
- As a workaround, tool 'expect' can be used but need some programming, and openQA can not participate in the test action during expect running. That is not what we prefer.
So, it is reasonable to provide a function which wrap all the common process for interactive command calling.
Issue to be solved¶
- There are multiple "Question prompts" and "Answers" to be handled, the action should be done according to serial output in the run time.
- The pipe buffer should be disabled, otherwise the command prompt message can not be passed to the serial console in run time.
Approaches¶
- A loop with a string as a flag for the end of interactive command, can be used to deal with multiple prompts and answer action.
- The 'typescript' tool can be used to disable pipe buffer for any commands.
- A 'timeout' should be given for each interactive prompts.
Reference¶
Some exist cases have already implemented it:
lib/apparmortest.pm
called bytests/security/apparmor/aa_autodep.pm
feature/feature_console/zypper_releasever.pm
Actions