From 8ef87360ae128f4f24b217acee75a1cde3677a9a Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 17 Sep 2008 20:04:26 -0700 Subject: [PATCH] Apply Sam's nsc regression patch --- regression/tests/test-tcp-nsc-lfn.py | 33 ++++++++++++++++++++++++++++ src/internet-stack/wscript | 3 +++ wscript | 10 +++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 regression/tests/test-tcp-nsc-lfn.py diff --git a/regression/tests/test-tcp-nsc-lfn.py b/regression/tests/test-tcp-nsc-lfn.py new file mode 100644 index 000000000..84042603f --- /dev/null +++ b/regression/tests/test-tcp-nsc-lfn.py @@ -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) diff --git a/src/internet-stack/wscript b/src/internet-stack/wscript index 7843da9eb..077a35859 100644 --- a/src/internet-stack/wscript +++ b/src/internet-stack/wscript @@ -54,6 +54,8 @@ def nsc_fetch(): 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 @@ def configure(conf): 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, diff --git a/wscript b/wscript index cf2db428a..8eb8c50b5 100644 --- a/wscript +++ b/wscript @@ -820,7 +820,7 @@ class Regression(object): 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 @@ class Regression(object): 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"