summaryrefslogtreecommitdiff
path: root/tests/autotest-remote-host.pl
blob: 5abef1e12f7a12e8372c6cd3167b8bc1058734ce (plain)
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
36
37
#!/usr/bin/perl

sub execprint
{
	my $cmd = shift;

	open PIPE, "$cmd |" || die "$cmd failed: $!\n";
	print while (<PIPE>);
	close PIPE;

	return $?;
}

use IO::Socket;
use Net::Ping;

$exitcmd = shift;
$host = "10.0.2.2";

# wait while network is up
$ping = Net::Ping->new("icmp");

while (!$ping->ping($host))
{
	print "### autotest $host is down, retrying...\n";
}

print "### autotest $host is up, connecting...\n";

my $client = new IO::Socket::INET(PeerAddr => "$host:7183");
exit unless $client;

select $client;

&execprint('svn up') == 0 || die "error updating from repo\n";
&execprint('perl tests/autotest-local.pl') == 0 || die "error launching tests\n";
system($exitcmd);