You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2019/06/01 17:10:55 UTC

[lucene-solr] 01/01: SOLR-13452: First pass at a testTimes target.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 2ab989d24615ea735f4e8fc172eb49e5571b409c
Author: markrmiller <ma...@apache.org>
AuthorDate: Sat Jun 1 12:10:46 2019 -0500

    SOLR-13452: First pass at a testTimes target.
---
 build.gradle                                       |  7 +++
 buildSrc/build.gradle                              |  2 +
 .../groovy/org/apache/lucene/gradle/JUnit4.groovy  | 53 ++++++++++++++++++++++
 3 files changed, 62 insertions(+)

diff --git a/build.gradle b/build.gradle
index 44dea47..e6f801a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,6 +28,8 @@ def luceneSolrSubProjects = subprojects.findAll { project -> project.name != 'bu
 
 def rootProjectDir = project.rootProject.projectDir;
 
+ant.lifecycleLogLevel = "INFO"
+
 // TOC
 // -> lucene-solr all project config
 // -> lucene-solr sub module config
@@ -131,6 +133,11 @@ configure(rootProject) {
   // TODO: enable the modified files checking only for jenkins runs! sysprop?
   tasks.create('checkWorkingCopy', CheckWorkingCopy, false)
   
+  
+  task testTimes(type: org.apache.lucene.gradle.JUnit4) {
+
+  }
+  
 }
 
 // -> lucene-solr IDE config - setup eclipse and idea
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 12b0c2e..7ce819e 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -43,6 +43,7 @@ dependencies {
 configurations {
   jflex
   rat
+  junit4
   
   jflex.extendsFrom implementation
 }
@@ -52,6 +53,7 @@ configurations {
 dependencies {
   jflex "de.jflex:jflex:1.7.0"
   rat "org.apache.rat:apache-rat:0.11"
+  junit4 "com.carrotsearch.randomizedtesting:junit4-ant"
 }
 
 sourceSets {
diff --git a/buildSrc/src/main/groovy/org/apache/lucene/gradle/JUnit4.groovy b/buildSrc/src/main/groovy/org/apache/lucene/gradle/JUnit4.groovy
new file mode 100644
index 0000000..cbdba68
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/lucene/gradle/JUnit4.groovy
@@ -0,0 +1,53 @@
+package org.apache.lucene.gradle
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.
+ */
+import org.gradle.api.DefaultTask
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.Optional
+import org.gradle.api.tasks.InputDirectory
+import org.gradle.api.tasks.InputFile
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.api.tasks.TaskAction
+
+class JUnit4 extends DefaultTask {
+  
+  
+  @TaskAction
+  void execute() {
+    def listMax = 10
+
+    ant.taskdef(classname: 'com.carrotsearch.ant.tasks.junit4.balancers.TopHints',
+    name: 'topHints',
+    classpath: project.project(":buildSrc").configurations.junit4.asPath)
+    
+    
+    println "Showing ${listMax} slowest tests according to local stats. (change with -Dmax=...)."
+    ant.topHints(max: listMax) {
+      println "cache: ${project.rootProject.projectDir}/.caches/test-stats"
+      ant.fileset(dir: "${project.rootProject.projectDir}/.caches/test-stats") {
+        ant.include(name: "**/*.txt")
+      }
+    }
+    
+    println"Showing ${listMax} slowest tests in cached stats. (change with -Dmax=...)."
+    ant.topHints(max: listMax) {
+      ant.fileset(dir: "${project.rootProject.projectDir}/lucene/tools/junit4", includes: "*.txt")
+    }
+  }
+}
+
+