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
Extract backend code to it's own package #6316
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
73bdeee
Remove is_remote_backend
foursixnine 2399b77
Remove use_ssh_serial_console
foursixnine f160e05
Move use_ssh_serial_console to Utils::Backends
foursixnine 116c132
Add Utils::Backends
foursixnine a863ee6
Replace uses of is_remote_backend
foursixnine 9812b4c
Tidy up and code cleanup
foursixnine File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (C) 2018 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, see <http://www.gnu.org/licenses/>. | ||
|
||
package Utils::Backends; | ||
use strict; | ||
use warnings; | ||
|
||
use base qw(Exporter); | ||
use Exporter; | ||
use testapi qw(:DEFAULT); | ||
|
||
use constant { | ||
BACKEND => [ | ||
qw( | ||
is_remote_backend | ||
) | ||
], | ||
CONSOLES => [ | ||
qw( | ||
use_ssh_serial_console | ||
) | ||
] | ||
}; | ||
|
||
our @EXPORT = (@{(+CONSOLES)}, @{+BACKEND}); | ||
|
||
our %EXPORT_TAGS = ( | ||
CONSOLES => (CONSOLES), | ||
BACKEND => (BACKEND) | ||
); | ||
|
||
# Use it after SUT boot finish, as it requires ssh connection to SUT to | ||
# interact with SUT, including window and serial console | ||
sub use_ssh_serial_console { | ||
select_console('root-ssh'); | ||
$serialdev = 'sshserial'; | ||
set_var('SERIALDEV', $serialdev); | ||
bmwqemu::save_vars(); | ||
} | ||
|
||
sub is_remote_backend { | ||
|
||
# s390x uses only remote repos | ||
return check_var('ARCH', 's390x') || | ||
check_var('BACKEND', 'svirt') || | ||
check_var('BACKEND', 'ipmi') || | ||
check_var('BACKEND', 'spvm'); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that you are addressing another issue, but I wanted to mention that is a hack. And then we have a lot of calls like
check_var('BACKEND', 'ipmi') ? use_ssh_serial_console : select_console 'root-console';
.Last time I tried to fix
select_console
with callbacks, but could not finish it quick, so postponed the idea. However, I believe we should get rid of this method in all 15 files and haveselect_console "root-console"
only. Same for user-console, except that we should switch user.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwx788 actually that's a path I'd choose for later. A bit more care needs to be added there, But completely feasible, specially if poo#45146 is addressed properly and we stop covering at the test distri level, for things that should be provided by the backend...
I'm actually cringing after seeing stuff like this :)