|
31 |
return ns3_dir |
31 |
return ns3_dir |
32 |
|
32 |
|
33 |
|
33 |
|
34 |
def get_regression_traces(ns3_dir, regression_branch): |
|
|
35 |
print """ |
36 |
# |
37 |
# Get the regression traces |
38 |
# |
39 |
""" |
40 |
# ns3_dir is the directory into which we cloned the repo |
41 |
# regression_branch is the repo in which we will find the traces. Variations like this should work: |
42 |
# ns-3-dev-ref-traces |
43 |
# craigdo/ns-3-dev-ref-traces |
44 |
# craigdo/ns-3-tap-ref-traces |
45 |
regression_traces_dir = os.path.split(regression_branch)[-1] |
46 |
regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch |
47 |
|
48 |
print "Synchronizing reference traces using Mercurial." |
49 |
try: |
50 |
if not os.path.exists(regression_traces_dir): |
51 |
run_command(["hg", "clone", regression_branch_url, regression_traces_dir]) |
52 |
else: |
53 |
run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url]) |
54 |
run_command(["hg", "-q", "update", "--cwd", regression_traces_dir]) |
55 |
except OSError: # this exception normally means mercurial is not found |
56 |
if not os.path.exists(regression_traces_dir_name): |
57 |
traceball = regression_tbranch + constants.TRACEBALL_SUFFIX |
58 |
print "Retrieving " + traceball + " from web." |
59 |
urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball) |
60 |
run_command(["tar", "-xjf", traceball]) |
61 |
print "Done." |
62 |
|
63 |
return regression_traces_dir |
64 |
|
65 |
|
66 |
def get_pybindgen(ns3_dir): |
34 |
def get_pybindgen(ns3_dir): |
67 |
print """ |
35 |
print """ |
68 |
# |
36 |
# |
|
184 |
parser = OptionParser() |
152 |
parser = OptionParser() |
185 |
parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev", |
153 |
parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev", |
186 |
help="Name of the ns-3 repository", metavar="BRANCH_NAME") |
154 |
help="Name of the ns-3 repository", metavar="BRANCH_NAME") |
187 |
parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces", |
|
|
188 |
help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME") |
189 |
(options, dummy_args) = parser.parse_args() |
155 |
(options, dummy_args) = parser.parse_args() |
190 |
|
156 |
|
191 |
# first of all, change to the directory of the script |
157 |
# first of all, change to the directory of the script |
|
202 |
ns3_config.setAttribute("dir", ns3_dir) |
168 |
ns3_config.setAttribute("dir", ns3_dir) |
203 |
ns3_config.setAttribute("branch", options.ns3_branch) |
169 |
ns3_config.setAttribute("branch", options.ns3_branch) |
204 |
|
170 |
|
205 |
# -- download regression reference traces for NS-3 -- |
|
|
206 |
try: |
207 |
traces_dir = get_regression_traces(ns3_dir, options.regression_branch) |
208 |
except CommandError: |
209 |
print " *** Did not fetch regression reference traces; regression testing will not be available." |
210 |
else: |
211 |
traces_config = config.documentElement.appendChild(config.createElement("ns-3-traces")) |
212 |
traces_config.setAttribute("dir", traces_dir) |
213 |
traces_config.setAttribute("branch", options.regression_branch) |
214 |
|
215 |
# -- download pybindgen -- |
171 |
# -- download pybindgen -- |
216 |
try: |
172 |
try: |
217 |
pybindgen_dir, pybindgen_version = get_pybindgen(ns3_dir) |
173 |
pybindgen_dir, pybindgen_version = get_pybindgen(ns3_dir) |