Skip to content

Commit

Permalink
Merge pull request #19282 from pevik/pynfs/cleanup
Browse files Browse the repository at this point in the history
Pynfs/cleanup
  • Loading branch information
SeroSun committed May 11, 2024
2 parents 3755d0e + 485e043 commit dfc5f72
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
8 changes: 4 additions & 4 deletions tests/nfs/generate_report.pm
Expand Up @@ -15,15 +15,15 @@ use testapi;
use serial_terminal 'select_serial_terminal';
use upload_system_log;

sub display_results {
sub display_pynfs_results {
my $self = shift;
my $skip = "";
my $pass = "";
my $fail = 0;

my $folder = get_required_var('PYNFS');
my $version = get_required_var('NFSVERSION');

assert_script_run("cd ~/pynfs/$folder");
assert_script_run("cd ~/pynfs/nfs$version");
upload_logs('results.json', failok => 1);

my $content = script_output('cat results.json');
Expand Down Expand Up @@ -104,7 +104,7 @@ sub run {
select_serial_terminal;

if (get_var("PYNFS")) {
$self->display_results();
$self->display_pynfs_results();
}
elsif (get_var("CTHON04")) {
$self->upload_cthon04_log();
Expand Down
20 changes: 15 additions & 5 deletions tests/nfs/install.pm
Expand Up @@ -45,22 +45,30 @@ sub install_dependencies_cthon04 {

sub install_testsuite {
my $testsuite = shift;
if (get_var("PYNFS")) {
my $url = get_var('PYNFS_GIT_URL', 'git://git.linux-nfs.org/projects/cdmackay/pynfs.git');
my $rel = get_var('PYNFS_RELEASE');
my ($url, $rel);

if (get_var("PYNFS")) {
$url = get_var('PYNFS_GIT_URL', 'git://git.linux-nfs.org/projects/cdmackay/pynfs.git');
$rel = get_var('PYNFS_RELEASE');
$rel = "-b $rel" if ($rel);

install_dependencies_pynfs;
assert_script_run("git clone -q --depth 1 $url $rel && cd ./pynfs");
assert_script_run('./setup.py build && ./setup.py build_ext --inplace');
}
elsif (get_var("CTHON04")) {
my $url = get_var('CTHON04_GIT_URL', 'git://git.linux-nfs.org/projects/steved/cthon04.git');
$url = get_var('CTHON04_GIT_URL', 'git://git.linux-nfs.org/projects/steved/cthon04.git');
$rel = get_var('CTHON04_RELEASE');
$rel = "-b $rel" if ($rel);

install_dependencies_cthon04;
assert_script_run("git clone -q --depth 1 $url && cd ./cthon04");
assert_script_run('make');
}
else {
die 'PYNFS or CTHON04 variable is mandatory';
}

record_info('git version', script_output('git log -1 --pretty=format:"git-%h" | tee'));
}

Expand Down Expand Up @@ -88,13 +96,15 @@ sub setup_nfs_server {
}

sub run {
my $version = get_required_var("NFSVERSION");

select_serial_terminal;

# Disable PackageKit
quit_packagekit;

install_testsuite;
setup_nfs_server(get_var("NFSVERSION"));
setup_nfs_server($version);
}

sub test_flags {
Expand Down
2 changes: 1 addition & 1 deletion tests/nfs/pynfs_result.pm
Expand Up @@ -22,7 +22,7 @@ sub run {
my $data = $args->{data};
my $test = $data->{code};
my $message = $data->{failure}->{message};
my $is_v4 = get_required_var('PYNFS') eq 'nfs4.0';
my $is_v4 = get_required_var('NFSVERSION') eq '4.0';
my $log = "$message\n\n$data->{failure}->{err}";
my $softfail;

Expand Down
28 changes: 16 additions & 12 deletions tests/nfs/run.pm
Expand Up @@ -17,19 +17,14 @@ use serial_terminal 'select_serial_terminal';
use utils;
use power_action_utils 'power_action';

sub pynfs_server_test_all {
my $folder = get_required_var('PYNFS');

assert_script_run("cd ./$folder");
script_run('./testserver.py -v --rundeps --hidepass --json results.json --maketree localhost:/exportdir all', 3600);
}

sub run {
select_serial_terminal;

if (get_var("PYNFS")) {
script_run('cd ~/pynfs');
pynfs_server_test_all;
my $version = get_required_var('NFSVERSION');

assert_script_run("cd ~/pynfs/nfs$version");
script_run('./testserver.py -v --rundeps --hidepass --json results.json --maketree localhost:/exportdir all', 3600);
}
elsif (get_var("CTHON04")) {
script_run('cd ~/cthon04');
Expand All @@ -49,7 +44,8 @@ sub run {
BOOT_HDD_IMAGE=1
DESKTOP=textmode
HDD_1=SLES-%VERSION%-%ARCH%-%BUILD%@%MACHINE%-minimal_with_sdk%BUILD_SDK%_installed.qcow2
PYNFS=nfs4.0
PYNFS=1
NFSVERSION=4.0
UEFI_PFLASH_VARS=SLES-%VERSION%-%ARCH%-%BUILD%@%MACHINE%-minimal_with_sdk%BUILD_SDK%_installed-uefi-vars.qcow2
START_AFTER_TEST=create_hdd_minimal_base+sdk
Expand All @@ -59,7 +55,7 @@ Overrides the official pynfs repository URL.
=head2 PYNFS_RELEASE
This can be set to a release tag, commit hash, branch name or whatever else Git
This can be set to a release tag, commit hash, branch name or whatever else git
will accept.
If not set, then the default clone action will be performed, which probably
Expand All @@ -81,6 +77,14 @@ Fill 3 or 4 in this parameter to set test NFSv3 or NFSv4.
=head2 CTHON04_GIT_URL
Similar PYNFS_GIT_URL, it overrides the official cthon04 repository URL.
Overrides the official cthon04 repository URL.
=head2 CTHON04_RELEASE
This can be set to a release tag, commit hash, branch name or whatever else git
will accept.
If not set, then the default clone action will be performed, which probably
means the latest master branch will be used.
=cut

0 comments on commit dfc5f72

Please sign in to comment.