Skip to content

Commit

Permalink
Move MEA lib to CV
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordan Vitalii committed Jul 14, 2023
1 parent 4fd8c4c commit e24dc1c
Show file tree
Hide file tree
Showing 7 changed files with 1,807 additions and 17 deletions.
21 changes: 4 additions & 17 deletions scripts/components/mea.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,15 @@
import json
import logging
import multiprocessing
import operator
import re
import resource
import time
import zipfile

# noinspection PyUnresolvedReferences
from aux.mea import DEFAULT_CONVERSION_FUNCTION, CONVERSION_FUNCTION_MODEL_FUNCTIONS, \
CONVERSION_FUNCTION_CALL_TREE, CONVERSION_FUNCTION_NOTES, convert_error_trace, \
compare_error_traces, is_equivalent, DEFAULT_COMPARISON_FUNCTION, \
DEFAULT_SIMILARITY_THRESHOLD, TAG_COMPARISON_FUNCTION, TAG_CONVERSION_FUNCTION, \
TAG_ADDITIONAL_MODEL_FUNCTIONS, CONVERSION_FUNCTION_FULL

from aux.common import *
from components import *
from components.component import Component
from mea.core import *
from mea.et import import_error_trace

ERROR_TRACE_FILE = "error trace.json"
CONVERTED_ERROR_TRACES = "converted error traces.json"
Expand Down Expand Up @@ -86,7 +79,6 @@ def __init__(self, general_config: dict, error_traces: list, install_dir: str, r
os.makedirs(self.result_dir, exist_ok=True)
else:
self.result_dir = None
self.__export_et_parser_lib()
self.rule = rule

# List of files with error traces.
Expand Down Expand Up @@ -323,6 +315,7 @@ def __print_trace_archive(self, error_trace_file_name: str, witness_type=WITNESS
'reports',
)
django.setup()
self.__export_et_parser_lib()
# noinspection PyUnresolvedReferences
from reports.etv import convert_json_trace_to_html
with open(json_trace_name, encoding="utf8") as trace_file:
Expand All @@ -348,11 +341,8 @@ def __process_parsed_trace(parsed_error_trace: dict):
parsed_error_trace['files'] = src_files

def __parse_trace(self, error_trace_file: str, supported_types: set) -> dict:
# noinspection PyUnresolvedReferences
from core.vrp.et import import_error_trace

# Those messages are waste of space.
logger = self._create_logger(
logger = Component._create_logger(
"Witness processor", logging.WARNING if self.debug else logging.ERROR
)
try:
Expand Down Expand Up @@ -429,9 +419,6 @@ def __get_option_for_rule(self, tag: str, default_value):
return self.component_config.get(self.rule, {}).get(tag, default)

def __export_et_parser_lib(self):
et_parser_lib = self.get_tool_path(self._get_tool_default_path(ET_LIB),
self.config.get(TAG_TOOLS, {}).get(ET_LIB))
sys.path.append(et_parser_lib)
et_html_lib = self.get_tool_path(self._get_tool_default_path(ET_HTML_LIB),
self.config.get(TAG_TOOLS, {}).get(ET_HTML_LIB))
sys.path.append(et_html_lib)
Expand Down
18 changes: 18 additions & 0 deletions scripts/mea/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# CV is a framework for continuous verification.
#
# Copyright (c) 2018-2023 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Loading

0 comments on commit e24dc1c

Please sign in to comment.