Project

General

Profile

Actions

action #17058

closed

[tools]mouse_hide produces "Use of uninitialized value"

Added by michalnowak about 7 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2017-02-14
Due date:
% Done:

0%

Estimated time:

Description

https://openqa.suse.de/tests/775167/file/autoinst-log.txt

11:08:54.5087 Debug: /var/lib/openqa/share/tests/sle/tests/installation/welcome.pm:38 called testapi::mouse_hide
11:08:54.5088 31889 <<< testapi::mouse_hide(border_offset=0)
Use of uninitialized value in numeric eq (==) at /usr/lib/os-autoinst/consoles/vnc_base.pm line 169.
11:08:54.5092 32004 mouse_move 1023, 767
11:08:54.5092 32004 send_pointer_event 0, 1023, 767, 1

Not affecting anything, pointer gets hidden, just the warning.

Actions #1

Updated by okurz about 7 years ago

  • Category set to Regressions/Crashes
  • Target version set to Milestone 6
Actions #2

Updated by okurz about 7 years ago

  • Target version changed from Milestone 6 to Milestone 7
Actions #3

Updated by dheidler about 7 years ago

  • Assignee set to dheidler

In sub connect_vnc:

$self->{mouse} = {x => undef, y => undef};

In sub _mouse_move:

if ($self->{mouse}->{x} == $x && $self->{mouse}->{y} == $y) {
Actions #4

Updated by dheidler about 7 years ago

  • Status changed from New to In Progress
Actions #5

Updated by RBrownSUSE about 7 years ago

  • Subject changed from mouse_hide produces "Use of uninitialized value" to [tools]mouse_hide produces "Use of uninitialized value"
Actions #6

Updated by dheidler about 7 years ago

  • Status changed from In Progress to Resolved

merged

Actions #7

Updated by AdamWill about 7 years ago

This was a bad idea: it actually breaks some of our tests.

The problem is a bad interaction with assert_and_click , which after it clicks inside the match location, does this:

if (defined $old_mouse_coords->{x} && defined $old_mouse_coords->{y}) {
    return mouse_set($old_mouse_coords->{x}, $old_mouse_coords->{y});
}
else {
    return mouse_hide();
}

The problem is that after this change, $old_mouse_coords->{x} and $old_mouse_coords->{y} are always defined - they're just defined to -1, if the mouse has never been explicitly positioned before the assert_and_click call. So instead of doing mouse_hide() in this case, as it did before, assert_and_click winds up calling mouse_set(-1, -1). I dunno if the behaviour of that is defined in the VNC spec, but what it seems to do in practice at least in qemu is either not move the mouse at all or just move it 1 pixel in each direction (I can't really tell which).

This breaks several of our tests which need to click the same button twice, because the second assert_and_click fails because there's now a mouse cursor sitting on top of the button.

Fix should be pretty simple, I think, just change:

if (defined $old_mouse_coords->{x} && defined $old_mouse_coords->{y})

to:

if ($old_mouse_coords->{x} > -1 && $old_mouse_coords->{y} > -1)

I'll send a PR.

Actions #8

Updated by dheidler about 7 years ago

Adam's PR got merged: d8f75d2bc24f63a58545d20b79064a7131d41aa2

Actions

Also available in: Atom PDF