Skip to content

Commit 6ebf0f3

Browse files
merge
2 parents bf17673 + a0d0e76 commit 6ebf0f3

File tree

5,960 files changed

+144332
-11986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,960 files changed

+144332
-11986
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "AbiComparator"]
2+
path = AbiComparator
3+
url = https://github.com/dnpetrov/AbiComparator/

bbf.conf

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ BACKENDS.JVM_NEW_IR="-Xuse-ir"
88
#BACKENDS.JS_FIR="-Xuse-fir"
99
#BACKENDS.NATIVE=""
1010

11+
#Miscompilation mode
12+
MISCOMPILATION_MODE = false
13+
STRICT_MODE = false
14+
15+
#ABI mode
16+
ABI_CHECK_MODE = false
17+
IGNORE_MISSING_CLOSURE_CONVERTED_METHOD = true
18+
1119
#Oracle settings
12-
USE_JAVA_AS_ORACLE = false
20+
USE_JAVA_AS_ORACLE = true
1321

1422
#Mutator settings
1523
SAVE_BACKEND_EXCEPTIONS = true
@@ -28,6 +36,7 @@ FASTREDUCE = false
2836

2937
#Paths
3038
MUTATING_DIR = "tmp/arrays"
39+
#MUTATING_DIR = "tmp/abiTests/"
3140
JAVA_FILES_DIR = "tmp/javaDB"
3241
TMPFILE = "tmp/tmp.kt"
3342
RESULTS = "tmp/results/"
@@ -38,12 +47,15 @@ LOG = true
3847
#REPORT PROPERTIES
3948
TEXT_REPORTER = false
4049
FILE_REPORTER = true
50+
SAVE_STATS = true
4151

4252
#Text
4353
PATH_TO_TEXT_FILE = tmp/results/result.log
4454

4555
#Timeout for one file (in seconds)
46-
BBF_TIMEOUT = 1200
56+
BBF_TIMEOUT = 600
57+
#BBF_TIMEOUT = 1200
58+
#BBF_TIMEOUT = 2400
4759

4860
#ReduKtor
4961
# Backend

bugsPerMinute.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugs: 10
2+
Time: 217
3+
Bugs per minute: 0.04608294930875576

build.gradle

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
buildscript {
2-
ext.kotlin_version = '1.4-M1'
2+
//Do not forget to update intellij core
3+
ext.kotlin_version = '1.5.0-dev-309'
4+
ext.kotlin_plugin_version = '1.4.20'
35
repositories {
46
maven() {
57
url "https://dl.bintray.com/kotlin/kotlin-eap/"
@@ -10,35 +12,42 @@ buildscript {
1012
}
1113
}
1214

13-
1415
dependencies {
15-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4-M1"
16-
classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlin_version}"
16+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_plugin_version"
17+
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_plugin_version"
18+
}
19+
20+
//ABI COMPARATOR
21+
ext {
22+
asm_debug_version = '6.0_BETA'
23+
apache_commons_text_version = '1.8'
24+
kotlinx_metadata_version = '0.1.0'
25+
diff_version = '4.5'
1726
}
1827
}
1928

2029
plugins {
2130
id 'java'
22-
// id 'org.jetbrains.kotlin.jvm'
31+
id 'org.jetbrains.kotlin.jvm' version "$kotlin_plugin_version"
2332
id 'application'
2433
}
2534

2635
group 'com.stepanov.bbf'
2736
version '1.0'
2837

29-
sourceCompatibility = 1.8
38+
sourceCompatibility = 11
3039

3140
repositories {
3241
mavenCentral()
3342
jcenter()
3443
maven() {
35-
url "http://dl.bintray.com/vorpal-research/kotlin-maven"
44+
url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/"
3645
}
3746
maven() {
3847
url "https://dl.google.com/dl/android/maven2"
3948
}
4049
maven() {
41-
url "http://jcenter.bintray.com"
50+
url "https://jcenter.bintray.com"
4251
}
4352
maven() {
4453
url "https://dl.bintray.com/kotlin/kotlin-dev"
@@ -49,6 +58,12 @@ repositories {
4958
maven() {
5059
url 'https://jitpack.io'
5160
}
61+
maven() {
62+
url "http://dl.bintray.com/vorpal-research/kotlin-maven"
63+
}
64+
maven() {
65+
url "https://oss.sonatype.org/content/repositories/snapshots"
66+
}
5267
}
5368

5469

@@ -57,13 +72,13 @@ apply plugin: 'kotlin' // or 'kotlin-multiplatform' for multiplatform projects
5772
apply plugin: 'kotlinx-serialization'
5873

5974
ext {
60-
//kotlinVersion = '1.3.70'
61-
//kotlinVersion = '1.4-M1-release-99'
6275
aetherVersion = '1.1.0'
6376
javaMainClass = "com.stepanov.bbf.bugfinder.MainKt"
6477
}
6578

6679
dependencies {
80+
//Intellij core
81+
compile group: 'com.android.tools.external.com-intellij', name: 'intellij-core', version: '27.3.0-alpha01'
6782

6883
//Log
6984
compile "log4j:log4j:1.2.17"
@@ -74,16 +89,28 @@ dependencies {
7489
//Decompiler
7590
compile 'com.github.fesh0r:fernflower:e35da00aec'
7691

92+
//Antlr4
93+
compile group: 'org.antlr', name: 'antlr4-runtime', version: '4.8-1'
94+
compile group: 'org.antlr', name: 'antlr4', version: '4.8-1'
95+
7796
//Serialization
78-
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
97+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
7998

80-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
81-
compile group: 'com.android.tools.external.com-intellij', name: 'intellij-core', version: '27.1.0-alpha03'
99+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
100+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
101+
//compile "org.jetbrains.kotlin:kotlin-compiler:1.4.255-20201110.102611-685"
102+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: "${kotlin_version}"
103+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-common', version: "${kotlin_version}"
82104
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: "${kotlin_version}"
83105
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler-embeddable', version: "${kotlin_version}"
106+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-daemon-embeddable', version: "${kotlin_version}"
84107
compile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: "${kotlin_version}"
108+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-test-common', version: "${kotlin_version}"
109+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: "${kotlin_version}"
110+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-test-annotations-common', version: "${kotlin_version}"
85111
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-js', version: "${kotlin_version}"
86112
compile group: 'org.jetbrains.kotlin', name: 'kotlin-test-js', version: "${kotlin_version}"
113+
compile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: "${kotlin_version}"
87114
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: "${kotlin_version}"
88115

89116
//Reduktor
@@ -108,17 +135,24 @@ dependencies {
108135

109136
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
110137

138+
//AbiComparator
139+
compile group: 'org.jsoup', name: 'jsoup', version: '1.13.1'
140+
implementation "org.ow2.asm:asm-debug-all:$asm_debug_version"
141+
implementation "org.apache.commons:commons-text:$apache_commons_text_version"
142+
implementation "org.jetbrains.kotlinx:kotlinx-metadata-jvm:$kotlinx_metadata_version"
143+
implementation "io.github.java-diff-utils:java-diff-utils:$diff_version"
144+
111145
//Test
112146
testCompile group: 'junit', name: 'junit', version: '4.12'
113147
testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: '1.3.61'
114148

115149
}
116150

117151
compileKotlin {
118-
kotlinOptions.jvmTarget = "1.8"
152+
kotlinOptions.jvmTarget = "11"
119153
}
120154
compileTestKotlin {
121-
kotlinOptions.jvmTarget = "1.8"
155+
kotlinOptions.jvmTarget = "11"
122156
}
123157

124158
application {

database.txt

Lines changed: 135 additions & 133 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Wed Dec 04 13:11:58 MSK 2019
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
31
distributionBase=GRADLE_USER_HOME
42
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
64
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

src/main/kotlin/com/stepanov/bbf/Main.kt

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package com.stepanov.bbf
22

3+
import com.stepanov.bbf.bugfinder.manager.ReportProperties
34
import org.apache.commons.exec.*
45
import org.apache.commons.io.FileUtils
56
import java.io.File
67
import java.util.*
78

89

9-
const val COMMAND = "./gradlew runBBF"
10+
const val COMMAND = "gradle runBBF"
1011
val TIMEOUT_SEC = Properties()
1112
.also { it.load(File("bbf.conf").inputStream()) }
1213
.getProperty("BBF_TIMEOUT")?.toLongOrNull() ?: throw IllegalArgumentException("Can't init timeout value")
@@ -30,6 +31,12 @@ val TIMEOUT_SEC = Properties()
3031

3132
const val pathToErrorLogs = "tmp/results/errorLogs"
3233
fun main(args: Array<String>) {
34+
File("logs/stats.log").let { if (it.exists()) it.delete() }
35+
File("bugsPerMinute.txt").writeText("""
36+
Bugs: 0
37+
Time: 0
38+
Bugs per minute: 0.0
39+
""".trimIndent())
3340
val file = File(pathToErrorLogs)
3441
if (!file.exists()) file.mkdirs()
3542
//val dir = File(args[0]).listFiles()
@@ -68,11 +75,25 @@ fun main(args: Array<String>) {
6875

6976

7077
//if (joinedArgs.contains("-f") || joinedArgs.contains("--fuzzing")) {
78+
var globalCounter = 0L
7179
while (true) {
7280
println("Elapsed: $timeElapsed")
7381
if (handler.hasResult()) {
82+
if (timeElapsed > TIMEOUT_SEC * 1000) {
83+
var i = 0
84+
var newPath: String
85+
while (true) {
86+
newPath = "$pathToErrorLogs/logs$i"
87+
if (File(newPath).exists()) i++
88+
else break
89+
}
90+
val dstDir = File(newPath)
91+
dstDir.mkdirs()
92+
File("$dstDir/timeout").writeText("timeout")
93+
FileUtils.copyDirectory(File("logs"), dstDir)
94+
}
7495
//IF error then save logs
75-
if (handler.exitValue != 0) {
96+
else if (handler.exitValue != 0) {
7697
var i = 0
7798
var newPath: String
7899
while (true) {
@@ -98,12 +119,28 @@ fun main(args: Array<String>) {
98119
executor.execute(cmdLine, handler)
99120
timeElapsed = 0
100121
}
122+
globalCounter += 1000
123+
if ((globalCounter / 1000) % 60 == 0L) {
124+
if (ReportProperties.getPropAsBoolean("SAVE_STATS") == true) saveStats((globalCounter / 1000) / 60)
125+
}
101126
timeElapsed += 1000
102127
Thread.sleep(1000)
103128
}
104129
/*} else {
105130
while (true) {
106-
if (handler.hasResult()) System.exit(0)
131+
if (handler.hasRe sult()) System.exit(0)
107132
}
108133
} */
134+
}
135+
136+
private fun saveStats(timeElapsedInMinutes: Long) {
137+
val f = File("bugsPerMinute.txt")
138+
val curText = StringBuilder(f.readText())
139+
val bugs = curText.split("\n").first().split(": ").last().toInt()
140+
val newText = """
141+
Bugs: $bugs
142+
Time: $timeElapsedInMinutes
143+
Bugs per minute: ${bugs.toDouble() / timeElapsedInMinutes.toDouble()}
144+
""".trimIndent()
145+
f.writeText(newText)
109146
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Package Files #
11+
*.jar
12+
*.war
13+
*.nar
14+
*.ear
15+
*.zip
16+
*.tar.gz
17+
*.rar
18+
19+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
20+
hs_err_pid*
21+
*.kotlin_module
22+
/gradlew
23+
/gradlew.bat
24+
/build/
25+
/.gradle/
26+
/gradle/

src/main/kotlin/com/stepanov/bbf/bugfinder/AbiComparator/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/com/stepanov/bbf/bugfinder/AbiComparator/.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/com/stepanov/bbf/bugfinder/AbiComparator/.idea/gradle.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/com/stepanov/bbf/bugfinder/AbiComparator/.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/com/stepanov/bbf/bugfinder/AbiComparator/.idea/jarRepositories.xml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)