Skip to content

Commit

Permalink
Merge branch 'master' into feature/runtime_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Aug 5, 2020
2 parents ce583aa + 1af8d9f commit 4540211
Show file tree
Hide file tree
Showing 516 changed files with 9,414 additions and 7,450 deletions.
26 changes: 26 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,29 @@ To get realistic results, you should exercise care when running benchmarks. Here
* Blindly believe the numbers that your microbenchmark produces but verify them by measuring e.g. with `-prof perfasm`.
* Run more threads than your number of CPU cores (in case you run multi-threaded microbenchmarks).
* Look only at the `Score` column and ignore `Error`. Instead take countermeasures to keep `Error` low / variance explainable.

## Disassembling

Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and FCML's `hsdis`.
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. FCML is a little more involved. This worked
on 2020-08-01:

```
wget https://github.com/swojtasiak/fcml-lib/releases/download/v1.2.2/fcml-1.2.2.tar.gz
tar xf fcml*
cd fcml*
./configure
make
cd example/hsdis
make
cp .libs/libhsdis.so.0.0.0
sudo cp .libs/libhsdis.so.0.0.0 /usr/lib/jvm/java-14-adoptopenjdk/lib/hsdis-amd64.so
```

If you want to disassemble a single method do something like this:

```
gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,*.yourMethodName -XX:PrintAssemblyOptions=intel"
```

If you want `perf` to find the hot methods for you then do add `-prof:perfasm`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.
*/

package org.elasticsearch.gradle

import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome

class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {

def "can configure nonInputProperties for test tasks"() {
given:
file("src/test/java/acme/SomeTests.java").text = """
public class SomeTests {
@org.junit.Test
public void testSysInput() {
org.junit.Assert.assertEquals("bar", System.getProperty("foo"));
}
}
"""
buildFile.text = """
plugins {
id 'java'
id 'elasticsearch.test-base'
}
repositories {
jcenter()
}
dependencies {
testImplementation 'junit:junit:4.12'
}
tasks.named('test').configure {
nonInputProperties.systemProperty("foo", project.getProperty('foo'))
}
"""

when:
def result = gradleRunner("test", '-Dtests.seed=default', '-Pfoo=bar').build()

then:
result.task(':test').outcome == TaskOutcome.SUCCESS

when:
result = gradleRunner("test", '-i', '-Dtests.seed=default', '-Pfoo=baz').build()

then:
result.task(':test').outcome == TaskOutcome.UP_TO_DATE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ abstract class AbstractGradleFuncTest extends Specification{
return input.readLines().join("\n")
}

File file(String path) {
File newFile = new File(testProjectDir.root, path)
newFile.getParentFile().mkdirs()
newFile
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class RestTestsFromSnippetsTask extends SnippetsTask {
case 'basic':
case 'gold':
case 'platinum':
case 'enterprise':
current.println(" - xpack")
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.elasticsearch.gradle.test.RestTestBasePlugin
import org.elasticsearch.gradle.testclusters.RunTask
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.util.Util
Expand Down Expand Up @@ -54,7 +55,7 @@ class PluginBuildPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.pluginManager.apply(BuildPlugin)
project.pluginManager.apply(TestClustersPlugin)
project.pluginManager.apply(RestTestBasePlugin)
project.pluginManager.apply(CompileOnlyResolvePlugin.class);

PluginPropertiesExtension extension = project.extensions.create(PLUGIN_EXTENSION_NAME, PluginPropertiesExtension, project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RestTestPlugin implements Plugin<Project> {
+ 'requires either elasticsearch.build or '
+ 'elasticsearch.standalone-rest-test')
}

project.getPlugins().apply(RestTestBasePlugin.class);
project.pluginManager.apply(TestClustersPlugin)
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
integTest.description = 'Runs rest tests against an elasticsearch cluster.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
project.pluginManager.apply(JavaBasePlugin)
project.pluginManager.apply(TestClustersPlugin)
project.pluginManager.apply(RepositoriesSetupPlugin)
project.pluginManager.apply(RestTestBasePlugin)

project.getTasks().register("buildResources", ExportElasticsearchBuildResourcesTask)
ElasticsearchJavaPlugin.configureTestTasks(project)
ElasticsearchJavaPlugin.configureInputNormalization(project)
ElasticsearchJavaPlugin.configureCompile(project)


project.extensions.getByType(JavaPluginExtension).sourceCompatibility = BuildParams.minimumRuntimeVersion
project.extensions.getByType(JavaPluginExtension).targetCompatibility = BuildParams.minimumRuntimeVersion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask;
import org.elasticsearch.gradle.precommit.ForbiddenPatternsTask;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask;
import org.elasticsearch.gradle.testclusters.TestClustersAware;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.Util;
Expand Down Expand Up @@ -57,7 +56,7 @@ public void apply(Project project) {

// Tell the tests we're running with ssl enabled
project.getTasks()
.withType(RestTestRunnerTask.class)
.withType(RestIntegTestTask.class)
.configureEach(runner -> runner.systemProperty("tests.ssl.enabled", "true"));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ public Iterator<File> iterator() {
return configuration.iterator();
}

// TODO: remove this when distro tests are per distribution
public Configuration getConfiguration() {
return configuration;
}

// internal, make this distribution's configuration unmodifiable
void finalizeValues() {

Expand Down
Loading

0 comments on commit 4540211

Please sign in to comment.