2 package PerlACE
::TestTarget_WinCE
;
4 # ******************************************************************
5 # Description : Creates a PerlACE::WinCE
6 # Author : Johnny Willemsen
7 # Create Date : 29/20/2008
8 # ******************************************************************
10 # ******************************************************************
12 # ******************************************************************
16 use PerlACE
::TestTarget
;
17 use PerlACE
::ProcessVX
;
22 our @ISA = qw(PerlACE::TestTarget);
27 my $config_name = shift;
28 my $class = ref ($proto) || $proto;
30 bless ($self, $class);
31 $self->GetConfigSettings($config_name);
33 my $env_name = $config_name.'_IPNAME';
34 if (exists $ENV{$env_name}) {
35 $targethost = $ENV{$env_name};
38 print STDERR
"You must define target hostname/IP with $env_name\n";
43 $env_name = $config_name.'_FS_ROOT';
44 my $fsroot = '\network\temp\ACE\wince6';
45 if (exists $ENV{$env_name}) {
46 $fsroot = $ENV{$env_name};
49 print STDERR
"Warning: no $env_name variable; falling back ",
52 $self->{FSROOT
} = $fsroot;
54 $self->{REBOOT_CMD
} = $ENV{'ACE_REBOOT_LVRT_CMD'};
55 if (!defined $self->{REBOOT_CMD
}) {
56 $self->{REBOOT_CMD
} = 'I_Need_A_Reboot_Command';
58 $self->{REBOOT_TIME
} = $ENV{'ACE_LVRT_REBOOT_TIME'};
59 if (!defined $self->{REBOOT_TIME
}) {
60 $self->{REBOOT_TIME
} = 200;
63 $self->{REBOOT_TIME
} = $ENV{'ACE_RUN_LVRT_REBOOT_TIME'};
64 if (!defined $self->{REBOOT_TIME
}) {
65 $self->{REBOOT_TIME
} = 200;
67 $self->{REBOOT_NEEDED
} = undef;
69 my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'};
70 my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'};
71 if (!defined $telnet_host) {
72 $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'};
74 if (!defined $telnet_port) {
77 if (!defined $self->{HOST_ROOT
}) {
78 $self->{HOST_ROOT
} = $self->{FSROOT
};
81 $PerlACE::ProcessVX
::ExeExt
= '.exe';
86 # ******************************************************************
88 # ******************************************************************
94 my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ?
$ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'};
95 if (length ($cwdrel) > 0) {
96 $cwdrel = File
::Spec
->abs2rel( cwd
(), $prjroot );
99 $cwdrel = File
::Spec
->abs2rel( $cwdrel, $prjroot );
101 my $newfile = $self->{FSROOT
} . "/" . $cwdrel . "/" . $file;
102 if (defined $ENV{'ACE_TEST_VERBOSE'}) {
103 print STDERR
"WinCE LocalFile for $file is $newfile\n";
112 if (defined $ENV{'ACE_TEST_VERBOSE'}) {
113 print STDERR
"Adding libpath $dir\n";
115 PerlACE
::add_lib_path
($dir);
121 if ($OSNAME eq "MSWin32") {
122 my $process = new PerlACE
::ProcessVX
($self, @_); return $process;
124 my $process = new PerlACE
::ProcessVX
(@_, $self); return $process;
128 # Need a reboot when this target is destroyed.
132 $self->{REBOOT_NEEDED
} = 1;
139 $self->{REBOOT_NEEDED
} = undef;
140 print STDERR
"Attempting to reboot target...\n";
144 sub WaitForFileTimed
($)
150 my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ?
$ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'};
151 if (length ($cwdrel) > 0) {
152 $cwdrel = File
::Spec
->abs2rel( cwd
(), $prjroot );
155 $cwdrel = File
::Spec
->abs2rel( $cwdrel, $prjroot );
157 my $newfile = $self->{HOST_ROOT
} . "/" . $cwdrel . "/" . $file;
158 if (defined $ENV{'ACE_TEST_VERBOSE'}) {
159 print STDERR
"WinCE waits for $newfile timeout $timeout\n";
161 return PerlACE
::waitforfile_timed
($newfile, $timeout);
164 # Put file from a to b
176 my $newfile = $self->LocalFile($file);
177 if (defined $ENV{'ACE_TEST_VERBOSE'}) {
178 print STDERR
"delete $newfile\n";
186 my $procmask = shift;
187 PerlACE
::ProcessVX
::kill_all
($procmask, $self);