Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F1DFF200D28 for ; Mon, 23 Oct 2017 12:26:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E9C7B1609E0; Mon, 23 Oct 2017 10:26:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 132BB1609CE for ; Mon, 23 Oct 2017 12:26:43 +0200 (CEST) Received: (qmail 11120 invoked by uid 500); 23 Oct 2017 10:26:43 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 11110 invoked by uid 99); 23 Oct 2017 10:26:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Oct 2017 10:26:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5B580DFC8B; Mon, 23 Oct 2017 10:26:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Date: Mon, 23 Oct 2017 10:26:40 -0000 Message-Id: <79d4a811d6734b0fbcfda31ca7e91703@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] groovy git commit: some JDK9 test fixes archived-at: Mon, 23 Oct 2017 10:26:45 -0000 Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X c5299d974 -> 7f7da9985 some JDK9 test fixes Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5c6e5407 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5c6e5407 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5c6e5407 Branch: refs/heads/GROOVY_2_6_X Commit: 5c6e5407261fd00eed48274c5612b51e711d6048 Parents: c5299d9 Author: paulk Authored: Mon Oct 23 14:54:02 2017 +1000 Committer: paulk Committed: Mon Oct 23 20:16:33 2017 +1000 ---------------------------------------------------------------------- src/test/gls/annotations/AnnotationTest.groovy | 10 +++++++--- src/test/groovy/execute/ExecuteTest.groovy | 16 ++++++++++++---- .../m12n/ExtensionModuleHelperForTests.groovy | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/5c6e5407/src/test/gls/annotations/AnnotationTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/gls/annotations/AnnotationTest.groovy b/src/test/gls/annotations/AnnotationTest.groovy index 504f0e8..fae832d 100644 --- a/src/test/gls/annotations/AnnotationTest.groovy +++ b/src/test/gls/annotations/AnnotationTest.groovy @@ -712,7 +712,11 @@ class AnnotationTest extends CompilableTestSupport { import java.lang.annotation.* class MyClass { - private static final expected = '@MyAnnotationArray(value=[@MyAnnotation(value=val1), @MyAnnotation(value=val2)])' + // TODO confirm the JDK9 behavior is what we expect + private static final List expected = [ + '@MyAnnotationArray(value=[@MyAnnotation(value=val1), @MyAnnotation(value=val2)])', // JDK5-8 + '@MyAnnotationArray(value={@MyAnnotation(value="val1"), @MyAnnotation(value="val2")})' // JDK9 + ] // control @MyAnnotationArray([@MyAnnotation("val1"), @MyAnnotation("val2")]) @@ -727,8 +731,8 @@ class AnnotationTest extends CompilableTestSupport { MyClass myc = new MyClass() assert 'method1' == myc.method1() assert 'method2' == myc.method2() - assert checkAnnos(myc, "method1") == expected - assert checkAnnos(myc, "method2") == expected + assert expected.contains(checkAnnos(myc, "method1")) + assert expected.contains(checkAnnos(myc, "method2")) } private static String checkAnnos(MyClass myc, String name) { http://git-wip-us.apache.org/repos/asf/groovy/blob/5c6e5407/src/test/groovy/execute/ExecuteTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/execute/ExecuteTest.groovy b/src/test/groovy/execute/ExecuteTest.groovy index 8d29f15..78d9a9a 100644 --- a/src/test/groovy/execute/ExecuteTest.groovy +++ b/src/test/groovy/execute/ExecuteTest.groovy @@ -20,8 +20,6 @@ package groovy.execute /** * Cross platform tests for the DGM#execute() family of methods. - * - * @author Paul King */ class ExecuteTest extends GroovyTestCase { private String getCmd() { @@ -68,12 +66,17 @@ class ExecuteTest extends GroovyTestCase { } void testExecuteCommandLineProcessAndUseWaitForOrKill() { - String[] java = [System.getProperty('java.home') + "/bin/java", + List javaArgs = [System.getProperty('java.home') + "/bin/java", "-classpath", System.getProperty('java.class.path'), "groovy.ui.GroovyMain", "-e", "sleep(2000); println('Done'); System.exit(0)"] + if (System.getProperty('java.specification.version') >= '9') { + javaArgs.add(3, '--add-modules') + javaArgs.add(4, 'ALL-SYSTEM') + } + String[] java = javaArgs.toArray() println "Executing this command for two cases:\n${java.join(' ')}" StringBuffer sbout = new StringBuffer() StringBuffer sberr = new StringBuffer() @@ -115,12 +118,17 @@ class ExecuteTest extends GroovyTestCase { } void testExecuteCommandLineWithEnvironmentProperties() { - String[] java = [System.getProperty('java.home') + "/bin/java", + List javaArgs = [System.getProperty('java.home') + "/bin/java", "-classpath", System.getProperty('java.class.path'), "groovy.ui.GroovyMain", "-e", "println(System.getenv('foo'))"] + if (System.getProperty('java.specification.version') >= '9') { + javaArgs.add(3, '--add-modules') + javaArgs.add(4, 'ALL-SYSTEM') + } + String[] java = javaArgs.toArray() println "Executing this command:\n${java.join(' ')}" def props = ["foo=bar"] StringBuffer sbout = new StringBuffer() http://git-wip-us.apache.org/repos/asf/groovy/blob/5c6e5407/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy ---------------------------------------------------------------------- diff --git a/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy b/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy index 859f1cd..6eaefbe 100644 --- a/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy +++ b/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy @@ -80,7 +80,7 @@ public class ExtensionModuleHelperForTests { baseDir.deleteDir() if (err && !allowed.any{ err.trim().matches(it) }) { throw new RuntimeException("$err\nClasspath: ${cp.join('\n')}") - } else if ( out.contains('FAILURES') || ! out.contains("OK")) { + } else if (out && out.contains('FAILURES') || ! out.contains("OK")) { throw new RuntimeException("$out\nClasspath: ${cp.join('\n')}") } }