File: Display.pm

package info (click to toggle)
libtest-needsdisplay-perl 1.07-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 188 kB
  • ctags: 99
  • sloc: perl: 1,190; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 508 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package t::lib::Display;
use strict;
use warnings FATAL => 'all';

our $VERSION = '1.07';

use Test::More;
use Test::NeedsDisplay ':skip_all';

sub xeyes {
	my $xeyes = '/usr/bin/xeyes';

	plan skip_all => "No $xeyes" if not -e $xeyes;
	
	plan tests => 2;
	$SIG{ALRM} = sub { die "TIMEOUT\n" };
	alarm(1);
	my $pid = open(my $ph, "|$xeyes");
	eval {
		if (ok($pid, 'running xeyes')) {
			diag "PID $pid";
			sleep 3;
		}
	};
	alarm(0);
	ok($@ and $@ eq "TIMEOUT\n");
	if ($pid) {
		kill 9, $pid;
	}
}


1;