Bug 1415 - examples-to-run.py doesn't work with command line arguments
parent
550efc3e59
commit
6b18ff36d7
44
test.py
44
test.py
|
@ -138,15 +138,31 @@ def parse_examples_to_run_file(
|
|||
#
|
||||
cpp_examples = get_list_from_file(examples_to_run_path, "cpp_examples")
|
||||
for example_name, do_run, do_valgrind_run in cpp_examples:
|
||||
# Seperate the example name from its arguments.
|
||||
example_name_parts = example_name.split(' ', 1)
|
||||
if len(example_name_parts) == 1:
|
||||
example_name = example_name_parts[0]
|
||||
example_arguments = ""
|
||||
else:
|
||||
example_name = example_name_parts[0]
|
||||
example_arguments = example_name_parts[1]
|
||||
|
||||
# Add the proper prefix and suffix to the example name to
|
||||
# match what is done in the wscript file.
|
||||
example_name = "%s%s-%s-%s" % (APPNAME, VERSION, example_name, BUILD_PROFILE)
|
||||
|
||||
# Set the full path for the example.
|
||||
example_path = os.path.join(cpp_executable_dir, example_name)
|
||||
# Add all of the C++ examples that were built, i.e. found
|
||||
# in the directory, to the list of C++ examples to run.
|
||||
if os.path.exists(example_path):
|
||||
example_tests.append((example_path, do_run, do_valgrind_run))
|
||||
# Add any arguments to the path.
|
||||
if len(example_name_parts) != 1:
|
||||
example_path = "%s %s" % (example_path, example_arguments)
|
||||
|
||||
# Add this example.
|
||||
example_tests.append((example_path, do_run, do_valgrind_run))
|
||||
|
||||
# Each tuple in the Python list of examples to run contains
|
||||
#
|
||||
# (example_name, do_run)
|
||||
|
@ -161,10 +177,26 @@ def parse_examples_to_run_file(
|
|||
#
|
||||
python_examples = get_list_from_file(examples_to_run_path, "python_examples")
|
||||
for example_name, do_run in python_examples:
|
||||
# Seperate the example name from its arguments.
|
||||
example_name_parts = example_name.split(' ', 1)
|
||||
if len(example_name_parts) == 1:
|
||||
example_name = example_name_parts[0]
|
||||
example_arguments = ""
|
||||
else:
|
||||
example_name = example_name_parts[0]
|
||||
example_arguments = example_name_parts[1]
|
||||
|
||||
# Set the full path for the example.
|
||||
example_path = os.path.join(python_script_dir, example_name)
|
||||
|
||||
# Add all of the Python examples that were found to the
|
||||
# list of Python examples to run.
|
||||
if os.path.exists(example_path):
|
||||
# Add any arguments to the path.
|
||||
if len(example_name_parts) != 1:
|
||||
example_path = "%s %s" % (example_path, example_arguments)
|
||||
|
||||
# Add this example.
|
||||
python_tests.append((example_path, do_run))
|
||||
|
||||
#
|
||||
|
@ -1307,9 +1339,12 @@ def run_tests():
|
|||
if len(options.constrain) == 0 or options.constrain == "example":
|
||||
if ENABLE_EXAMPLES:
|
||||
for test, do_run, do_valgrind_run in example_tests:
|
||||
# Remove any arguments and directory names from test.
|
||||
test_name = test.split(' ', 1)[0]
|
||||
test_name = os.path.basename(test_name)
|
||||
|
||||
# Don't try to run this example if it isn't runnable.
|
||||
if os.path.basename(test) in ns3_runnable_programs:
|
||||
if test_name in ns3_runnable_programs:
|
||||
if eval(do_run):
|
||||
job = Job()
|
||||
job.set_is_example(True)
|
||||
|
@ -1389,9 +1424,12 @@ def run_tests():
|
|||
if len(options.constrain) == 0 or options.constrain == "pyexample":
|
||||
if ENABLE_EXAMPLES:
|
||||
for test, do_run in python_tests:
|
||||
# Remove any arguments and directory names from test.
|
||||
test_name = test.split(' ', 1)[0]
|
||||
test_name = os.path.basename(test_name)
|
||||
|
||||
# Don't try to run this example if it isn't runnable.
|
||||
if os.path.basename(test) in ns3_runnable_scripts:
|
||||
if test_name in ns3_runnable_scripts:
|
||||
if eval(do_run):
|
||||
job = Job()
|
||||
job.set_is_example(False)
|
||||
|
|
Loading…
Reference in New Issue