<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Interactive Tests</TITLE
|
>Interactive Tests</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="Tests and Demonstrations"
|
TITLE="Tests and Demonstrations"
|
HREF="net-common-tests-and-demonstrations.html"><LINK
|
HREF="net-common-tests-and-demonstrations.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="Performance Test"
|
TITLE="Performance Test"
|
HREF="net-common-performance-test.html"><LINK
|
HREF="net-common-performance-test.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Maintenance Tools "
|
TITLE="Maintenance Tools "
|
HREF="net-common-maintenance-tools.html"></HEAD
|
HREF="net-common-maintenance-tools.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECT1"
|
CLASS="SECT1"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-common-performance-test.html"
|
HREF="net-common-performance-test.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 36. Tests and Demonstrations</TD
|
>Chapter 36. Tests and Demonstrations</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-common-maintenance-tools.html"
|
HREF="net-common-maintenance-tools.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="NET-COMMON-INTERACTIVE-TESTS">Interactive Tests</H1
|
NAME="NET-COMMON-INTERACTIVE-TESTS">Interactive Tests</H1
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
><SPAN
|
><SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>server_test</I
|
>server_test</I
|
></SPAN
|
></SPAN
|
> - a very simple server example</PRE
|
> - a very simple server example</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This test simply awaits a connection on port 7734 and after
|
>This test simply awaits a connection on port 7734 and after
|
accepting a connection, gets a packet (with a timeout of a few seconds)
|
accepting a connection, gets a packet (with a timeout of a few seconds)
|
and prints it. </P
|
and prints it. </P
|
><P
|
><P
|
>The connection is then closed. We then loop to await the next
|
>The connection is then closed. We then loop to await the next
|
connection, and so on. To use it, telnet to the target on port 7734
|
connection, and so on. To use it, telnet to the target on port 7734
|
then type something (quickly!)</P
|
then type something (quickly!)</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>% telnet 172.16.19.171 7734
|
>% telnet 172.16.19.171 7734
|
Hello target board</PRE
|
Hello target board</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>and the test program will print something like:</P
|
>and the test program will print something like:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>connection from 172.16.19.13:3369
|
>connection from 172.16.19.13:3369
|
buf = "Hello target board"</PRE
|
buf = "Hello target board"</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
><SPAN
|
><SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>ga_server_test</I
|
>ga_server_test</I
|
></SPAN
|
></SPAN
|
> - another very simple server example</PRE
|
> - another very simple server example</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This is a variation on the <SPAN
|
>This is a variation on the <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>ga_server_test</I
|
>ga_server_test</I
|
></SPAN
|
></SPAN
|
> test
|
> test
|
with the difference being that it uses the <TT
|
with the difference being that it uses the <TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>getaddrinfo</TT
|
>getaddrinfo</TT
|
>
|
>
|
function to set up its addresses. On a system with IPv6 enabled, it will
|
function to set up its addresses. On a system with IPv6 enabled, it will
|
listen on port 7734 for a TCP connection via either IPv4 or IPv6.</P
|
listen on port 7734 for a TCP connection via either IPv4 or IPv6.</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
><SPAN
|
><SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>tftp_client_test</I
|
>tftp_client_test</I
|
></SPAN
|
></SPAN
|
> - performs a tftp get and put from/to “server”</PRE
|
> - performs a tftp get and put from/to “server”</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This is only partially interactive. You need to set things
|
>This is only partially interactive. You need to set things
|
up on the “server” in order for this to work,
|
up on the “server” in order for this to work,
|
and you will need to look at the server afterwards to confirm that all
|
and you will need to look at the server afterwards to confirm that all
|
was well.</P
|
was well.</P
|
><P
|
><P
|
>For each interface in turn, this test attempts to read by
|
>For each interface in turn, this test attempts to read by
|
tftp from the server, a file called
|
tftp from the server, a file called
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>tftp_get</TT
|
>tftp_get</TT
|
>
|
>
|
and
|
and
|
prints the status and contents it read (if any). It then writes
|
prints the status and contents it read (if any). It then writes
|
the same data to a file called
|
the same data to a file called
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>tftp_put</TT
|
>tftp_put</TT
|
>
|
>
|
on
|
on
|
the same server.</P
|
the same server.</P
|
><P
|
><P
|
>In order for this to succeed, both files must already exist.
|
>In order for this to succeed, both files must already exist.
|
The TFTP protocol does not require that a WRQ request _create_ a
|
The TFTP protocol does not require that a WRQ request _create_ a
|
file, just that it can write it. The TFTP server on Linux certainly
|
file, just that it can write it. The TFTP server on Linux certainly
|
will only allow writes to an existing file, given the appropriate
|
will only allow writes to an existing file, given the appropriate
|
permission. Thus, you need to have these files in place, with proper permission,
|
permission. Thus, you need to have these files in place, with proper permission,
|
before running the test.</P
|
before running the test.</P
|
><P
|
><P
|
>The conventional place for the tftp server to operate in LINUX
|
>The conventional place for the tftp server to operate in LINUX
|
is /tftpboot/; you will likely need root privileges
|
is /tftpboot/; you will likely need root privileges
|
to create files there. The data contents of
|
to create files there. The data contents of
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>tftp_get</TT
|
>tftp_get</TT
|
>
|
>
|
can
|
can
|
be anything you like, but anything very large will waste lots of
|
be anything you like, but anything very large will waste lots of
|
time printing it on the test’s stdout, and anything above
|
time printing it on the test’s stdout, and anything above
|
32kB will cause a buffer overflow and unpredictable failure.</P
|
32kB will cause a buffer overflow and unpredictable failure.</P
|
><P
|
><P
|
>Creating an empty tftp_put file (eg. by copying /dev/null
|
>Creating an empty tftp_put file (eg. by copying /dev/null
|
to it) is neatest. So before the test you should have something
|
to it) is neatest. So before the test you should have something
|
like:</P
|
like:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get
|
>-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get
|
-rw-rw-rw- 1 root 0 May 1 15:52 tftp_put </PRE
|
-rw-rw-rw- 1 root 0 May 1 15:52 tftp_put </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>note that both files have public permissions wide open. After
|
>note that both files have public permissions wide open. After
|
running the test,
|
running the test,
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>tftp_put</TT
|
>tftp_put</TT
|
>
|
>
|
should
|
should
|
be a copy of
|
be a copy of
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>tftp_get</TT
|
>tftp_get</TT
|
>.</P
|
>.</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get
|
>-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get
|
-rw-rw-rw- 1 root 1076 May 1 15:52 tftp_put </PRE
|
-rw-rw-rw- 1 root 1076 May 1 15:52 tftp_put </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
><SPAN
|
><SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>tftp_server_test</I
|
>tftp_server_test</I
|
></SPAN
|
></SPAN
|
> - runs a tftp server for a short while</PRE
|
> - runs a tftp server for a short while</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This test is truly interactive, in that you can use a standard
|
>This test is truly interactive, in that you can use a standard
|
tftp application to get and put files from the server, during the
|
tftp application to get and put files from the server, during the
|
5 minutes that it runs. The dummy filesystem which underlies the
|
5 minutes that it runs. The dummy filesystem which underlies the
|
server initially contains one file, called “uu” which contains
|
server initially contains one file, called “uu” which contains
|
part of a familiar text and some padding. It also accommodates
|
part of a familiar text and some padding. It also accommodates
|
creation of 3 further files of up to 1Mb in size and names of up
|
creation of 3 further files of up to 1Mb in size and names of up
|
to 256 bytes. Exceeding these limits will cause a buffer overflow
|
to 256 bytes. Exceeding these limits will cause a buffer overflow
|
and unpredictable failure.</P
|
and unpredictable failure.</P
|
><P
|
><P
|
>The dummy filesystem is an implementation of the generic API
|
>The dummy filesystem is an implementation of the generic API
|
which allows a true filesystem to be attached to the tftp server
|
which allows a true filesystem to be attached to the tftp server
|
in the network stack.</P
|
in the network stack.</P
|
><P
|
><P
|
>We have been testing the tftp server by running the test on
|
>We have been testing the tftp server by running the test on
|
the target board, then using two different host computers connecting
|
the target board, then using two different host computers connecting
|
to the different target interfaces, putting a file from each, getting
|
to the different target interfaces, putting a file from each, getting
|
the “uu” file, and getting the file from the other computer.
|
the “uu” file, and getting the file from the other computer.
|
This verifies that data is preserved during the transfer as well
|
This verifies that data is preserved during the transfer as well
|
as interworking with standard tftp applications.</P
|
as interworking with standard tftp applications.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-common-performance-test.html"
|
HREF="net-common-performance-test.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-common-maintenance-tools.html"
|
HREF="net-common-maintenance-tools.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>Performance Test</TD
|
>Performance Test</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-common-tests-and-demonstrations.html"
|
HREF="net-common-tests-and-demonstrations.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Maintenance Tools</TD
|
>Maintenance Tools</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|