-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathbuild.gradle
More file actions
138 lines (121 loc) · 5.23 KB
/
Copy pathbuild.gradle
File metadata and controls
138 lines (121 loc) · 5.23 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* Copyright Consensys Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
import de.undercouch.gradle.tasks.download.Download
plugins {
id 'jacoco'
alias(libs.plugins.besuPluginLibrary)
alias(libs.plugins.lombok)
}
jacoco {
toolVersion = libs.versions.jacoco.get()
}
def lineaTracerProject = project(lineaTracerProjectPath)
apply from: lineaTracerProject.file("gradle/java.gradle")
apply from: lineaTracerProject.file("gradle/lint.gradle")
configurations.configureEach {
exclude module: 'log4j-api'
exclude module: 'log4j-core'
exclude module: 'log4j-slf4j2-impl'
}
tasks.register("downloadExecutionSpecFixtures", Download) {
src "https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz"
dest "./build/fixtures_develop.tar.gz"
overwrite false
}
tasks.register("copyExecutionSpecFixtures", Copy) {
dependsOn "downloadExecutionSpecFixtures"
//
from tarTree("./build/fixtures_develop.tar.gz")
into "./build/execution-spec-tests"
}
tasks.register("generateExecutionSpecBlockchainTests", RefTestGenerationTask) {
dependsOn "copyExecutionSpecFixtures"
// Configure task
refTestTemplateFilePath = "src/test/resources/templates/BlockchainReferenceTest.java.template"
refTests = "./build/execution-spec-tests/fixtures/blockchain_tests"
refTestsSrcPath = "./build/execution-spec-tests/"
refTestJsonParamsDirectory = "fixtures"
refTestJsonParamsExcludedPath = "blockchain_tests_engine_x" // exclude test for test filling tool
refTestNamePrefix = "BlockchainReferenceTest"
generatedRefTestsOutput = "src/test/java/net/consensys/linea/generated/blockchain"
failedTestsFilePath = System.getenv('FAILED_TEST_JSON_DIRECTORY') ?: "../tmp/local/"
failedModule = System.getenv('FAILED_MODULE') ?: ""
failedConstraint = System.getenv('FAILED_CONSTRAINT') ?: ""
}
// Added to fix the state root parallelization disabling for ref tests that triggered a StackOverflow error
// This mimics the JVM args used in the linea-tracer plugin's test task, to exclude // on besu side "'-Xss4m',"
tasks.withType(Test).configureEach {
minHeapSize = "256m"
maxHeapSize = System.getenv().containsKey("CI") ? "32g" : "8g"
jvmArgs = [
// '-XX:-UseGCOverheadLimit',
// '-Xlog:gc',
// Mockito and jackson-databind do some strange reflection during tests.
// This suppresses an illegal access warning.
'-Xss4m',
'--add-opens',
'java.base/java.util=ALL-UNNAMED',
'--add-opens',
'java.base/java.util.concurrent=ALL-UNNAMED'
]
}
tasks.register('referenceExecutionSpecBlockchainTests', Test) {
// Gradle 9: custom Test tasks must explicitly wire the test source set
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
finalizedBy(jacocoReferenceExecutionSpecBlockchainTestsReport)
description = 'Runs ETH reference blockchain tests.'
dependsOn generateExecutionSpecBlockchainTests
environment.put("REFERENCE_TEST_OUTCOME_OUTPUT_FILE", "BlockchainReferenceTestOutcome.json")
it.configure {
// Configure resource limits
boolean isCiServer = System.getenv().containsKey("CI")
minHeapSize = "256m"
maxHeapSize = isCiServer ? "32g" : "8g"
// Configure parallelism
environment.put("blockchain", System.getenv("blockchain") ?: "Ethereum")
systemProperty("junit.jupiter.execution.timeout.default", "30 m")
systemProperty("junit.jupiter.execution.parallel.enabled", "true")
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
systemProperty("junit.jupiter.execution.parallel.config.strategy", "fixed")
systemProperty("junit.jupiter.execution.parallel.config.fixed.parallelism",
System.getenv().getOrDefault("JUNIT_TESTS_PARALLELISM", "1").toInteger())
// override set number of forks
maxParallelForks = 1
}
useJUnitPlatform {
includeTags("BlockchainReferenceTest")
}
}
tasks.register("jacocoReferenceExecutionSpecBlockchainTestsReport", JacocoReport) {
reports {
xml.required = true
}
sourceSets project(":tracer:arithmetization").sourceSets.main
executionData(referenceExecutionSpecBlockchainTests)
}
// Gradle 9: fail if no tests discovered is now the default; disable for this module
// since tests are generated from fixtures and only run via referenceExecutionSpecBlockchainTests
tasks.named('test') {
failOnNoDiscoveredTests = false
}
dependencies {
implementation project(':tracer:arithmetization')
implementation project(':tracer:testing')
implementation 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
}