From a4aeb6e815c4daa9e56da21a9fb4cf308aadc061 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 11 Sep 2008 11:44:39 +0100 Subject: [PATCH] Check for mercurial in configuration stage; also fixes OSError exception when mercurial was not available. --- wscript | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wscript b/wscript index 7a2a2c23f..80a900e47 100644 --- a/wscript +++ b/wscript @@ -272,9 +272,12 @@ def configure(conf): 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 @@ class Regression(object): 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 @@ class Regression(object): 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 @@ class Regression(object): 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 @@ def run_regression(): 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."