-
Notifications
You must be signed in to change notification settings - Fork 5
/
experiment-evaluate-extra.ps1
108 lines (86 loc) · 2.83 KB
/
experiment-evaluate-extra.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<#
.SYNOPSIS
Runs the evaluation tasks on hard-coded extra snippet results.
#>
[CmdletBinding()]
Param(
[boolean] $SkipExisting = $true,
[switch] $MergeCsv,
[string] $JavaHeapMemory = "4G",
[string] $AntOptions = "-Xmx4g",
[string] $SnippetSelector = ".+",
[string[]] $SelectedTasks
)
$SNIPPET_PROJECT = "sette-snippets-extra"
$SNIPPET_PROJECT_DIR = "sette-snippets/java/sette-snippets-extra"
$LOG_DIR = "explog"
$Env:ANT_OPTS = $AntOptions
$tasks = @{"3" = "parser"; "4" = "test-generator"; "5" = "test-runner"; "6" = "export-csv"}
if ($SelectedTasks) {
$allTasks = $tasks
$tasks = @{}
foreach ($stask in $SelectedTasks) {
if ($stask -and $allTasks.Values -notcontains $stask) {
$Host.UI.WriteErrorLine("Unknown task $stask")
exit 1
}
}
foreach ($taskNum in $allTasks.Keys | Sort-Object) {
$task = $allTasks[$taskNum]
if ($SelectedTasks -contains $task) {
$tasks[$taskNum] = $task
}
}
}
$targets = @{
"catg" = @{
"1|30sec" = (1..10);
};
"evosuite" = @{
"1|30sec" = (1..10);
};
"jpet" = @{
"1|30sec" = (1..10);
};
"randoop" = @{
"1|30sec" = (1..10);
};
"spf" = @{
"1|30sec" = (1..10);
}
}
mkdir "$LOG_DIR" -f > $null
mkdir "$LOG_DIR/$SNIPPET_PROJECT" -f > $null
$csvs = @()
foreach ($tool in $targets.Keys | Sort-Object) {
foreach($timeKey in $targets[$tool].Keys | Sort-Object) {
$time = $timeKey.Split("|")[1]
foreach($num in $targets[$tool][$timeKey]) {
$num = "{0:D2}" -f $num
$tag = "run-${num}-${time}"
$dir = "${SNIPPET_PROJECT}___${tool}___${tag}"
if (!(Test-Path "../sette-results/$dir")) {
Write-Warning "Missing $dir"
continue
}
$csvs += "../sette-results/$dir/sette-evaluation.csv"
if ( $SkipExisting -and (Test-Path "../sette-results/$dir/sette-evaluation.csv")) {
Write-Output "Skipping $tool $tag"
} else {
foreach ($taskNum in $tasks.Keys | Sort-Object) {
$task = $tasks[$taskNum]
Write-Progress -Activity "$SNIPPET_PROJECT $tool" -Status $tag -CurrentOperation $task
java "-Xmx$JavaHeapMemory" -jar sette-all.jar --snippet-project-dir $SNIPPET_PROJECT_DIR --tool $tool --task $task --runner-project-tag $tag --snippet-selector $SnippetSelector 2>&1 | % {"$_"} | Out-File "$LOG_DIR/$SNIPPET_PROJECT/${tool}_${tag}_${taskNum}_${task}.log"
}
}
}
}
}
if ($MergeCsv) {
Write-Progress "Merging csvs"
$mergedCsv = @()
foreach ($csv in $csvs) {
$mergedCsv += Import-Csv $csv
}
$mergedCsv | Export-Csv "snippets-extra.csv" -NoTypeInformation
}