universalmutator 0.9.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/analyze_mutants +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/check_covered +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/intersect_mutants +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/mutate +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/prioritize_mutants +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/prune_mutants +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/show_mutants +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/__init__.py +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/__init__.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/analyze.py +249 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/analyze.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/c_handler.py +2 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/c_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/checkcov.py +80 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/checkcov.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/cpp_handler.py +2 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/cpp_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/genmutants.py +401 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/genmutants.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/go_handler.py +2 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/go_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/intersect.py +33 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/intersect.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/java_handler.py +27 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/java_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/mutator.py +184 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/mutator.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/new_solidity_handler.py +57 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/new_solidity_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/prioritize.py +124 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/prioritize.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/prune.py +135 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/prune.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/python_handler.py +67 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/python_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/rust_handler.py +30 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/rust_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/show.py +64 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/show.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/solidity_handler.py +61 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/solidity_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/c.rules +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/c_like.rules +19 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/cpp.rules +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/go.rules +6 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/java.rules +6 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/none.rules +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/python.rules +38 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/rust.rules +12 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/solidity.rules +50 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/swift.rules +15 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/universal.rules +88 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/static/vyper.rules +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/swift_handler.py +31 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/swift_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/utils.py +192 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/utils.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/vyper_handler.py +33 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator/vyper_handler.pyc +0 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/PKG-INFO +129 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/SOURCES.txt +28 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/dependency_links.txt +1 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/entry_points.txt +10 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/requires.txt +1 -0
- opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/universalmutator-0.9.5-py2.7.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','analyze_mutants'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'analyze_mutants')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','check_covered'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'check_covered')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','intersect_mutants'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'intersect_mutants')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','mutate'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'mutate')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','prioritize_mutants'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'prioritize_mutants')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','prune_mutants'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'prune_mutants')()
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'universalmutator==0.9.5','console_scripts','show_mutants'
|
|
3
|
+
__requires__ = 'universalmutator==0.9.5'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('universalmutator==0.9.5', 'console_scripts', 'show_mutants')()
|
|
12
|
+
)
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import glob
|
|
6
|
+
import shutil
|
|
7
|
+
import signal
|
|
8
|
+
import time
|
|
9
|
+
import random
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main():
|
|
14
|
+
|
|
15
|
+
args = sys.argv
|
|
16
|
+
|
|
17
|
+
if ("--help" in args) or (len(sys.argv) < 3):
|
|
18
|
+
if len(sys.argv) < 3:
|
|
19
|
+
print("ERROR: analyze_mutants requires at least two arguments\n")
|
|
20
|
+
print("USAGE: analyze_mutants <sourcefile> <cmd> [--mutantDir <dir>] [--fromFile <mutantfile>]")
|
|
21
|
+
print(" <cmd> is command to execute to run tests; non-zero return indicates mutant killed")
|
|
22
|
+
print(" --mutantDir: directory with all mutants; defaults to current directory")
|
|
23
|
+
print(" --fromFile: file containing list of mutants to process; others ignored")
|
|
24
|
+
print(" --timeout <val>: change the timeout setting")
|
|
25
|
+
print(" --show: show mutants")
|
|
26
|
+
print(" --verbose: show mutants and output of analysis")
|
|
27
|
+
print(" --seed: random seed for shuffling of mutants")
|
|
28
|
+
print(" --noShuffle: do not randomize order of mutants")
|
|
29
|
+
print(" --resume: use existing killed.txt and notkilled.txt, resume mutation analysis")
|
|
30
|
+
print(" --prefix: add a prefix to killed.txt and notkilled.txt")
|
|
31
|
+
sys.exit(0)
|
|
32
|
+
|
|
33
|
+
verbose = "--verbose" in sys.argv
|
|
34
|
+
if verbose:
|
|
35
|
+
args.remove("--verbose")
|
|
36
|
+
|
|
37
|
+
showM = "--show" in sys.argv
|
|
38
|
+
if showM:
|
|
39
|
+
args.remove("--show")
|
|
40
|
+
|
|
41
|
+
resume = "--resume" in sys.argv
|
|
42
|
+
if resume:
|
|
43
|
+
args.remove("--resume")
|
|
44
|
+
|
|
45
|
+
noShuffle = "--noShuffle" in sys.argv
|
|
46
|
+
if noShuffle:
|
|
47
|
+
args.remove("--noShuffle")
|
|
48
|
+
|
|
49
|
+
prefix = None
|
|
50
|
+
try:
|
|
51
|
+
prefixpos = args.index("--prefix")
|
|
52
|
+
except ValueError:
|
|
53
|
+
prefixpos = -1
|
|
54
|
+
|
|
55
|
+
if prefixpos != -1:
|
|
56
|
+
prefix = args[prefixpos + 1]
|
|
57
|
+
args.remove("--prefix")
|
|
58
|
+
args.remove(prefix)
|
|
59
|
+
|
|
60
|
+
fromFile = None
|
|
61
|
+
try:
|
|
62
|
+
filepos = args.index("--fromFile")
|
|
63
|
+
except ValueError:
|
|
64
|
+
filepos = -1
|
|
65
|
+
|
|
66
|
+
if filepos != -1:
|
|
67
|
+
fromFile = args[filepos + 1]
|
|
68
|
+
args.remove("--fromFile")
|
|
69
|
+
args.remove(fromFile)
|
|
70
|
+
|
|
71
|
+
seed = None
|
|
72
|
+
try:
|
|
73
|
+
seedpos = args.index("--seed")
|
|
74
|
+
except ValueError:
|
|
75
|
+
seedpos = -1
|
|
76
|
+
|
|
77
|
+
if seedpos != -1:
|
|
78
|
+
seed = args[seedpos + 1]
|
|
79
|
+
args.remove("--seed")
|
|
80
|
+
args.remove(seed)
|
|
81
|
+
seed = int(seed)
|
|
82
|
+
|
|
83
|
+
timeout = 30
|
|
84
|
+
try:
|
|
85
|
+
topos = args.index("--timeout")
|
|
86
|
+
except ValueError:
|
|
87
|
+
topos = -1
|
|
88
|
+
|
|
89
|
+
if topos != -1:
|
|
90
|
+
timeout = args[topos + 1]
|
|
91
|
+
args.remove("--timeout")
|
|
92
|
+
args.remove(timeout)
|
|
93
|
+
timeout = float(timeout)
|
|
94
|
+
|
|
95
|
+
onlyMutants = None
|
|
96
|
+
if fromFile is not None:
|
|
97
|
+
with open(fromFile, 'r') as file:
|
|
98
|
+
onlyMutants = file.read().split()
|
|
99
|
+
|
|
100
|
+
mdir = ""
|
|
101
|
+
try:
|
|
102
|
+
mdirpos = args.index("--mutantDir")
|
|
103
|
+
except ValueError:
|
|
104
|
+
mdirpos = -1
|
|
105
|
+
|
|
106
|
+
if mdirpos != -1:
|
|
107
|
+
mdir = args[mdirpos + 1]
|
|
108
|
+
args.remove("--mutantDir")
|
|
109
|
+
args.remove(mdir)
|
|
110
|
+
mdir += "/"
|
|
111
|
+
|
|
112
|
+
src = args[1]
|
|
113
|
+
tstCmd = [args[2]]
|
|
114
|
+
ignore = []
|
|
115
|
+
if len(args) > 3:
|
|
116
|
+
with open(sys.argv[3]) as file:
|
|
117
|
+
for l in file:
|
|
118
|
+
ignore.append(l.split()[0])
|
|
119
|
+
|
|
120
|
+
srcBase = src.split("/")[-1]
|
|
121
|
+
srcEnd = "." + ((src.split(".")[-1]).split("/")[-1])
|
|
122
|
+
|
|
123
|
+
count = 0.0
|
|
124
|
+
killCount = 0.0
|
|
125
|
+
|
|
126
|
+
killFileName = "killed.txt"
|
|
127
|
+
notkillFileName = "notkilled.txt"
|
|
128
|
+
if prefix is not None:
|
|
129
|
+
killFileName = prefix + "." + killFileName
|
|
130
|
+
notkillFileName = prefix + "." + notkillFileName
|
|
131
|
+
|
|
132
|
+
print("ANALYZING", src)
|
|
133
|
+
print("COMMAND: **", tstCmd, "**")
|
|
134
|
+
|
|
135
|
+
allTheMutants = glob.glob(mdir + srcBase.replace(srcEnd, ".mutant*" + srcEnd))
|
|
136
|
+
|
|
137
|
+
if onlyMutants is not None:
|
|
138
|
+
newMutants = []
|
|
139
|
+
for f1 in onlyMutants:
|
|
140
|
+
for f2 in allTheMutants:
|
|
141
|
+
if f2.split("/")[-1] == f1:
|
|
142
|
+
newMutants.append(f2)
|
|
143
|
+
allTheMutants = newMutants
|
|
144
|
+
|
|
145
|
+
if seed is not None:
|
|
146
|
+
random.seed(seed)
|
|
147
|
+
|
|
148
|
+
if not noShuffle:
|
|
149
|
+
random.shuffle(allTheMutants)
|
|
150
|
+
|
|
151
|
+
allStart = time.time()
|
|
152
|
+
|
|
153
|
+
if resume:
|
|
154
|
+
alreadyKilled = []
|
|
155
|
+
alreadyNotKilled = []
|
|
156
|
+
if not (os.path.exists(killFileName) and os.path.exists(notkillFileName)):
|
|
157
|
+
print("ATTEMPTING TO RESUME, BUT NO PREVIOUS RESULTS FOUND")
|
|
158
|
+
else:
|
|
159
|
+
with open(killFileName, 'r') as killed:
|
|
160
|
+
with open(notkillFileName, 'r') as notkilled:
|
|
161
|
+
for line in killed:
|
|
162
|
+
if line == "\n":
|
|
163
|
+
continue
|
|
164
|
+
alreadyKilled.append(line[:-1])
|
|
165
|
+
count += 1
|
|
166
|
+
killCount += 1
|
|
167
|
+
for line in notkilled:
|
|
168
|
+
if line == "\n":
|
|
169
|
+
continue
|
|
170
|
+
alreadyNotKilled.append(line[:-1])
|
|
171
|
+
count += 1
|
|
172
|
+
print("RESUMING FROM EXISTING RUN, WITH", int(killCount), "KILLED MUTANTS OUT OF", int(count))
|
|
173
|
+
|
|
174
|
+
with open(os.devnull, 'w') as dnull:
|
|
175
|
+
with open(killFileName, 'w') as killed:
|
|
176
|
+
with open(notkillFileName, 'w') as notkilled:
|
|
177
|
+
if resume:
|
|
178
|
+
for line in alreadyKilled:
|
|
179
|
+
killed.write(line + "\n")
|
|
180
|
+
killed.flush()
|
|
181
|
+
for line in alreadyNotKilled:
|
|
182
|
+
notkilled.write(line + "\n")
|
|
183
|
+
notkilled.flush()
|
|
184
|
+
for f in allTheMutants:
|
|
185
|
+
if resume:
|
|
186
|
+
if (f.split("/")[-1] in alreadyKilled) or (f.split("/")[-1] in alreadyNotKilled):
|
|
187
|
+
continue
|
|
188
|
+
if f in ignore:
|
|
189
|
+
print(f, "SKIPPED")
|
|
190
|
+
print("=" * 80)
|
|
191
|
+
print("#" + str(int(count) + 1) + ":", end=" ")
|
|
192
|
+
print("[" + str(round(time.time() - allStart, 2)) + "s", end=" ")
|
|
193
|
+
print(str(round(count / len(allTheMutants) * 100.0, 2)) + "% DONE]")
|
|
194
|
+
if verbose or showM:
|
|
195
|
+
print("MUTANT:", f)
|
|
196
|
+
with open(".mutant.diff", 'w') as mdiff:
|
|
197
|
+
subprocess.call(["diff", src, f], stdout=mdiff, stderr=mdiff)
|
|
198
|
+
with open(".mutant.diff", 'r') as mdiff:
|
|
199
|
+
for line in mdiff:
|
|
200
|
+
print(line, end="")
|
|
201
|
+
print()
|
|
202
|
+
sys.stdout.flush()
|
|
203
|
+
print("RUNNING", f + "...")
|
|
204
|
+
sys.stdout.flush()
|
|
205
|
+
try:
|
|
206
|
+
shutil.copy(src, src + ".um.backup")
|
|
207
|
+
shutil.copy(f, src)
|
|
208
|
+
|
|
209
|
+
start = time.time()
|
|
210
|
+
|
|
211
|
+
if not verbose:
|
|
212
|
+
P = subprocess.Popen(tstCmd, shell=True, stderr=dnull, stdout=dnull,
|
|
213
|
+
preexec_fn=os.setsid)
|
|
214
|
+
else:
|
|
215
|
+
P = subprocess.Popen(tstCmd, shell=True, preexec_fn=os.setsid)
|
|
216
|
+
|
|
217
|
+
try:
|
|
218
|
+
while P.poll() is None and (time.time() - start) < timeout:
|
|
219
|
+
time.sleep(0.05)
|
|
220
|
+
finally:
|
|
221
|
+
if P.poll() is None:
|
|
222
|
+
print()
|
|
223
|
+
print("HAD TO TERMINATE ANALYSIS (TIMEOUT OR EXCEPTION)")
|
|
224
|
+
os.killpg(os.getpgid(P.pid), signal.SIGTERM)
|
|
225
|
+
r = P.returncode
|
|
226
|
+
|
|
227
|
+
runtime = time.time() - start
|
|
228
|
+
|
|
229
|
+
count += 1
|
|
230
|
+
if r == 0:
|
|
231
|
+
print(f, "NOT KILLED")
|
|
232
|
+
notkilled.write(f.split("/")[-1] + "\n")
|
|
233
|
+
notkilled.flush()
|
|
234
|
+
else:
|
|
235
|
+
killCount += 1
|
|
236
|
+
print(f, "KILLED IN", runtime)
|
|
237
|
+
killed.write(f.split("/")[-1] + "\n")
|
|
238
|
+
killed.flush()
|
|
239
|
+
print(" RUNNING SCORE:", killCount / count)
|
|
240
|
+
sys.stdout.flush()
|
|
241
|
+
finally:
|
|
242
|
+
shutil.copy(src + ".um.backup", src)
|
|
243
|
+
os.remove(src + ".um.backup")
|
|
244
|
+
print("=" * 80)
|
|
245
|
+
print("MUTATION SCORE:", killCount / count)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if __name__ == '__main__':
|
|
249
|
+
main()
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import glob
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
|
|
10
|
+
args = sys.argv
|
|
11
|
+
|
|
12
|
+
if ("--help" in args) or (len(sys.argv) < 4):
|
|
13
|
+
if len(sys.argv) < 4:
|
|
14
|
+
print("ERROR: check_covered requires at least three arguments\n")
|
|
15
|
+
print("USAGE: check_covered <sourcefile> <coverfile> <outfile> [--tstl] [--mutantDir directory]")
|
|
16
|
+
print(" --mutantDir: directory to put generated mutants in; defaults to current directory")
|
|
17
|
+
print(" --tstl: process <coverfile> that is output from TSTL internal report")
|
|
18
|
+
sys.exit(0)
|
|
19
|
+
|
|
20
|
+
mdir = ""
|
|
21
|
+
try:
|
|
22
|
+
mdirpos = args.index("--mutantDir")
|
|
23
|
+
except ValueError:
|
|
24
|
+
mdirpos = -1
|
|
25
|
+
|
|
26
|
+
if mdirpos != -1:
|
|
27
|
+
mdir = args[mdirpos + 1]
|
|
28
|
+
args.remove("--mutantDir")
|
|
29
|
+
args.remove(mdir)
|
|
30
|
+
mdir += "/"
|
|
31
|
+
|
|
32
|
+
src = args[1]
|
|
33
|
+
coverFile = args[2]
|
|
34
|
+
outFile = args[3]
|
|
35
|
+
|
|
36
|
+
tstl = "--tstl" in sys.argv
|
|
37
|
+
|
|
38
|
+
srcBase = src.split("/")[-1]
|
|
39
|
+
srcEnd = src.split(".")[-1]
|
|
40
|
+
|
|
41
|
+
with open(coverFile) as file:
|
|
42
|
+
if not tstl:
|
|
43
|
+
lines = map(int, file.read().split())
|
|
44
|
+
else:
|
|
45
|
+
lines = []
|
|
46
|
+
for l in file:
|
|
47
|
+
if "LINES" in l:
|
|
48
|
+
if src not in l:
|
|
49
|
+
continue
|
|
50
|
+
db = l.split("[")[1]
|
|
51
|
+
d = db[:-2].split(",")
|
|
52
|
+
for line in d:
|
|
53
|
+
lines.append(int(line))
|
|
54
|
+
|
|
55
|
+
with open(outFile, 'w') as coveredFile:
|
|
56
|
+
for f in glob.glob(
|
|
57
|
+
mdir +
|
|
58
|
+
srcBase.replace(
|
|
59
|
+
srcEnd,
|
|
60
|
+
"mutant.*." +
|
|
61
|
+
srcEnd)):
|
|
62
|
+
with open(".mutant_diff", 'w') as file:
|
|
63
|
+
subprocess.call(["diff", src, f], stdout=file, stderr=file)
|
|
64
|
+
with open(".mutant_diff") as file:
|
|
65
|
+
for l in file:
|
|
66
|
+
if "c" in l:
|
|
67
|
+
line = int(l.split("c")[0])
|
|
68
|
+
break
|
|
69
|
+
elif "a" in l:
|
|
70
|
+
line = int(l.split("a")[0])
|
|
71
|
+
break
|
|
72
|
+
elif "d" in l:
|
|
73
|
+
line = int(l.split("d")[0])
|
|
74
|
+
break
|
|
75
|
+
if line in lines:
|
|
76
|
+
coveredFile.write(f.split("/")[-1] + "\n")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == '__main__':
|
|
80
|
+
main()
|
|
Binary file
|