~ubuntu-branches/ubuntu/precise/libpgm/precise

« back to all changes in this revision

Viewing changes to openpgm/pgm/test/.svn/text-base/apdu.pl.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Gabriel de Perthuis
  • Date: 2011-04-07 16:48:52 UTC
  • Revision ID: james.westby@ubuntu.com-20110407164852-8uamem42ojeptj6l
Tags: upstream-5.1.116~dfsg
ImportĀ upstreamĀ versionĀ 5.1.116~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
# apdu.pl
 
3
# 6.1. Data Reception
 
4
 
 
5
use strict;
 
6
use PGM::Test;
 
7
 
 
8
BEGIN { require "test.conf.pl"; }
 
9
 
 
10
$| = 1;
 
11
 
 
12
my $mon = PGM::Test->new(tag => 'mon', host => $config{mon}{host}, cmd => $config{mon}{cmd});
 
13
my $sim = PGM::Test->new(tag => 'sim', host => $config{sim}{host}, cmd => $config{sim}{cmd});
 
14
my $app = PGM::Test->new(tag => 'app', host => $config{app}{host}, cmd => $config{app}{cmd});
 
15
 
 
16
$mon->connect;
 
17
$sim->connect;
 
18
$app->connect;
 
19
 
 
20
sub close_ssh {
 
21
        $mon = $sim = $app = undef;
 
22
        print "finished.\n";
 
23
}
 
24
 
 
25
$SIG{'INT'} = sub { print "interrupt caught.\n"; close_ssh(); };
 
26
 
 
27
$mon->say ("filter $config{app}{ip}");
 
28
print "mon: ready.\n";
 
29
 
 
30
$app->say ("set network $config{app}{network}");
 
31
$app->say ("create ao");
 
32
$app->say ("bind ao");
 
33
$app->say ("connect ao");
 
34
$app->say ("listen ao");
 
35
 
 
36
$sim->say ("set network $config{sim}{network}");
 
37
$sim->say ("create ao");
 
38
$sim->say ("bind ao");
 
39
$sim->say ("connect ao");
 
40
 
 
41
print "sim: publish APDU.\n";
 
42
$sim->say ("send ao ringo x 1000");
 
43
 
 
44
print "app: wait for data ...\n";
 
45
my $data = $app->wait_for_data;
 
46
print "app: received data [$data].\n";
 
47
 
 
48
my $ref_data = "ringo" x 1000;
 
49
die "incoming data corrupt\n" unless ($data == $ref_data);
 
50
 
 
51
print "test completed successfully.\n";
 
52
 
 
53
$mon->disconnect (1);
 
54
$sim->disconnect;
 
55
$app->disconnect;
 
56
close_ssh;
 
57
 
 
58
# eof