Skip to content

Commit

Permalink
Merge formatting commit '894f9524' into cgroupsv2 and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippWendler committed Feb 27, 2023
2 parents b0f5eb2 + 894f952 commit efc4f19
Show file tree
Hide file tree
Showing 32 changed files with 8 additions and 51 deletions.
2 changes: 1 addition & 1 deletion benchexec/cgroupsv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def read_io_pressure(self):

def read_usage_per_cpu(self):
usage = {}
for (core, coretime) in enumerate(
for core, coretime in enumerate(
self.get_value(self.CPU, "usage_percpu").split(" ")
):
try:
Expand Down
1 change: 0 additions & 1 deletion benchexec/check_cgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def check_cgroup_availability_in_thread(options):


class _CheckCgroupsThread(threading.Thread):

error = None

def __init__(self, options):
Expand Down
2 changes: 0 additions & 2 deletions benchexec/localexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def get_system_info():


def execute_benchmark(benchmark, output_handler):

run_sets_executed = 0

logging.debug("I will use %s threads.", benchmark.num_of_threads)
Expand Down Expand Up @@ -139,7 +138,6 @@ def execute_benchmark(benchmark, output_handler):

# iterate over run sets
for runSet in benchmark.run_sets:

if STOPPED_BY_INTERRUPT:
break

Expand Down
5 changes: 1 addition & 4 deletions benchexec/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def handle_limit_value(name, from_key, to_key, cmdline_value, parse_fn):

# get benchmarks
self.run_sets = []
for (i, rundefinitionTag) in enumerate(rootTag.findall("rundefinition")):
for i, rundefinitionTag in enumerate(rootTag.findall("rundefinition")):
self.run_sets.append(
RunSet(rundefinitionTag, self, i + 1, globalSourcefilesTags)
)
Expand Down Expand Up @@ -690,7 +690,6 @@ def _read_set_file(filename):

# get sourcefiles from list in file
for includesFilesFile in sourcefilesTag.findall("includesfile"):

for file in self.expand_filename_pattern(includesFilesFile.text, base_dir):
input_files_in_set = list(_read_set_file(file))
if not input_files_in_set:
Expand Down Expand Up @@ -1200,13 +1199,11 @@ class Requirements(object):
"""

def __init__(self, tags, rlimits, config):

self.cpu_model = None
self.memory = None
self.cpu_cores = None

for requireTag in tags:

cpu_model = requireTag.get("cpuModel", None)
if cpu_model:
if self.cpu_model is None:
Expand Down
2 changes: 0 additions & 2 deletions benchexec/outputhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def set_error(self, msg, runSet=None):
runSet.xml.set("error", msg or "unknown error")

def store_header_in_xml(self, version, memlimit, timelimit, corelimit):

# store benchmarkInfo in XML
self.xml_header = ElementTree.Element(
"result",
Expand Down Expand Up @@ -506,7 +505,6 @@ def output_after_run(self, run):
# format numbers, number_of_digits is optional, so it can be None
for column in run.columns:
if column.number_of_digits is not None:

# if the number ends with "s" or another letter, remove it
if (not column.value.isdigit()) and column.value[-2:-1].isdigit():
column.value = column.value[:-1]
Expand Down
3 changes: 2 additions & 1 deletion benchexec/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ def get_memory_banks_per_run(coreAssignment, cgroups):
def _get_memory_banks_listed_in_dir(path):
"""Get all memory banks the kernel lists in a given directory.
Such a directory can be /sys/devices/system/node/ (contains all memory banks)
or /sys/devices/system/cpu/cpu*/ (contains all memory banks on the same NUMA node as that core)."""
or /sys/devices/system/cpu/cpu*/ (contains all memory banks on the same NUMA node as that core).
"""
# Such directories contain entries named "node<id>" for each memory bank
return [int(entry[4:]) for entry in os.listdir(path) if entry.startswith("node")]

Expand Down
5 changes: 2 additions & 3 deletions benchexec/runexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def print_optional_result(key, unit=""):


class RunExecutor(containerexecutor.ContainerExecutor):

# --- object initialization ---

def __init__(
Expand Down Expand Up @@ -442,7 +441,7 @@ def _setup_cgroups(self, my_cpus, memlimit, memory_nodes, cgroup_values):
logging.debug("Created cgroups %s.", cgroups)

# First, set user-specified values such that they get overridden by our settings if necessary.
for ((subsystem, option), value) in cgroup_values.items():
for (subsystem, option), value in cgroup_values.items():
try:
cgroups.set_value(subsystem, option, value)
except OSError as e:
Expand Down Expand Up @@ -727,7 +726,7 @@ def execute_run(

self.cgroups.handle_errors(critical_cgroups)

for ((subsystem, option), _) in cgroupValues.items():
for (subsystem, option), _ in cgroupValues.items():
if subsystem not in self._cgroup_subsystems:
sys.exit(
f'Cannot set option "{option}" for subsystem "{subsystem}" '
Expand Down
3 changes: 0 additions & 3 deletions benchexec/tablegenerator/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def __init__(
relevant_for_diff=None,
display_title=None,
):

# If scaling on the variables is performed, a display unit must be defined, explicitly
if scale_factor is not None and scale_factor != 1 and unit is None:
raise util.TableDefinitionError(
Expand Down Expand Up @@ -458,7 +457,6 @@ def _get_column_type_heur(column, column_values):
explicit_scale_defined = True

for value in column_values:

if value is None or value == "":
continue

Expand Down Expand Up @@ -608,7 +606,6 @@ def _get_decimal_digits(decimal_number_match, number_of_significant_digits):
int(decimal_number_match.group(GROUP_INT_PART)) == 0
and int(decimal_number_match.group(GROUP_DEC_PART)[1:]) != 0
):

max_num_of_digits = len(decimal_number_match.group(GROUP_SIG_DEC_PART))
num_of_digits = min(num_of_digits, max_num_of_digits)
# number of needed decimal digits = number of zeroes after decimal point + significant digits
Expand Down
1 change: 0 additions & 1 deletion benchexec/tablegenerator/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def add_local_summary_statistics(run_set_result, run_set_stats):
and column.title in run_set_result.summary
and run_set_result.summary[column.title] != ""
):

try:
column_stats.local = StatValue(
util.to_decimal(run_set_result.summary[column.title])
Expand Down
1 change: 0 additions & 1 deletion benchexec/tablegenerator/test_integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def result_file(name):


class TableGeneratorIntegrationTests(unittest.TestCase):

# Tests compare the generated CSV files and ignore the HTML files
# because we assume the HTML files change more often on purpose.

Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = ["etv", "bin"]

def blast_exe(self):
Expand Down
2 changes: 0 additions & 2 deletions benchexec/tools/ceagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = ["sv-ceagle", "z3"]

def executable(self):
Expand All @@ -28,7 +27,6 @@ def cmdline(self, executable, options, tasks, propertyfile, rlimits):
return [executable] + options + spec + tasks

def determine_result(self, returncode, returnsignal, output, isTimeout):

stroutput = str(output)

if isTimeout:
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/civl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = ["civl", "lib", "provers"]

def executable(self):
Expand Down
4 changes: 0 additions & 4 deletions benchexec/tools/depthk.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Tool(benchexec.tools.template.BaseTool):
]

def executable(self):

return util.find_executable("depthk-wrapper.sh")

def working_directory(self, executable):
Expand All @@ -51,14 +50,12 @@ def name(self):
return "DepthK"

def cmdline(self, executable, options, tasks, propertyfile, rlimits):

assert len(tasks) == 1, "only one sourcefile supported"
assert propertyfile, "property file required"
sourcefile = tasks[0]
return [executable] + options + ["-c", propertyfile, sourcefile]

def determine_result(self, returncode, returnsignal, output, isTimeout):

if len(output) <= 0:
return result.RESULT_ERROR

Expand All @@ -85,7 +82,6 @@ def determine_result(self, returncode, returnsignal, output, isTimeout):
return status

def get_value_from_output(self, lines, identifier):

for line in lines:
if identifier == "k" and line.startswith("Bound k:"):
matchbound = re.search(r"Bound k:(.*)", line)
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/forester.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = ["include", "libfa.so", "sv_comp_run.py"]

def executable(self):
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/fusebmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def name(self):
return "FuSeBMC"

def cmdline(self, executable, options, task, rlimits):

if task.property_file:
options = options + ["-p", task.property_file]
else:
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/hiptnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = [
"fixcalc",
"hip",
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/lctd.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = [
"bin",
"include",
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/seahorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = ["bin", "include", "lib", "share"]

def executable(self):
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/skink.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = [
"bin",
"lib",
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/smack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class Tool(benchexec.tools.template.BaseTool2):

REQUIRED_PATHS = [
"bin",
"lib",
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/smtlib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Smtlib2Tool(benchexec.tools.template.BaseTool):
"""

def determine_result(self, returncode, returnsignal, output, isTimeout):

if returnsignal == 0 and returncode == 0:
status = None
for line in output:
Expand Down
2 changes: 1 addition & 1 deletion benchexec/tools/ultimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def executable(self, tool_locator):
exe = tool_locator.find_executable("Ultimate.py")
dir_name = os.path.dirname(exe)
logging.debug("Looking in %s for Ultimate and plugins/", dir_name)
for (_, dir_names, file_names) in os.walk(dir_name):
for _, dir_names, file_names in os.walk(dir_name):
if "Ultimate" in file_names and "plugins" in dir_names:
return exe
break
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/viap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(benchexec.tools.template.BaseTool):

REQUIRED_PATHS = [
"viap_tool.py",
"viap_svcomp.py",
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/wasp-c.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def name(self):
return "WASP-C"

def cmdline(self, executable, options, task, rlimits):

if task.property_file:
options = options + ["--property", task.property_file]
else:
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/yogar-cbmc-parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Tool(yogar_cbmc.Tool):

REQUIRED_PATHS = ["yogar-cbmc"]

def executable(self):
Expand Down
1 change: 0 additions & 1 deletion benchexec/tools/yogar-cbmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def cmdline(self, executable, options, tasks, propertyfile, rlimits):
return [executable] + options + tasks

def determine_result(self, returncode, returnsignal, output, isTimeout):

status = result.RESULT_UNKNOWN
stroutput = str(output)

Expand Down
2 changes: 1 addition & 1 deletion benchexec/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def substitute_vars(template, replacements):
@param replacements: a dict or a list of pairs of keys and values
"""
result = template
for (key, value) in replacements:
for key, value in replacements:
result = result.replace("${" + key + "}", value)
if "${" in result:
logging.warning("A variable was not replaced in '%s'.", result)
Expand Down
2 changes: 0 additions & 2 deletions contrib/aws/awsexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ def getBenchmarkData(benchmark):


def getToolData(benchmark):

working_dir = benchmark.working_directory()
if not os.path.isdir(working_dir):
raise BenchExecException(
Expand Down Expand Up @@ -445,7 +444,6 @@ def bytes_to_mb(mb):


def handleCloudResults(benchmark, output_handler, start_time, end_time):

output_dir = benchmark.log_folder
if not os.path.isdir(output_dir) or not os.listdir(output_dir):
# output_dir does not exist or is empty
Expand Down
1 change: 0 additions & 1 deletion contrib/p4/p4-test-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Tool(benchexec.tools.template.BaseTool2):

# Needed for benchexec to run, but irrelevant for p4 extension
def executable(self, tool):
return "/"
Expand Down
3 changes: 0 additions & 3 deletions contrib/p4/p4execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def execute_benchmark(self, benchmark, output_handler):

# Check for table output file
if os.path.exists(switch_command_output):

copyfile(switch_command_output, switch_command_output_new)
else:
logging.info("No tables was loaded for switch: %s, {switch.name}")
Expand Down Expand Up @@ -304,7 +303,6 @@ def execute_benchmark(self, benchmark, output_handler):
self.close()

def _execute_benchmark(self, run, command):

return self.ptf_tester.exec_run(command, tty=True)

def setup_network(self):
Expand Down Expand Up @@ -506,7 +504,6 @@ def get_system_info(self):
return systeminfo.SystemInfo()

def read_folder_paths(self, benchmark):

switch_folder = ""
ptf_folder = ""
network_config = ""
Expand Down
Loading

0 comments on commit efc4f19

Please sign in to comment.