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

Expand the serial terminal console documentation #1586

Merged
merged 1 commit into from
Mar 3, 2018

Conversation

richiejp
Copy link
Contributor

@richiejp
Copy link
Contributor Author

fyi @pevik @asmorodskyi

@pevik
Copy link
Contributor

pevik commented Feb 19, 2018

LGTM. Thanks Richie to extend docs!
Tiny note: could you name them instead of using first and second?

instead of being interpreted by a terminal emulator which then renders the
text.

However the advantages of using the serial terminal usually outweigh the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very discussable statement , would better remove it. It's up to openQA consumer to decide which way is better


[source,perl]
--------------------------------------------------------------------------------
if (select_virtio_console()) {
Copy link
Member

@asmorodskyi asmorodskyi Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a big question for me to document function which is in testing repository . From openQA perspective os-autoinst-distri-opensuse it is just another testing repository. How guys from Fedora would follow this ?
I am agree that select_virtio_console is needed function but to insert it to documentation need to move to os-autoinst

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least you need to point where this function is declared and explain that it's only related to os-autoinst-distri-opensuse

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the latter because most distributions should have something similar and it is nice to have complete documentation in one place.


1) Wait for the terminal prompt to appear.
2) Send your command
3) Wait for your command text to be echoed by the shell (inf applicable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 'inf'


if (is_serial_terminal) {
script_run($klog_stamp);
wait_serial(serial_term_prompt(), undef, 0, no_regex => 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate more about serial_term_prompt() ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it make sense to explain other parameters in wait_serial and why you using them. It will give some insights about how serial terminal actually working

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but maybe I am asking too much for single PR ... feel free to ignore this one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree :-). I mean it's great to have comments but on the other hand perfect is the enemy of good :-).

Thank you both for your care.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is perfectly valid criticism :-)


Then the test script enters our command with +type_string+ and waits for the
command's text to be echoed back by the shell. Shell's usually echo the
characters sent to them so that the user can see what they have typed. However
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and when it is not the case and why ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is just like ongoing question not directly related to PR :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, well I have explained a bit more anyway in the docs, but a full explanation would not be relevant because it is only likely to be turned off deliberately to simplify processing SUT output which I don't think is a good idea.

Another situation where it might be turned off is if your local terminal emulator displays your keypresses. In which case the remote TTY/PTY does not need to. Another is if you are using a very stupid terminal on an embedded device which does not echo the characters. Also if you are using a very slow serial connection, the echo might interfere with the characters you are trying to send, so it is best to turn it off. None of this is very likely when you are using a Linux capable device, but I think it is helpful knowledge for understanding how terminals work.

+script_run+.

We choose to wait for the prompt just before sending a command, rather than
after it, so that step 5 can be deferred to a later time. In theory this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you not provide numbering so it is hard to figure out what is step 5

@richiejp richiejp changed the title [WIP] Expand the serial terminal console documentation Expand the serial terminal console documentation Feb 20, 2018
my $cmd_text = qq($test->{command}; echo "$fin_msg\$?");
my $klog_stamp = "echo 'OpenQA::run_ltp.pm: Starting $test->{name}' > /dev/$serialdev";

# More variables and other shit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please use more polite word here :)

@asmorodskyi
Copy link
Member

LGTM . Well done @richiejp !

@codecov
Copy link

codecov bot commented Feb 21, 2018

Codecov Report

Merging #1586 into master will decrease coverage by 24.59%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1586      +/-   ##
=========================================
- Coverage   82.59%     58%   -24.6%     
=========================================
  Files         121     106      -15     
  Lines        9037    8255     -782     
=========================================
- Hits         7464    4788    -2676     
- Misses       1573    3467    +1894
Impacted Files Coverage Δ
lib/OpenQA/File.pm 8.14% <0%> (-91.86%) ⬇️
lib/db_profiler.pm 12% <0%> (-88%) ⬇️
lib/OpenQA/Client/Upload.pm 12.19% <0%> (-87.81%) ⬇️
lib/OpenQA/Resource/Locks.pm 9.33% <0%> (-84%) ⬇️
lib/OpenQA/Parser.pm 17.92% <0%> (-82.08%) ⬇️
lib/OpenQA/Client/Handler.pm 18.18% <0%> (-81.82%) ⬇️
lib/OpenQA/Worker/Cache.pm 6.36% <0%> (-80%) ⬇️
lib/OpenQA/Parser/Results.pm 21.73% <0%> (-78.27%) ⬇️
lib/OpenQA/Parser/Result.pm 22.85% <0%> (-77.15%) ⬇️
lib/OpenQA/Schema/Result/Screenshots.pm 7.69% <0%> (-67%) ⬇️
... and 61 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7472fdf...205956a. Read the comment docs.

@richiejp
Copy link
Contributor Author

Thanks for review @asmorodskyi and @pevik

@okurz
Copy link
Member

okurz commented Feb 26, 2018

I feel weird to critique a native speaker but shouldn't the commit/PR say "extend" rather than "expand"?

@richiejp
Copy link
Contributor Author

"extend" is a synonym for "expand" in ordinary English (i.e. non-technical language). "elaborate" is probably more correct than both of them. However I'm not a grammar expert.

Copy link
Member

@SergioAtSUSE SergioAtSUSE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the documentation!

usually output to.

When switching to a virtio based serial terminal, +wait_serial+ will then read
from the virtio serial port instead. However the emulated serial port still
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As spoken. Perhaps you can find better names to identify each port. ;)


# More variables and other stuff

if (is_serial_terminal) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here a reminder about our conversation about the differences between how a session is initiated using virtio and using VNC not. (if I understood well)

wait_serial($cmd_text, undef, 0, no_regex => 1); #Step 3
type_string("\n"); #Step 4
} else {
# The slow path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to improve this block so it is easier to understand what is meant by slow path. Like your suggestion about putting the "slow commands".

@coolo
Copy link
Contributor

coolo commented Mar 3, 2018

I'll merge this as first round - improvements can go into a second

@coolo coolo merged commit 9cbbef7 into os-autoinst:master Mar 3, 2018
coolo pushed a commit that referenced this pull request Mar 3, 2018
commit 9cbbef7
Author:     Richard Palethorpe (rpalethorpe) <richiejp@f-m.fm>
AuthorDate: Sat Mar 3 09:31:41 2018 +0100
Commit:     Stephan Kulow <stephan@kulow.org>
CommitDate: Sat Mar 3 09:31:41 2018 +0100

    Expand the serial terminal console documentation (#1586)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants