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

Add module name to uploaded files #406

Merged
merged 1 commit into from Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions commands.pm
Expand Up @@ -170,11 +170,18 @@ sub upload_file {
mkdir($target) or die "$!";
}

my $upname = basename($self->param('filename'));
my $upname = $self->param('upname');
my $filename = basename($self->param('filename'));
# Only renaming the file if upname parameter has posted ie. from upload_logs()
# With this it won't renamed the file in case upload_assert and autoyast profile
# as those are not called from upload_logs.
if ($upname) {
$filename = basename($upname);
}

$upload->move_to("$target/$upname");
$upload->move_to("$target/$filename");

return $self->render(text => "OK: $upname\n");
return $self->render(text => "OK: $filename\n");
}


Expand Down
3 changes: 2 additions & 1 deletion testapi.pm
Expand Up @@ -390,8 +390,9 @@ sub upload_logs {
my ($file) = @_;

bmwqemu::log_call('upload_logs', file => $file);
my $cmd = "curl --form upload=\@$file ";
my $basename = basename($file);
my $upname = ref($autotest::current_test) . '-' . $basename;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use $autotest::current_test->{fullname}? It will then use $category-$name prefix. I think it will better address from where the logs are and I'm also afraid of tests with the same name possibly overwriting their logs. Or am I overthinking it too much?

Copy link
Member Author

Choose a reason for hiding this comment

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

It just a too long filename to me, and I can't see the use case that the log will be overwrited from anything else, do we have duplicate module name?

I'm fine with the long name if it's preferred. What other people think here? :)

Copy link
Member

Choose a reason for hiding this comment

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

👍 for long name, better be unambiguous. We should try not to have double module name but we can not rely on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

See #409 (comment) i.e. 'shutdown' we have shutdown/shutdown.pm and x11/shutdown.pm.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should fail if module names are duplicated in one test - the job module index in the DB is the name not the fullname. And we only show the name in the overview page. So let's not make this more complicated here

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, even better. Where can we fail? i.e. where are all modules referenced by shortname?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO loadtest should fail - right now it stores the tests in %tests by $fullname. I would make that fatal by $name

Copy link
Member

Choose a reason for hiding this comment

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

my $cmd = "curl --form upload=\@$file --form upname=$upname ";
$cmd .= autoinst_url("/uploadlog/$basename");
return assert_script_run($cmd);
}
Expand Down