Apply Sam's nsc regression patch
authorCraig Dowell <craigdo@ee.washington.edu>
Wed, 17 Sep 2008 20:04:26 -0700
changeset 3703 71d93292bc49
parent 3702 db14e253e614
child 3704 68218c266a84
Apply Sam's nsc regression patch
regression/tests/test-tcp-nsc-lfn.py
src/internet-stack/wscript
wscript
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/regression/tests/test-tcp-nsc-lfn.py	Wed Sep 17 20:04:26 2008 -0700
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+
+"""Trace-comparison-type regression test for the Network Simulation Cradle."""
+
+import os
+import shutil
+import sys
+import tracediff
+import platform
+
+
+def run(verbose, generate, refDirName):
+    """Run a Network Simulation Cradle test involving two TCP streams."""
+
+    if not tracediff.env['ENABLE_NSC']:
+        print >>sys.stderr, "Skipping tcp-nsc-lfn: NSC not available."
+        raise NotImplementedError
+
+    testName = "tcp-nsc-lfn"
+    arguments = ["--ns3::OnOffApplication::DataRate=40000", "--runtime=20"]
+    platform_bits = platform.architecture()[0]
+    
+    if platform_bits == "64bit":
+        traceDirName = testName + "_64bit.ref"
+    elif platform_bits == "32bit":
+        traceDirName = testName + "_32bit.ref"
+    else:
+        # Something unexpected. How should we signal an error here? Rasing a
+        # string might not be the best idea?
+        raise "Unknown architecture, not 64 or 32 bit?"
+
+    return tracediff.run_test(verbose, generate, refDirName,
+        testName, arguments=arguments, refTestName=traceDirName)
--- a/src/internet-stack/wscript	Wed Sep 17 15:47:07 2008 +0100
+++ b/src/internet-stack/wscript	Wed Sep 17 20:04:26 2008 -0700
@@ -54,6 +54,8 @@
         nsc_update()
 
 def configure(conf):
+    conf.env['ENABLE_NSC'] = False
+
     # checks for flex and bison, which is needed to build NSCs globaliser
     def check_nsc_buildutils():
         import flex
@@ -82,6 +84,7 @@
         e.define = 'HAVE_DL'
         e.uselib = 'DL'
         e.run()
+        conf.env['ENABLE_NSC'] = True
         ok = True
     conf.check_message('NSC supported architecture', arch, ok)
     conf.report_optional_feature("nsc", "Network Simulation Cradle", ok,
--- a/wscript	Wed Sep 17 15:47:07 2008 +0100
+++ b/wscript	Wed Sep 17 20:04:26 2008 -0700
@@ -820,7 +820,7 @@
         self.testdir = testdir
         self.env = Params.g_build.env_of_name('default')
 
-    def run_test(self, verbose, generate, refDirName, testName, arguments=[], pyscript=None):
+    def run_test(self, verbose, generate, refDirName, testName, arguments=[], pyscript=None, refTestName=None):
         """
         @param verbose: enable verbose execution
 
@@ -836,11 +836,17 @@
         parameter contains the path to the python script, relative to
         the project root dir
 
+        @param refTestName: if not None, this is the name of the directory under refDirName
+        that contains the reference traces. Otherwise "refDirname/testName + .ref" is used.
+
         """
         if not isinstance(arguments, list):
             raise TypeError
         
-        refTestDirName = os.path.join(refDirName, (testName + ".ref"))
+        if refTestName is None:
+            refTestDirName = os.path.join(refDirName, (testName + ".ref"))
+        else:
+            refTestDirName = os.path.join(refDirName, refTestName)
 
         if not os.path.exists(refDirName):
             print"No reference trace repository"