fixes for regression numbering
authorCraig Dowell <craigdo@ee.washington.edu>
Wed, 18 Jun 2008 10:29:19 -0700
changeset 3284510fed881852
parent 3282 5e57c2f1cfb7
child 3285 17a6700153c6
fixes for regression numbering
VERSION
wscript
     1.1 --- a/VERSION	Wed Jun 18 15:21:08 2008 +0100
     1.2 +++ b/VERSION	Wed Jun 18 10:29:19 2008 -0700
     1.3 @@ -1,1 +1,1 @@
     1.4 -3.1-RC1
     1.5 +3-dev
     2.1 --- a/wscript	Wed Jun 18 15:21:08 2008 +0100
     2.2 +++ b/wscript	Wed Jun 18 10:29:19 2008 -0700
     2.3 @@ -2,6 +2,7 @@
     2.4  import sys
     2.5  import shlex
     2.6  import shutil
     2.7 +import urllib
     2.8  import types
     2.9  import optparse
    2.10  import os.path
    2.11 @@ -14,7 +15,6 @@
    2.12  
    2.13  Params.g_autoconfig = 1
    2.14  
    2.15 -
    2.16  # the following two variables are used by the target "waf dist"
    2.17  VERSION = file("VERSION").read().strip()
    2.18  APPNAME = 'ns'
    2.19 @@ -30,13 +30,6 @@
    2.20  REGRESSION_TRACES_URL = "http://www.nsnam.org/releases/"
    2.21  
    2.22  #
    2.23 -# The name of the tarball to find the reference traces in if there is no
    2.24 -# mercurial on the system.  It is expected to be created using tar -cjf and
    2.25 -# will be extracted using tar -xjf
    2.26 -#
    2.27 -REGRESSION_TRACES_TAR_NAME  = "ns-3.1-RC1-ref-traces.tar.bz2"
    2.28 -
    2.29 -#
    2.30  # The path to the Mercurial repository used to find the reference traces if
    2.31  # we find "hg" on the system.  We expect that the repository will be named
    2.32  # identically to refDirName below
    2.33 @@ -44,10 +37,23 @@
    2.34  REGRESSION_TRACES_REPO = "http://code.nsnam.org/"
    2.35  
    2.36  #
    2.37 -# The local directory name (relative to the 'regression' dir) into
    2.38 -# which the reference traces will go in either case (net or hg).
    2.39 +# Name of the local directory where the regression code lives.
    2.40  #
    2.41 -REGRESSION_TRACES_DIR_NAME = "ns-3-dev-ref-traces"
    2.42 +REGRESSION_DIR = "regression"
    2.43 +
    2.44 +#
    2.45 +# The last part of the path name to use to find the regression traces.  The
    2.46 +# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX, e.g.,
    2.47 +# ns-3-dev-ref-traces
    2.48 +#
    2.49 +REGRESSION_SUFFIX = "-ref-traces"
    2.50 +
    2.51 +#
    2.52 +# The last part of the path name to use to find the regression traces tarball.
    2.53 +# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX,
    2.54 +# e.g., ns-3-dev-ref-traces.tar.bz2
    2.55 +#
    2.56 +TRACEBALL_SUFFIX = ".tar.bz2"
    2.57  
    2.58  
    2.59  def dist_hook():
    2.60 @@ -55,13 +61,17 @@
    2.61      shutil.rmtree("doc/html", True)
    2.62      shutil.rmtree("doc/latex", True)
    2.63  
    2.64 +    ## build the name of the traces subdirectory.  Will be something like
    2.65 +    ## ns-3-dev-ref-traces
    2.66 +    traces_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX
    2.67      ## Create a tar.bz2 file with the traces
    2.68 -    traces_dir = os.path.join("regression", "ns-3-dev-ref-traces")
    2.69 +    traces_dir = os.path.join(REGRESSION_DIR, traces_name)
    2.70      if not os.path.isdir(traces_dir):
    2.71          Params.warning("Not creating traces archive: the %s directory does not exist" % traces_dir)
    2.72      else:
    2.73 -        tar = tarfile.open(os.path.join("..", "ns-%s-ref-traces.tar.bz2" % VERSION), 'w:bz2')
    2.74 -        tar.add(traces_dir, "ns-3-dev-ref-traces")
    2.75 +        traceball = traces_name + TRACEBALL_SUFFIX
    2.76 +        tar = tarfile.open(os.path.join("..", traceball), 'w:bz2')
    2.77 +        tar.add(traces_dir)
    2.78          tar.close()
    2.79          ## Now remove it; we do not ship the traces with the main tarball...
    2.80          shutil.rmtree(traces_dir, True)
    2.81 @@ -790,28 +800,32 @@
    2.82          tests = _find_tests(testdir)
    2.83  
    2.84      print "========== Running Regression Tests =========="
    2.85 +    dir_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX
    2.86 +    print "dir_name = " + dir_name
    2.87  
    2.88 -    if os.system("hg version > /dev/null 2>&1") == 0:
    2.89 +    if os.system("hg version > /dev/null 2>&1") == 1:
    2.90          print "Synchronizing reference traces using Mercurial."
    2.91 -        if not os.path.exists(REGRESSION_TRACES_DIR_NAME):
    2.92 -            os.system("hg clone " + REGRESSION_TRACES_REPO + REGRESSION_TRACES_DIR_NAME + " > /dev/null 2>&1")
    2.93 +        if not os.path.exists(dir_name):
    2.94 +            os.system("hg clone " + REGRESSION_TRACES_REPO + dir_name + " > /dev/null 2>&1")
    2.95          else:
    2.96              _dir = os.getcwd()
    2.97 -            os.chdir(REGRESSION_TRACES_DIR_NAME)
    2.98 +            os.chdir(dir_name)
    2.99              try:
   2.100 -                result = os.system("hg -q pull %s && hg -q update" % (REGRESSION_TRACES_REPO + REGRESSION_TRACES_DIR_NAME))
   2.101 +                print "pull and update " + REGRESSION_TRACES_REPO + dir_name
   2.102 +                result = os.system("hg -q pull %s && hg -q update" % (REGRESSION_TRACES_REPO + dir_name))
   2.103              finally:
   2.104                  os.chdir("..")
   2.105              if result:
   2.106                  Params.fatal("Synchronizing reference traces using Mercurial failed.")
   2.107      else:
   2.108 -        print "Synchronizing reference traces from web."
   2.109 -        urllib.urlretrieve(REGRESSION_TRACES_URL + REGRESSION_TRACES_TAR_NAME, REGRESSION_TRACES_TAR_NAME)
   2.110 -        os.system("tar -xjf %s" % (REGRESSION_TRACES_TAR_NAME,))
   2.111 +        traceball = dir_name + TRACEBALL_SUFFIX
   2.112 +        print "Synchronizing " + traceball + " from web."
   2.113 +        urllib.urlretrieve(REGRESSION_TRACES_URL + traceball, traceball)
   2.114 +        os.system("tar -xjf %s" % (traceball,))
   2.115  
   2.116      print "Done."
   2.117  
   2.118 -    if not os.path.exists(REGRESSION_TRACES_DIR_NAME):
   2.119 +    if not os.path.exists(dir_name):
   2.120          print "Reference traces directory does not exist"
   2.121          return 3
   2.122      
   2.123 @@ -847,7 +861,9 @@
   2.124      else:
   2.125          os.mkdir("traces")
   2.126      
   2.127 +    dir_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX
   2.128 +
   2.129      mod = __import__(test, globals(), locals(), [])
   2.130      return mod.run(verbose=(Params.g_options.verbose > 0),
   2.131                     generate=Params.g_options.regression_generate,
   2.132 -                   refDirName=REGRESSION_TRACES_DIR_NAME)
   2.133 +                   refDirName=dir_name)