File Coverage

backend/console_proxy.pm
Criterion Covered Total %
statement 35 36 97.2
total 35 36 97.2


line stmt code
1   # Copyright 2009-2013 Bernhard M. Wiedemann
2   # Copyright 2012-2020 SUSE LLC
3   # SPDX-License-Identifier: GPL-2.0-or-later
4    
5   # This is the direct companion to backend::proxy_console_call()
6   #
7   # "console_proxy" is a proxy object for calls to specific terminal functions
8   # like s3270->... or vnc->... or ssh->... from the tests in the main
9   # thread.
10    
11    
12   use Mojo::Base -strict, -signatures;
13 54 use feature 'say';
  54  
  54  
14 54  
  54  
  54  
15   my $self = bless({class => $class, console => $console}, $class);
16 2 return $self;
  2  
  2  
  2  
17 2 }
18 2  
19   # nothing to destroy but avoid AUTOLOAD
20    
21   # handles the attempt to invoke an undefined method on the proxy console object
22 0 # using query_isotovideo() to invoke the method on the actual console object in
23   # the right process
24   my $function = our $AUTOLOAD;
25    
26   $function =~ s,.*::,,;
27 14  
  14  
  14  
  14  
28 14 # allow symbolic references
29   no strict 'refs';
30 14 *$AUTOLOAD = sub ($self, @args) {
31   my $wrapped_call = {
32   console => $self->{console},
33 54 function => $function,
  54  
  54  
34 40 args => \@args,
  40  
  40  
  40  
35   wantarray => wantarray,
36   };
37 40  
38   bmwqemu::log_call(wrapped_call => $wrapped_call);
39   my $wrapped_retval = autotest::query_isotovideo('backend_proxy_console_call', $wrapped_call);
40   die $wrapped_retval->{exception} if exists $wrapped_retval->{exception};
41    
42 40 # get more screenshots from consoles, especially from x3270 on s390
43 40 $autotest::current_test->take_screenshot;
44 40  
45   # get more screenshots from consoles, especially from x3270 on s390
46   $autotest::current_test->take_screenshot;
47 39  
48   return wantarray ? @{$wrapped_retval->{result}} : $wrapped_retval->{result};
49   };
50 39  
51   goto &$AUTOLOAD;
52 39 }
  12  
53 14  
54   1;