Skip to content

Commit

Permalink
Update ns3 commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pagmatt committed Jan 27, 2023
1 parent 8a633b2 commit d0b7da3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sem/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def configure_and_build(self, show_progress=True, optimized=True,
and only perform compilation.
"""

build_program = "ns3" if os.path.exists(os.path.join(self.path, "ns3")) else "waf"
build_program = "./ns3" if os.path.exists(os.path.join(self.path, "ns3")) else "./waf"

# Only configure if necessary
if not skip_configuration:
Expand Down
28 changes: 14 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

def get_build_program(ns_3_dir):
if os.path.exists(os.path.join(ns_3_dir, "ns3")):
return "ns3"
return "./ns3"
else:
return "waf"
return "./waf"

@pytest.fixture(scope='function')
def ns_3(tmpdir):
Expand All @@ -39,15 +39,15 @@ def ns_3_compiled(tmpdir):
build_program = get_build_program(ns_3_tempdir)

# Relocate build by running the same command in the new directory
if subprocess.call(['python', build_program, 'configure', '--disable-gtk',
if subprocess.call(['python3', build_program, 'configure', '--disable-gtk',
'--build-profile=optimized',
'--out=build/optimized'],
cwd=ns_3_tempdir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
raise Exception("Configuration failed")

if subprocess.call(['python', build_program, 'build'],
if subprocess.call(['python3', build_program, 'build'],
cwd=ns_3_tempdir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
Expand All @@ -65,15 +65,15 @@ def ns_3_compiled_debug(tmpdir):
build_program = get_build_program(ns_3_tempdir)

# Relocate build by running the same command in the new directory
if subprocess.call(['python', build_program, 'configure', '--disable-gtk',
if subprocess.call(['python3', build_program, 'configure', '--disable-gtk',
'--build-profile=debug',
'--out=build'],
cwd=ns_3_tempdir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
raise Exception("Configuration failed")

if subprocess.call(['python', build_program, 'build'],
if subprocess.call(['python3', build_program, 'build'],
cwd=ns_3_tempdir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
Expand Down Expand Up @@ -111,14 +111,14 @@ def result(config):
@pytest.fixture(scope='function')
def parameter_combination_no_rngrun():
# We need to explicitly state we want an OrderedDict here in order to
# support Python < 3.6 - since Python 3.6, dicts are ordered by default
# support python3 < 3.6 - since python3 3.6, dicts are ordered by default
return collections.OrderedDict([('dict', '/usr/share/dict/web2'),
('time', False)])

@pytest.fixture(scope='function')
def parameter_combination():
# We need to explicitly state we want an OrderedDict here in order to
# support Python < 3.6 - since Python 3.6, dicts are ordered by default
# support python3 < 3.6 - since python3 3.6, dicts are ordered by default
return collections.OrderedDict([('dict', '/usr/share/dict/web2'),
('time', False),
('RngRun', '0')])
Expand Down Expand Up @@ -163,39 +163,39 @@ def get_and_compile_ns_3():

build_program = get_build_program(ns_3_test_compiled)

if subprocess.call(['python', build_program, 'configure', '--disable-gtk',
if subprocess.call(['python3', build_program, 'configure', '--disable-gtk',
'--build-profile=optimized',
'--out=build/optimized'],
cwd=ns_3_test_compiled,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT) != 0:
raise Exception("Optimized test configuration failed.")

if subprocess.call(['python', build_program, 'build'],
if subprocess.call(['python3', build_program, 'build'],
cwd=ns_3_test_compiled,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
raise Exception("Optimized test build failed.")

build_program = get_build_program(ns_3_test_compiled_debug)

if subprocess.call(['python', build_program, 'configure', '--disable-gtk',
if subprocess.call(['python3', build_program, 'configure', '--disable-gtk',
'--build-profile=debug',
'--out=build'],
cwd=ns_3_test_compiled_debug,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT) != 0:
raise Exception("Debug test configuration failed.")

if subprocess.call(['python', build_program, 'build'],
if subprocess.call(['python3', build_program, 'build'],
cwd=ns_3_test_compiled,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
raise Exception("Debug test build failed.")

build_program = get_build_program(ns_3_examples)

if subprocess.call(['python', build_program, 'configure', '--disable-gtk',
if subprocess.call(['python3', build_program, 'configure', '--disable-gtk',
'--build-profile=optimized',
'--out=build/optimized'],
cwd=ns_3_examples,
Expand All @@ -204,7 +204,7 @@ def get_and_compile_ns_3():

raise Exception("Examples configuration failed.")

if subprocess.call(['python', build_program, 'build'],
if subprocess.call(['python3', build_program, 'build'],
cwd=ns_3_test_compiled,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) > 0:
Expand Down

0 comments on commit d0b7da3

Please sign in to comment.