Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def program_files(self, executable):
install_dir = os.path.dirname(executable)
paths = self.REQUIRED_PATHS_SVCOMP17 if self._is_svcomp17_version(executable) else self.REQUIRED_PATHS
return [executable] + util.flatten(util.expand_filename_pattern(path, install_dir) for path in paths)
def program_files(self, executable):
executableDir = os.path.join(os.path.dirname(executable), os.path.pardir)
return util.flatten(util.expand_filename_pattern(path, executableDir) for path in REQUIRED_PATHS)
def program_files(self, executable):
installDir = os.path.join(os.path.dirname(executable), os.path.pardir)
return util.flatten(util.expand_filename_pattern(path, installDir) for path in self.REQUIRED_PATHS)
# thus we handle it and the expected results here.
if not run.propertyfile:
return run
# TODO: support "property_name" attribute in yaml
prop = result.Property.create(run.propertyfile)
run.properties = [prop]
for prop_dict in task_def.get("properties", []):
if not isinstance(prop_dict, dict) or "property_file" not in prop_dict:
raise BenchExecException(
"Missing property file for property in task-definition file {}.".format(
task_def_file
)
)
expanded = util.expand_filename_pattern(
prop_dict["property_file"], os.path.dirname(task_def_file)
)
if len(expanded) != 1:
raise BenchExecException(
"Property pattern '{}' in task-definition file {} does not refer to exactly one file.".format(
prop_dict["property_file"], task_def_file
)
)
# TODO We could reduce I/O by checking absolute paths and using os.path.samestat
# with cached stat calls.
if prop.filename == expanded[0] or os.path.samefile(
prop.filename, expanded[0]
):
expected_result = prop_dict.get("expected_verdict")
if expected_result is not None and not isinstance(
def program_files(self, executable):
"""
OPTIONAL, this method is only necessary for situations when the benchmark environment
needs to know all files belonging to a tool
(to transport them to a cloud service, for example).
Returns a list of files or directories that are necessary to run the tool,
relative to the current directory.
@return a list of paths as strings
"""
installDir = os.path.dirname(executable)
return [executable] + util.flatten(util.expand_filename_pattern(path, installDir) for path in self.REQUIRED_PATHS)
def program_files(self, executable):
installDir = os.path.join(os.path.dirname(executable), os.path.pardir)
return util.flatten(util.expand_filename_pattern(path, installDir) for path in self.REQUIRED_PATHS)
self.properties = [] # filled externally
def log_property_file_once(msg):
if self.propertyfile not in _logged_missing_property_files:
_logged_missing_property_files.add(self.propertyfile)
logging.warning(msg)
# replace run-specific stuff in the propertyfile and add it to the set of required files
if self.propertyfile is None:
log_property_file_once(
"No propertyfile specified. Score computation will ignore the results."
)
else:
# we check two cases: direct filename or user-defined substitution, one of them must be a 'file'
# TODO: do we need the second case? it is equal to previous used option "-spec ${inputfile_path}/ALL.prp"
expandedPropertyFiles = util.expand_filename_pattern(
self.propertyfile, self.runSet.benchmark.base_dir
)
substitutedPropertyfiles = substitute_vars(
[self.propertyfile], runSet, self.identifier
)
assert len(substitutedPropertyfiles) == 1
if expandedPropertyFiles:
if len(expandedPropertyFiles) > 1:
log_property_file_once(
"Pattern {0} for input file {1} in propertyfile tag matches more than one file. Only {2} will be used.".format(
self.propertyfile, self.identifier, expandedPropertyFiles[0]
)
)
self.propertyfile = expandedPropertyFiles[0]
elif substitutedPropertyfiles and os.path.isfile(
Get a list of program files by expanding a list of path patterns
and interpreting it as relative to the executable.
This method can be used as helper for implementing the method program_files().
Contrary to the default implementation of program_files(), this method does not explicitly
add the executable to the list of returned files, it assumes that required_paths
contains a path that covers the executable.
@param executable: the path to the executable of the tool (typically the result of executable())
@param required_paths: a list of required path patterns
@param parent_dir: whether required_paths are relative to the directory of executable or the parent directory
@return a list of paths as strings, suitable for result of program_files()
"""
base_dir = os.path.dirname(executable)
if parent_dir:
base_dir = os.path.join(base_dir, os.path.pardir)
return util.flatten(
util.expand_filename_pattern(path, base_dir) for path in required_paths
)