wscript
changeset 3677 33334b53632f
parent 3676 62e8f20e7e8d
child 3693 fc078b692b68
--- a/wscript	Thu Sep 11 11:35:42 2008 +0100
+++ b/wscript	Thu Sep 11 11:44:39 2008 +0100
@@ -272,9 +272,12 @@
         conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in
                                            Params.g_options.enable_modules.split(',')]
 
-    ## we cannot run regression tests without diff
+    # we cannot run regression tests without diff
     conf.find_program('diff', var='DIFF')
 
+    # we cannot pull regression traces without mercurial
+    conf.find_program('hg', var='MERCURIAL')
+
     # Write a summary of optional features status
     print "---- Summary of optional NS-3 features:"
     for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']:
@@ -816,7 +819,6 @@
     def __init__(self, testdir):
         self.testdir = testdir
         self.env = Params.g_build.env_of_name('default')
-        self.diff = self.env['DIFF']
 
     def run_test(self, verbose, generate, refDirName, testName, *arguments):
         refTestDirName = os.path.join(refDirName, (testName + ".ref"))
@@ -853,7 +855,7 @@
 
             if verbose:
                 #diffCmd = "diff traces " + refTestDirName + " | head"
-                diffCmd = subprocess.Popen([self.diff, "traces", refTestDirName],
+                diffCmd = subprocess.Popen([self.env['DIFF'], "traces", refTestDirName],
                                            stdout=dev_null())
                 headCmd = subprocess.Popen("head", stdin=diffCmd.stdout)
                 rc2 = headCmd.wait()
@@ -861,7 +863,7 @@
                 rc1 = diffCmd.wait()
                 rc = rc1 or rc2
             else:
-                rc = subprocess.Popen([self.diff, "traces", refTestDirName], stdout=dev_null()).wait()
+                rc = subprocess.Popen([self.env['DIFF'], "traces", refTestDirName], stdout=dev_null()).wait()
             if rc:
                 print "----------"
                 print "Traces differ in test: test-" + testName
@@ -907,8 +909,8 @@
 
     print "========== Running Regression Tests =========="
     dir_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX
-
-    if subprocess.Popen(["hg", "version"], stdout=dev_null(), stderr=dev_null()).wait() == 0:
+    env = Params.g_build.env_of_name('default')
+    if env['MERCURIAL']:
         print "Synchronizing reference traces using Mercurial."
         if not os.path.exists(dir_name):
             print "Cloning " + REGRESSION_TRACES_REPO + dir_name + " from repo."