@@ -28,7 +28,14 @@ class Tool(benchexec.tools.template.BaseTool):
2828 This class serves as tool adaptor for Map2Check (https://github.com/hbgit/Map2Check)
2929 """
3030
31- REQUIRED_PATHS = [
31+ REQUIRED_PATHS_6 = [
32+ "__init__.py" ,
33+ "map2check.py" ,
34+ "map2check-wrapper.sh" ,
35+ "modules"
36+ ]
37+
38+ REQUIRED_PATHS_7_1 = [
3239 "__init__.py" ,
3340 "map2check" ,
3441 "map2check-wrapper.py" ,
@@ -37,14 +44,35 @@ class Tool(benchexec.tools.template.BaseTool):
3744
3845 def executable (self ):
3946 #Relative path to map2check wrapper
40- return Util .find_executable ('map2check-wrapper.py' )
47+ if self ._get_version () == 6 :
48+ return Util .find_executable ('map2check-wrapper.sh' )
49+ elif self ._get_version () > 6 :
50+ return Util .find_executable ('map2check-wrapper.py' )
51+
4152
4253 def program_files (self , executable ):
4354 executableDir = os .path .dirname (executable )
44- return [executableDir ]
55+
56+ if self ._get_version () == 6 :
57+ paths = REQUIRED_PATHS_6
58+ elif self ._get_version () > 6 :
59+ paths = REQUIRED_PATHS_7_1
60+
61+ return [executableDir ] + paths
62+
63+ def _get_version (self ):
64+ """
65+ Determine the version based on map2check-wrapper.sh file
66+ """
67+ exe_v6 = Util .find_executable ('map2check-wrapper.sh' , exitOnError = False )
68+ if exe_v6 :
69+ return 6
70+ else :
71+ return 7
72+
4573
4674 def working_directory (self , executable ):
47- executableDir = os .path .dirname (executable )
75+ executableDir = os .path .dirname (executable )
4876 return executableDir
4977
5078 def version (self , executable ):
@@ -57,33 +85,55 @@ def cmdline(self, executable, options, sourcefiles, propertyfile, rlimits):
5785 assert len (sourcefiles ) == 1 , "only one sourcefile supported"
5886 assert propertyfile , "property file required"
5987 sourcefile = sourcefiles [0 ]
60- return [executable ] + options + ['-p' , propertyfile , sourcefile ]
88+ if self ._get_version () == 6 :
89+ return [executable ] + options + ['-c' , propertyfile , sourcefile ]
90+ elif self ._get_version () > 6 :
91+ return [executable ] + options + ['-p' , propertyfile , sourcefile ]
92+
6193
6294 def determine_result (self , returncode , returnsignal , output , isTimeout ):
6395 if not output :
6496 return result .RESULT_UNKNOWN
6597 output = output [- 1 ].strip ()
6698 status = result .RESULT_UNKNOWN
6799
68- if output .endswith ('TRUE' ):
69- status = result .RESULT_TRUE_PROP
70- elif 'FALSE' in output :
71- if "FALSE_MEMTRACK" in output :
72- status = result .RESULT_FALSE_MEMTRACK
73- elif "FALSE_DEREF" in output :
74- status = result .RESULT_FALSE_DEREF
75- elif "FALSE_FREE" in output :
76- status = result .RESULT_FALSE_FREE
77- elif "FALSE_OVERFLOW" in output :
78- status = result .RESULT_FALSE_OVERFLOW
100+ if self ._get_version () > 6 :
101+ if output .endswith ('TRUE' ):
102+ status = result .RESULT_TRUE_PROP
103+ elif 'FALSE' in output :
104+ if "FALSE_MEMTRACK" in output :
105+ status = result .RESULT_FALSE_MEMTRACK
106+ elif "FALSE_DEREF" in output :
107+ status = result .RESULT_FALSE_DEREF
108+ elif "FALSE_FREE" in output :
109+ status = result .RESULT_FALSE_FREE
110+ elif "FALSE_OVERFLOW" in output :
111+ status = result .RESULT_FALSE_OVERFLOW
112+ else :
113+ status = result .RESULT_FALSE_REACH
114+ elif output .endswith ('UNKNOWN' ):
115+ status = result .RESULT_UNKNOWN
116+ elif isTimeout :
117+ status = 'TIMEOUT'
79118 else :
80- status = result .RESULT_FALSE_REACH
81- elif output .endswith ('UNKNOWN' ):
82- status = result .RESULT_UNKNOWN
83- elif isTimeout :
84- status = 'TIMEOUT'
85- else :
86- status = 'ERROR'
119+ status = 'ERROR'
120+
121+ elif self ._get_version () == 6 :
122+ if output .endswith ('TRUE' ):
123+ status = result .RESULT_TRUE_PROP
124+ elif 'FALSE' in output :
125+ if "FALSE(valid-memtrack)" in output :
126+ status = result .RESULT_FALSE_MEMTRACK
127+ elif "FALSE(valid-deref)" in output :
128+ status = result .RESULT_FALSE_DEREF
129+ elif "FALSE(valid-free)" in output :
130+ status = result .RESULT_FALSE_FREE
131+ elif output .endswith ('UNKNOWN' ):
132+ status = result .RESULT_UNKNOWN
133+ elif isTimeout :
134+ status = 'TIMEOUT'
135+ else :
136+ status = 'ERROR'
87137
88138 return status
89139
0 commit comments