|
Lines 28-63
def get_ns3(ns3_branch):
|
Link Here
|
|---|
|
| 28 |
run_command(['hg', '--cwd', ns3_dir, 'pull', '-u']) |
28 |
run_command(['hg', '--cwd', ns3_dir, 'pull', '-u']) |
| 29 |
|
29 |
|
| 30 |
# For future reference (e.g. build.py script), the downloaded ns3 version becomes our version |
30 |
# For future reference (e.g. build.py script), the downloaded ns3 version becomes our version |
| 31 |
f = file("BRANCH", "wt") |
31 |
f = file("NS3-BRANCH", "wt") |
| 32 |
f.write("%s\n" % ns3_branch) |
32 |
f.write("%s\n" % ns3_branch) |
| 33 |
f.close() |
33 |
f.close() |
| 34 |
return ns3_dir |
34 |
return ns3_dir |
| 35 |
|
35 |
|
| 36 |
|
36 |
|
| 37 |
def get_regression_traces(ns3_dir): |
37 |
def get_regression_traces(ns3_dir, regression_branch): |
| 38 |
print """ |
38 |
print """ |
| 39 |
# |
39 |
# |
| 40 |
# Get the regression traces |
40 |
# Get the regression traces |
| 41 |
# |
41 |
# |
| 42 |
""" |
42 |
""" |
| 43 |
regression_traces_dir_name = ns3_dir + constants.REGRESSION_SUFFIX |
43 |
# ns3_dir is the directory into which we cloned the repo |
|
|
44 |
# regression_branch is the repo in which we will find the traces. Variations like this should work: |
| 45 |
# ns-3-dev-ref-traces |
| 46 |
# craigdo/ns-3-dev-ref-traces |
| 47 |
# craigdo/ns-3-tap-ref-traces |
| 48 |
regression_traces_dir = os.path.split(regression_branch)[-1] |
| 49 |
regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch |
| 50 |
|
| 44 |
print "Synchronizing reference traces using Mercurial." |
51 |
print "Synchronizing reference traces using Mercurial." |
| 45 |
try: |
52 |
try: |
| 46 |
if not os.path.exists(regression_traces_dir_name): |
53 |
if not os.path.exists(regression_traces_dir): |
| 47 |
run_command(["hg", "clone", constants.REGRESSION_TRACES_REPO + regression_traces_dir_name, regression_traces_dir_name]) |
54 |
run_command(["hg", "clone", regression_branch_url, regression_traces_dir]) |
| 48 |
else: |
55 |
else: |
| 49 |
run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir_name, |
56 |
run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url]) |
| 50 |
constants.REGRESSION_TRACES_REPO + regression_traces_dir_name]) |
57 |
run_command(["hg", "-q", "update", "--cwd", regression_traces_dir]) |
| 51 |
run_command(["hg", "-q", "update", "--cwd", regression_traces_dir_name]) |
|
|
| 52 |
except OSError: # this exception normally means mercurial is not found |
58 |
except OSError: # this exception normally means mercurial is not found |
| 53 |
if not os.path.exists(regression_traces_dir_name): |
59 |
if not os.path.exists(regression_traces_dir_name): |
| 54 |
traceball = regression_traces_dir_name + constants.TRACEBALL_SUFFIX |
60 |
traceball = regression_tbranch + constants.TRACEBALL_SUFFIX |
| 55 |
print "Retrieving " + traceball + " from web." |
61 |
print "Retrieving " + traceball + " from web." |
| 56 |
urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball) |
62 |
urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball) |
| 57 |
run_command(["tar", "-xjf", traceball]) |
63 |
run_command(["tar", "-xjf", traceball]) |
| 58 |
print "Done." |
64 |
print "Done." |
| 59 |
|
65 |
|
| 60 |
|
66 |
f = file("REPO-BRANCH", "wt") |
|
|
67 |
f.write("%s\n" % regression_branch) |
| 68 |
f.close() |
| 61 |
|
69 |
|
| 62 |
def get_pybindgen(ns3_dir): |
70 |
def get_pybindgen(ns3_dir): |
| 63 |
print """ |
71 |
print """ |
|
|
| 167 |
def main(): |
175 |
def main(): |
| 168 |
parser = OptionParser() |
176 |
parser = OptionParser() |
| 169 |
parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev", |
177 |
parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev", |
| 170 |
help="Name of the NS-3 version", metavar="BRANCH_NAME") |
178 |
help="Name of the ns-3 repository", metavar="BRANCH_NAME") |
|
|
179 |
parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces", |
| 180 |
help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME") |
| 171 |
(options, dummy_args) = parser.parse_args() |
181 |
(options, dummy_args) = parser.parse_args() |
| 172 |
|
182 |
|
| 173 |
# first of all, change to the directory of the script |
183 |
# first of all, change to the directory of the script |
|
|
| 176 |
ns3_dir = get_ns3(options.ns3_branch) |
186 |
ns3_dir = get_ns3(options.ns3_branch) |
| 177 |
|
187 |
|
| 178 |
try: |
188 |
try: |
| 179 |
get_regression_traces(ns3_dir) |
189 |
get_regression_traces(ns3_dir, options.regression_branch) |
| 180 |
except CommandError: |
190 |
except CommandError: |
| 181 |
print " *** Problem fetching regression reference traces; regression testing will not work." |
191 |
print " *** Problem fetching regression reference traces; regression testing will not work." |
| 182 |
|
192 |
|