Skip to content

Commit 0dc7fd3

Browse files
author
icse19-FAST-R
committed
Improved usage information and added <repetitions>
1 parent 2067515 commit 0dc7fd3

File tree

3 files changed

+56
-13
lines changed

3 files changed

+56
-13
lines changed

py/experimentAdequate.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,34 @@
2828
in the Adequate scenario and in all input test suite.
2929
"""
3030

31+
32+
usage = """USAGE: python3 py/experimentAdequate.py <coverageType> <program> <version> <repetitions>
33+
OPTIONS:
34+
<coverageType>: the target coverage criterion.
35+
options: function, line, branch
36+
<program> <version>: the target subject and its respective version.
37+
options: flex v3, grep v3, gzip v1, make v1, sed v6, chart v0, closure v0, lang v0, math v0, time v0
38+
<repetitions>: number of times the test suite reduction should be computed.
39+
options: positive integer value, e.g. 50"""
40+
41+
3142
if __name__ == "__main__":
43+
if len(sys.argv) != 5:
44+
print(usage)
45+
exit()
46+
3247
SIR = [("flex", "v3"), ("grep", "v3"), ("gzip", "v1"), ("sed", "v6"), ("make", "v1")]
3348
D4J = [("math", "v1"), ("closure", "v1"), ("time", "v1"), ("lang", "v1"), ("chart", "v1")]
34-
script, covType, prog, v = sys.argv
49+
script, covType, prog, v, rep = sys.argv
50+
repeats = int(rep)
3551

3652
directory = "outputAdequate-{}/{}_{}/".format(covType, prog, v)
3753
if not os.path.exists(directory):
3854
os.makedirs(directory)
3955
if not os.path.exists(directory + "selections/"):
4056
os.makedirs(directory + "selections/")
4157
if not os.path.exists(directory + "measures/"):
42-
os.makedirs(directory + "measures/")
43-
44-
repeats = 50
58+
os.makedirs(directory + "measures/")
4559

4660
# FAST parameters
4761
k, n, r, b = 5, 10, 1, 10

py/experimentBudget.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,27 @@
2727
in the Budget scenario and in all input test suite.
2828
"""
2929

30+
31+
usage = """USAGE: python3 py/experimentBudget.py <coverageType> <program> <version> <repetitions>
32+
OPTIONS:
33+
<coverageType>: the target coverage criterion.
34+
options: function, line, branch
35+
<program> <version>: the target subject and its respective version.
36+
options: flex v3, grep v3, gzip v1, make v1, sed v6, chart v0, closure v0, lang v0, math v0, time v0
37+
<repetitions>: number of times the test suite reduction should be computed.
38+
options: positive integer value, e.g. 50"""
39+
40+
3041
if __name__ == "__main__":
42+
if len(sys.argv) != 5:
43+
print(usage)
44+
exit()
45+
3146
SIR = [("flex", "v3"), ("grep", "v3"), ("gzip", "v1"), ("sed", "v6"), ("make", "v1")]
3247
D4J = [("math", "v1"), ("closure", "v1"), ("time", "v1"), ("lang", "v1"), ("chart", "v1")]
33-
script, covType, prog, v = sys.argv
48+
script, covType, prog, v, rep = sys.argv
49+
repetitions = int(rep)
50+
repeats = 50
3451

3552
directory = "outputBudget-{}/{}_{}/".format(covType, prog, v)
3653
if not os.path.exists(directory):
@@ -40,8 +57,6 @@
4057
if not os.path.exists(directory + "measures/"):
4158
os.makedirs(directory + "measures/")
4259

43-
repeats = 50
44-
4560
# FAST-R parameters
4661
k, n, r, b = 5, 10, 1, 10
4762
dim = 10
@@ -68,7 +83,7 @@ def one_(x): return 1
6883

6984
numOfTCS = sum((1 for _ in open(inputFile)))
7085

71-
for reduction in range(1, 30+1):
86+
for reduction in range(1, repetitions+1):
7287
B = int(numOfTCS * reduction / 100)
7388

7489
for run in range(repeats):

py/experimentLargeScale.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,23 @@
2525
in the Large-scale scenario and in all input test suite.
2626
"""
2727

28+
29+
usage = """USAGE: python3 py/experimentLargeScale.py <algorithm> <repetitions>
30+
OPTIONS:
31+
<algorithm>: the test suite reduction algorithm.
32+
options: FAST++, FAST-CS, FAST-pw, FAST-all
33+
<repetitions>: number of times the test suite reduction should be computed.
34+
options: positive integer value, e.g. 50"""
35+
36+
2837
if __name__ == "__main__":
38+
if len(sys.argv) != 3:
39+
print(usage)
40+
exit()
41+
2942
ALGS = ["FAST++", "FAST-CS", "FAST-pw", "FAST-all"]
30-
script, alg = sys.argv
43+
script, alg, rep = sys.argv
44+
repetitions = int(rep)
3145

3246
directory = "outputLargeScale/"
3347
if not os.path.exists(directory):
@@ -56,7 +70,7 @@ def one_(x): return 1
5670
numOfTCS = sum((1 for _ in open(inputFile)))
5771

5872
if alg == "FAST++":
59-
for reduction in range(30):
73+
for reduction in range(repetitions):
6074
B = int(numOfTCS * reduction / 100)
6175
pTime, rTime, sel = fastr.fastPlusPlus(inputFile, dim=dim, B=B, memory=False)
6276
sOut = "{}/{}-{}.pickle".format(sPath, "FAST++", reduction+1)
@@ -67,7 +81,7 @@ def one_(x): return 1
6781

6882

6983
if alg == "FAST-CS":
70-
for reduction in range(30):
84+
for reduction in range(repetitions):
7185
B = int(numOfTCS * reduction / 100)
7286
pTime, rTime, sel = fastr.fastCS(inputFile, dim=dim, B=B, memory=False)
7387
sOut = "{}/{}-{}.pickle".format(sPath, "FAST-CS", reduction+1)
@@ -78,7 +92,7 @@ def one_(x): return 1
7892

7993

8094
if alg == "FAST-pw":
81-
for reduction in range(30):
95+
for reduction in range(repetitions):
8296
B = int(numOfTCS * reduction / 100)
8397
pTime, rTime, sel = fastr.fast_pw(inputFile, r, b, bbox=True, k=k, memory=False, B=B)
8498
sOut = "{}/{}-{}.pickle".format(sPath, "FAST-pw", reduction+1)
@@ -89,7 +103,7 @@ def one_(x): return 1
89103

90104

91105
if alg == "FAST-all":
92-
for reduction in range(30):
106+
for reduction in range(repetitions):
93107
B = int(numOfTCS * reduction / 100)
94108
pTime, rTime, sel = fastr.fast_(
95109
inputFile, all_, r, b, bbox=True, k=k, memory=False, B=B)

0 commit comments

Comments
 (0)