/[dejagnu]/dejagnu/doc/overview/x319.html
ViewVC logotype

Diff of /dejagnu/doc/overview/x319.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rsavoye, Sat Aug 31 05:44:56 2002 UTC revision 1.2 by bje, Sun Aug 17 23:00:07 2003 UTC
# Line 77  NAME="AEN319" Line 77  NAME="AEN319"
77  ><P  ><P
78  >Testing remote targets is a lot trickier especially if you are using an  >Testing remote targets is a lot trickier especially if you are using an
79   embedded target   embedded target
80  which has no built in support for things like a compiler, ftp server or a Bash-shell.  which has no built in support for things like a compiler, ftp server or a Bash-shell.
81  Before you can test calc on a remote target you have to acquire a few basics skills.</P  Before you can test calc on a remote target you have to acquire a few basics skills.</P
82  ><DIV  ><DIV
83  CLASS="SECT2"  CLASS="SECT2"
# Line 88  NAME="AEN322" Line 88  NAME="AEN322"
88  >Setup telnet to your own host</A  >Setup telnet to your own host</A
89  ></H2  ></H2
90  ><P  ><P
91  >The easiest remote host is usually the host you are working on.  >The easiest remote host is usually the host you are working on.
92  In this example we will use telnet to login in your own workstation.  In this example we will use telnet to login in your own workstation.
93  For security reason you should never have a telnet deamon running on  For security reason you should never have a telnet deamon running on
94  machine connected on the internet, as password and usernames are transmitted  machine connected on the internet, as password and usernames are transmitted
95   in clear text.   in clear text.
96  We assume you know how to setup your machine for a telnet daemon.</P  We assume you know how to setup your machine for a telnet daemon.</P
97  ><P  ><P
98  >Next try whether you may login in your own host by issuing the  >Next try whether you may login in your own host by issuing the
99  command &#8220;telnet localhost.1&#8221;. In order to be able to  command &#8220;telnet localhost.1&#8221;. In order to be able to
100  distinguish between a normal session an a telnet login add the following lines to /home/dgt/.bashrc.</P  distinguish between a normal session an a telnet login add the following lines to /home/dgt/.bashrc.</P
101  ><TABLE  ><TABLE
102  BORDER="0"  BORDER="0"
# Line 107  WIDTH="100%" Line 107  WIDTH="100%"
107  ><PRE  ><PRE
108  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
109  >if [ "$REMOTEHOST" ]  >if [ "$REMOTEHOST" ]
110  then  then
111     PS1='remote:\w\$ '     PS1='remote:\w\$ '
112  fi</PRE  fi</PRE
113  ></TD  ></TD
114  ></TR  ></TR
# Line 133  WIDTH="100%" Line 133  WIDTH="100%"
133  ><PRE  ><PRE
134  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
135  >dgt:~/dejagnu.test$ telnet localhost  >dgt:~/dejagnu.test$ telnet localhost
136  Trying 127.0.0.1...  Trying 127.0.0.1...
137  Connected to 127.0.0.1.  Connected to 127.0.0.1.
138  Escape character is '^]'.  Escape character is '^]'.
139  Debian GNU/Linux testing/unstable Linux  Debian GNU/Linux testing/unstable Linux
140  K6Linux login: dgt  K6Linux login: dgt
141  Password:  Password:
142  Last login: Sun Nov 25 22:46:34 2001 from localhost on pts/4  Last login: Sun Nov 25 22:46:34 2001 from localhost on pts/4
143  Linux K6Linux 2.4.14 #1 Fre Nov 16 19:28:25 CET 2001 i586 unknown  Linux K6Linux 2.4.14 #1 Fre Nov 16 19:28:25 CET 2001 i586 unknown
144  No mail.  No mail.
145  remote:~$ exit  remote:~$ exit
146  logout  logout
147  Connection closed by foreign host.</PRE  Connection closed by foreign host.</PRE
148  ></TD  ></TD
149  ></TR  ></TR
# Line 159  NAME="AEN331" Line 159  NAME="AEN331"
159  >A test case for login via telnet</A  >A test case for login via telnet</A
160  ></H2  ></H2
161  ><P  ><P
162  >In order to define a correct setup we have add a line containing  >In order to define a correct setup we have add a line containing
163  &#8220;set target unix&#8221; either to ~/.dejagnurc or to ~/my_dejagnu.exp.  &#8220;set target unix&#8221; either to ~/.dejagnurc or to ~/my_dejagnu.exp.
164  In ~/boards/standard.exp add the following four lines to define a few patterns for the DejaGnu telnet login procedure.</P  In ~/boards/standard.exp add the following four lines to define a few patterns for the DejaGnu telnet login procedure.</P
165  ><DIV  ><DIV
166  CLASS="EXAMPLE"  CLASS="EXAMPLE"
# Line 179  WIDTH="100%" Line 179  WIDTH="100%"
179  ><TD  ><TD
180  ><PRE  ><PRE
181  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
182  >set_board_info shell_prompt    "remote:"  >set_board_info shell_prompt    "remote:"
183  set_board_info telnet_username "dgt"  set_board_info telnet_username "dgt"
184  set_board_info telnet_password "top_secret"  set_board_info telnet_password "top_secret"
185  set_board_info hostname        "localhost"&#13;</PRE  set_board_info hostname        "localhost"&#13;</PRE
186  ></TD  ></TD
187  ></TR  ></TR
188  ></TABLE  ></TABLE
189  ></DIV  ></DIV
190  ><P  ><P
191  >As DejaGnu will be parsing the telnet session output for some well  >As DejaGnu will be parsing the telnet session output for some well
192  known pattern the output there are a lot of things that can go wrong.  known pattern the output there are a lot of things that can go wrong.
193  If you have any problems verify your setup:</P  If you have any problems verify your setup:</P
194  ><P  ><P
195  ></P  ></P
# Line 221  CLASS="FILENAME" Line 221  CLASS="FILENAME"
221  ></LI  ></LI
222  ></UL  ></UL
223  ><P  ><P
224  >To test the login via telnet write a sample test case.  >To test the login via telnet write a sample test case.
225  Create the file ~/dejagnu.test/testsuite/calc.test/remote_echo.exp and  Create the file ~/dejagnu.test/testsuite/calc.test/remote_echo.exp and
226  add the following few lines:</P  add the following few lines:</P
227  ><DIV  ><DIV
228  CLASS="EXAMPLE"  CLASS="EXAMPLE"
# Line 242  WIDTH="100%" Line 242  WIDTH="100%"
242  ><PRE  ><PRE
243  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
244  >puts "this is remote_echo.exp target for $target "  >puts "this is remote_echo.exp target for $target "
245  target_info $target  target_info $target
246  #set verbose 9  #set verbose 9
247  set shell_id [remote_open $target]  set shell_id [remote_open $target]
248  set test "Remote login to $target"  set test "Remote login to $target"
249  #set verbose 0  #set verbose 0
250  puts "Spawn id for remote shell is $shell_id"  puts "Spawn id for remote shell is $shell_id"
251  if { $shell_id &#62; 0 } {  if { $shell_id &#62; 0 } {
252     pass "$test"     pass "$test"
253  } else {  } else {
254     fail "Remote open to $target"     fail "Remote open to $target"
255  }</PRE  }</PRE
256  ></TD  ></TD
257  ></TR  ></TR
# Line 267  WIDTH="100%" Line 267  WIDTH="100%"
267  ><TD  ><TD
268  ><PRE  ><PRE
269  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
270  >Running ./testsuite/calc.test/local_echo.exp ...  >Running ./testsuite/calc.test/local_echo.exp ...
271  Running ./testsuite/calc.test/remote_echoo.exp ...  Running ./testsuite/calc.test/remote_echoo.exp ...
272  this is remote_echo.exp target is unix  this is remote_echo.exp target is unix
273  Spawn id for remote shell is exp7</PRE  Spawn id for remote shell is exp7</PRE
274  ></TD  ></TD
275  ></TR  ></TR
# Line 287  NAME="AEN357" Line 287  NAME="AEN357"
287  >Remote testing &#8220;Hello world&#8221;</A  >Remote testing &#8220;Hello world&#8221;</A
288  ></H2  ></H2
289  ><P  ><P
290  >Next you will transform the above &#8220;hello world&#8221; example to  >Next you will transform the above &#8220;hello world&#8221; example to
291  its remote equivalent.  its remote equivalent.
292  This can be done by adding the following lines to our file remote_echo.exp.</P  This can be done by adding the following lines to our file remote_echo.exp.</P
293  ><DIV  ><DIV
294  CLASS="EXAMPLE"  CLASS="EXAMPLE"
# Line 307  WIDTH="100%" Line 307  WIDTH="100%"
307  ><TD  ><TD
308  ><PRE  ><PRE
309  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
310  >set test "Remote_send Hello World"  >set test "Remote_send Hello World"
311  set status [remote_send $target "echo \"Hello World\"\n" ]  set status [remote_send $target "echo \"Hello World\"\n" ]
312  pass "$test"  pass "$test"
313  set test "Remote_expect Hello World"  set test "Remote_expect Hello World"
314  remote_expect $target 5 {  remote_expect $target 5 {
315     -re "Hello World"  { pass "$test" }     -re "Hello World"  { pass "$test" }
316  }</PRE  }</PRE
317  ></TD  ></TD
318  ></TR  ></TR
# Line 324  remote_expect $target 5 { Line 324  remote_expect $target 5 {
324  ><P  ><P
325  >Have a look at the procedures in /usr/share/dejagnu/remote.exp to have an overview of the offered procedures and their features. </P  >Have a look at the procedures in /usr/share/dejagnu/remote.exp to have an overview of the offered procedures and their features. </P
326  ><P  ><P
327  >Now setup a real target.  >Now setup a real target.
328  In the following example we assume as target a PowerBook running Debian.  In the following example we assume as target a PowerBook running Debian.
329  As above add a test user "dgt", install telnet and FTP servers.  As above add a test user "dgt", install telnet and FTP servers.
330  In order to distinguish it from the host add the line  In order to distinguish it from the host add the line
331  <TABLE  <TABLE
332  BORDER="0"  BORDER="0"
333  BGCOLOR="#E0E0E0"  BGCOLOR="#E0E0E0"
# Line 340  CLASS="PROGRAMLISTING" Line 340  CLASS="PROGRAMLISTING"
340  ></TD  ></TD
341  ></TR  ></TR
342  ></TABLE  ></TABLE
343  > to /home/dgt/.bash_profile.  > to /home/dgt/.bash_profile.
344  Also add a corresponding entry "powerbook" to /etc/hosts and verify that you  Also add a corresponding entry "powerbook" to /etc/hosts and verify that you
345  are able to ping, telnet and ftp to the target "powerbook".</P  are able to ping, telnet and ftp to the target "powerbook".</P
346  ><P  ><P
347  >In order to let runtest run its test on the "powerbook" target change the following lines in ~/boards/standard.exp:</P  >In order to let runtest run its test on the "powerbook" target change the following lines in ~/boards/standard.exp:</P
# Line 420  puts "status of remote_download ist $sta Line 420  puts "status of remote_download ist $sta
420  ></TABLE  ></TABLE
421  ></DIV  ></DIV
422  ><P  ><P
423  >After running runtest again, check whether the file dejagnu2 exists on the target.  >After running runtest again, check whether the file dejagnu2 exists on the target.
424    
425  This example will only work if the rcp command works with your target.  This example will only work if the rcp command works with your target.
426    
427  If you have a working FTP-server on the target you can use it by adding the  If you have a working FTP-server on the target you can use it by adding the
428  following lines to ~/boards/standard.exp:</P  following lines to ~/boards/standard.exp:</P
429  ><DIV  ><DIV
430  CLASS="EXAMPLE"  CLASS="EXAMPLE"
# Line 461  NAME="AEN382" Line 461  NAME="AEN382"
461  ></H2  ></H2
462  ><P  ><P
463  >For crosscompiling you need working binutils, gcc and a base library like  >For crosscompiling you need working binutils, gcc and a base library like
464  libc or glib for your target.  libc or glib for your target.
465  It is beyond the scope of this document to describe how to get it working.  It is beyond the scope of this document to describe how to get it working.
466  The following examples assume a cross compiler for PowerPC which is called linux-powerpc-gcc.</P  The following examples assume a cross compiler for PowerPC which is called linux-powerpc-gcc.</P
467  ><P  ><P
468  >Add AC_CANONICAL_TARGET in dejagnu.test/configure.in at the following location. Copy config.guess from /usr/share/automake to dejagnu.test.</P  >Add AC_CANONICAL_TARGET in dejagnu.test/configure.in at the following location. Copy config.guess from /usr/share/automake to dejagnu.test.</P
# Line 475  WIDTH="100%" Line 475  WIDTH="100%"
475  ><PRE  ><PRE
476  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
477  >AM_CONFIG_HEADER(calc.h)  >AM_CONFIG_HEADER(calc.h)
478  AC_CANONICAL_TARGET([])  AC_CANONICAL_TARGET([])
479  AM_INIT_AUTOMAKE(calc, 1.1)</PRE  AM_INIT_AUTOMAKE(calc, 1.1)</PRE
480  ></TD  ></TD
481  ></TR  ></TR
482  ></TABLE  ></TABLE
483  ><P  ><P
484  >You need to run automake 2.5 or later.  >You need to run automake 2.5 or later.
485  Depending on your installation calling autoconf2.5 instead of autoconf is not needed.  Depending on your installation calling autoconf2.5 instead of autoconf is not needed.
486  The sequence to regenerate all files is:</P  The sequence to regenerate all files is:</P
487  ><DIV  ><DIV
488  CLASS="EXAMPLE"  CLASS="EXAMPLE"
# Line 504  CLASS="PROGRAMLISTING" Line 504  CLASS="PROGRAMLISTING"
504  >$ autoconf2.5  >$ autoconf2.5
505  $ autoheader  $ autoheader
506  $ automake  $ automake
507  $ ./configure --host=powerpc-linux --target=powerpc-linux  $ ./configure --host=powerpc-linux --target=powerpc-linux
508  configure: WARNING: If you wanted to set the --build type, don't use --host.  configure: WARNING: If you wanted to set the --build type, don't use --host.
509      If a cross compiler is detected then cross compile mode will be used.      If a cross compiler is detected then cross compile mode will be used.
510  checking build system type... ./config.guess: ./config.guess: No such file or directory  checking build system type... ./config.guess: ./config.guess: No such file or directory
511  configure: error: cannot guess build type; you must specify one  configure: error: cannot guess build type; you must specify one
512  $ cp /usr/share/automake/config.guess .  $ cp /usr/share/automake/config.guess .
513  $ ./configure --host=powerpc-linux --target=powerpc-linux  $ ./configure --host=powerpc-linux --target=powerpc-linux
514  configure: WARNING: If you wanted to set the --build type, don't use --host.  configure: WARNING: If you wanted to set the --build type, don't use --host.
515  If a cross compiler is detected then cross compile mode will be used. \  If a cross compiler is detected then cross compile mode will be used. \
516  checking build system type... i586-pc-linux-gnu  checking build system type... i586-pc-linux-gnu
# Line 537  WIDTH="100%" Line 537  WIDTH="100%"
537  ><PRE  ><PRE
538  CLASS="PROGRAMLISTING"  CLASS="PROGRAMLISTING"
539  >$ make  >$ make
540  powerpc-linux-gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c calc.c  powerpc-linux-gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c calc.c
541  powerpc-linux-gcc -g -O2 -o calc calc.o&#13;</PRE  powerpc-linux-gcc -g -O2 -o calc calc.o&#13;</PRE
542  ></TD  ></TD
543  ></TR  ></TR
# Line 629  VALIGN="top" Line 629  VALIGN="top"
629  ></DIV  ></DIV
630  ></BODY  ></BODY
631  ></HTML  ></HTML
 >  
632    >

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26