⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node280.html

📁 相关搜索: ns2仿真结果分析 all-awk ns2 ns2 无限网络中awk文件 ... [2.tcl.rar] - 在ns2平台上实现对AODV协议的模拟
💻 HTML
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by:  Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by:  Nikos Drakos, CBLU, University of Leeds* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from:  Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>24.2 Write a Test Suite</TITLE><META NAME="description" CONTENT="24.2 Write a Test Suite"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="previous" HREF="node279.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node279.html"><LINK REL="up" HREF="node278.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node278.html"><LINK REL="next" HREF="node281.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node281.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html5582"  HREF="node281.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node281.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5576"  HREF="node278.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node278.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5572"  HREF="node279.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node279.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5578"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html5580"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html5583"  HREF="node281.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node281.html">25. ns Code Styles</A><B> Up:</B> <A NAME="tex2html5577"  HREF="node278.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node278.html">24. Test Suite Support</A><B> Previous:</B> <A NAME="tex2html5573"  HREF="node279.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node279.html">24.1 Test Suite Components</A> &nbsp <B>  <A NAME="tex2html5579"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html5581"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION04420000000000000000"></A><A NAME="sec:writeatestsuite"></A><BR>24.2 Write a Test Suite</H1><P>You can take one of the test suites under tcl/test as a template whenyou are writing your own, for example the test suite written for wireless lan(test-all-wireless-lan, test-suite-wireless-lan.tcl, and test-output-wireless-lan). <P>To write a test suite, you first need to write the shell script (test-all-xxx).In the shell script, you specify the module to be tested, the name of the ns tcl script and the output subdirectory. You can run this shell script in quiet mode. Below is the example (test-all-wireless-lan):<P><PRE>   \# To run in quiet mode:  "./test-all-wireless-lan quiet".   f="wireless-lan"		\# Specify the name of the module to test.   file="test-suite-\$f.tcl"	\# The name of the ns script.   directory="test-output-\$f" 	\# Subdirectory to hold the test results   version="v2"			\# Speficy the ns version.      \# Pass the arguments to test-all-template1, which will run through   \# all the test cases defined in test-suite-wireless-lan.tcl.   ./test-all-template1 \$file \$directory \$version \$@</PRE><P>You also need to create several test cases in the ns script (test-suite-xxx.tcl)by defining a subclass of TestSuite for each different test. For example, in test-suite-wireless-lan.tcl, each test case uses a different Ad Hoc routing protocol. They are defined as:<P><PRE>	   Class TestSuite   \# wireless model using destination sequence distance vector   Class Test/dsdv -superclass TestSuite   \# wireless model using dynamic source routing   Class Test/dsr -superclass TestSuite   ... ...</PRE><P>Each test case is basically a simulation scenario. In the super class TestSuite, you can define some functions, like init and finish to do the work required by each test case, for example setting up the network topology and nstrace. The test specific configurations are defined within the corresponding sub-class. Each sub-class also has a run function to start the simulation.<P><PRE>	   TestSuite instproc init {} {     global opt tracefd topo chan prop      global node\_ god\_      \\$self instvar ns\_ testName\_     set ns\_         [new Simulator]      ... ...   }    TestSuite instproc finish {} {     \\$self instvar ns\_     global quiet     \\$ns\_ flush-trace     puts "finishing.."     exit 0   }           Test/dsdv instproc init {} {     global opt node\_ god\_     \\$self instvar ns\_ testName\_     set testName\_       dsdv     ... ...         \\$self next     ... ...     \\$ns\_ at \$opt(stop).1 "\$self finish"   }   Test/dsdv instproc run {} {     \\$self instvar ns\_     puts "Starting Simulation..."     \\$ns\_ run   }</PRE><P>All the tests are started by the function runtest in the ns script.<P><PRE>   proc runtest {arg} {     global quiet     set quiet 0     set b [llength \$arg]     if {\$b == 1} {        set test \$arg     } elseif {\$b == 2} {        set test [lindex \$arg 0]        if {[lindex \$arg 1] == "QUIET"} {         set quiet 1        }      } else {         usage     }     set t [new Test/\$test]     \$t run}global argv arg0runtest \$argv</PRE><P>When you run the tests, trace files are generated and saved to the output subdirectory. These trace files are compared to the those correct trace coming with the test suite. If the comparation shows difference, the test is failed. <P><HR><!--Navigation Panel--><A NAME="tex2html5582"  HREF="node281.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node281.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5576"  HREF="node278.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node278.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5572"  HREF="node279.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node279.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5578"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html5580"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html5583"  HREF="node281.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node281.html">25. ns Code Styles</A><B> Up:</B> <A NAME="tex2html5577"  HREF="node278.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node278.html">24. Test Suite Support</A><B> Previous:</B> <A NAME="tex2html5573"  HREF="node279.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node279.html">24.1 Test Suite Components</A> &nbsp <B>  <A NAME="tex2html5579"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html5581"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -