Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 234192 Details for
Bug 414653
[test] intermittent failures in SwitchTest
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
instrumentation
eclipse.jdt.core.tests.compiler.patch (text/plain), 12.27 KB, created by
Stephan Herrmann
on 2013-08-08 07:33:38 EDT
(
hide
)
Description:
instrumentation
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2013-08-08 07:33:38 EDT
Size:
12.27 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java >index ea3d019..a356aac 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java >@@ -1084,7 +1084,8 @@ > expectedSuccessOutputString, > this.classpaths, > null, >- vmArguments); >+ vmArguments, >+ getClass().getName()+'_'+getName()); > assertTrue(this.verifier.failureReason, // computed by verifyClassFiles(...) action > passed); > if (vmArguments != null) { >@@ -2519,7 +2520,8 @@ > expectedErrorString, > this.classpaths, > null, >- vmArguments); >+ vmArguments, >+ getClass().getName()+'.'+getName()); > if (!passed) { > System.out.println(getClass().getName() + '#' + getName()); > String execErrorString = this.verifier.getExecutionError(); >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java >index de9ba93..c19e649 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java >@@ -146,7 +146,7 @@ > private String getVerifyTestsCode() { > return > "/*******************************************************************************\n" + >- " * Copyright (c) 2000, 2011 IBM Corporation and others.\n" + >+ " * Copyright (c) 2000, 2012 IBM Corporation and others.\n" + > " * All rights reserved. This program and the accompanying materials\n" + > " * are made available under the terms of the Eclipse Public License v1.0\n" + > " * which accompanies this distribution, and is available at\n" + >@@ -162,13 +162,17 @@ > "import java.io.File;\n" + > "import java.io.FileInputStream;\n" + > "import java.io.FileNotFoundException;\n" + >+ "import java.io.FileWriter;\n" + > "import java.io.IOException;\n" + > "import java.io.InputStream;\n" + >+ "import java.io.OutputStream;\n" + >+ "import java.io.Writer;\n" + > "import java.lang.reflect.InvocationTargetException;\n" + > "import java.lang.reflect.Method;\n" + > "import java.net.ServerSocket;\n" + > "import java.net.Socket;\n" + > "import java.util.StringTokenizer;\n" + >+ "\n" + > "\n" + > "/******************************************************\n" + > " *\n" + >@@ -181,6 +185,7 @@ > " int portNumber;\n" + > " Socket socket;\n" + > "\n" + >+ " Writer logFile;\n" + > "/**\n" + > " * NOTE: Code copied from junit.util.TestCaseClassLoader.\n" + > " *\n" + >@@ -230,7 +235,6 @@ > " while (st.hasMoreTokens()) {\n" + > " this.pathItems[i++]= st.nextToken();\n" + > " }\n" + >- "\n" + > " }\n" + > " public java.net.URL getResource(String name) {\n" + > " return ClassLoader.getSystemResource(name);\n" + >@@ -339,8 +343,15 @@ > " throw e.getTargetException();\n" + > " }\n" + > "}\n" + >+ "\n" + >+ "VerifyTests(String testName) {\n" + >+ " try {\n" + >+ " logFile = new FileWriter(new File(\"/tmp/test\"+testName+\".log\"));\n" + >+ " } catch (IOException e) {\n" + >+ " }\n" + >+ "}\n" + > "public static void main(String[] args) throws IOException {\n" + >- " VerifyTests verify = new VerifyTests();\n" + >+ " VerifyTests verify = new VerifyTests(args[1]);\n" + > " verify.portNumber = Integer.parseInt(args[0]);\n" + > " verify.run();\n" + > "}\n" + >@@ -351,17 +362,30 @@ > " server.close();\n" + > "\n" + > " DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" + >- " final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());\n" + >+ " final OutputStream outputStream = this.socket.getOutputStream();\n" + >+ " final DataOutputStream out = new DataOutputStream(outputStream);\n" + > " while (true) {\n" + > " final String className = in.readUTF();\n" + > " Thread thread = new Thread() {\n" + > " public void run() {\n" + > " try {\n" + >+ " logFile.write(className+\" \"+socket.isClosed()+\"\\n\");\n" + >+ " logFile.flush();\n" + > " loadAndRun(className);\n" + >+ " VerifyTests.this.logFile.write(\"\\t \\t-> \"+socket.isClosed()+\"\\n\");\n" + >+ " logFile.flush();\n" + > " out.writeBoolean(true);\n" + >+ " VerifyTests.this.logFile.write(\"\\t true\\t->\"+socket.isClosed()+\"\\n\");\n" + >+ " logFile.flush();\n" + > " System.err.println(VerifyTests.class.getName());\n" + > " System.out.println(VerifyTests.class.getName());\n" + > " } catch (Throwable e) {\n" + >+ " try {\n" + >+ " logFile.write(\"Exception: \"+e);\n" + >+ " logFile.flush();\n" + >+ " } catch (IOException e2) {\n" + >+ " // nop\n" + >+ " }\n" + > " e.printStackTrace();\n" + > " try {\n" + > " System.err.println(VerifyTests.class.getName());\n" + >@@ -373,6 +397,7 @@ > " }\n" + > " try {\n" + > " out.flush();\n" + >+ " logFile.flush();\n" + > " } catch (IOException e) {\n" + > " e.printStackTrace();\n" + > " }\n" + >@@ -381,7 +406,7 @@ > " thread.start();\n" + > " }\n" + > "}\n" + >- "}"; >+ "}\n"; > } > private void launchAndRun(String className, String[] classpaths, String[] programArguments, String[] vmArguments) { > // we won't reuse the vm, shut the existing one if running >@@ -450,7 +475,7 @@ > } catch (InterruptedException e) { > } > } >-private void launchVerifyTestsIfNeeded(String[] classpaths, String[] vmArguments) { >+private void launchVerifyTestsIfNeeded(String[] classpaths, String[] vmArguments, String testName) { > // determine if we can reuse the vm > if (this.vm != null && this.vm.isRunning() && this.classpathCache != null) { > if (classpaths.length == this.classpathCache.length) { >@@ -497,7 +522,7 @@ > } > launcher.setProgramClass(VerifyTests.class.getName()); > int portNumber = Util.getFreePort(); >- launcher.setProgramArguments(new String[] {Integer.toString(portNumber)}); >+ launcher.setProgramArguments(new String[] {Integer.toString(portNumber), testName}); > try { > this.vm = launcher.launch(); > final InputStream input = this.vm.getInputStream(); >@@ -608,22 +633,22 @@ > * Verify that the class files created for the given test file can be loaded by > * a virtual machine. > */ >-public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths) { >- return verifyClassFiles(sourceFilePath, className, expectedSuccessOutputString, "", classpaths, null, null); >+public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String testName) { >+ return verifyClassFiles(sourceFilePath, className, expectedSuccessOutputString, "", classpaths, null, null, testName); > } > /** > * Verify that the class files created for the given test file can be loaded by > * a virtual machine. > */ >-public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments) { >- return verifyClassFiles(sourceFilePath, className, expectedSuccessOutputString, "", classpaths, programArguments, vmArguments); >+public boolean verifyClassFiles(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments, String testName) { >+ return verifyClassFiles(sourceFilePath, className, expectedSuccessOutputString, "", classpaths, programArguments, vmArguments, testName); > } > public boolean verifyClassFiles(String sourceFilePath, String className, String expectedOutputString, >- String expectedErrorStringStart, String[] classpaths, String[] programArguments, String[] vmArguments) { >+ String expectedErrorStringStart, String[] classpaths, String[] programArguments, String[] vmArguments, String testName) { > this.outputBuffer = new StringBuffer(); > this.errorBuffer = new StringBuffer(); > if (this.reuseVM && programArguments == null) { >- launchVerifyTestsIfNeeded(classpaths, vmArguments); >+ launchVerifyTestsIfNeeded(classpaths, vmArguments, testName); > loadAndRun(className); > } else { > launchAndRun(className, classpaths, programArguments, vmArguments); >@@ -637,11 +662,11 @@ > * Verify that the class files created for the given test file can be loaded and run with an expected error contained > * in the expectedSuccessOutputString string. > */ >-public boolean verifyClassFilesThrowingError(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments) { >+public boolean verifyClassFilesThrowingError(String sourceFilePath, String className, String expectedSuccessOutputString, String[] classpaths, String[] programArguments, String[] vmArguments, String testName) { > this.outputBuffer = new StringBuffer(); > this.errorBuffer = new StringBuffer(); > if (this.reuseVM && programArguments == null) { >- launchVerifyTestsIfNeeded(classpaths, vmArguments); >+ launchVerifyTestsIfNeeded(classpaths, vmArguments, testName); > loadAndRun(className); > } else { > launchAndRun(className, classpaths, programArguments, vmArguments); >diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java >index d36baa0..084cf37 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java >@@ -15,13 +15,17 @@ > import java.io.File; > import java.io.FileInputStream; > import java.io.FileNotFoundException; >+import java.io.FileWriter; > import java.io.IOException; > import java.io.InputStream; >+import java.io.OutputStream; >+import java.io.Writer; > import java.lang.reflect.InvocationTargetException; > import java.lang.reflect.Method; > import java.net.ServerSocket; > import java.net.Socket; > import java.util.StringTokenizer; >+ > > /****************************************************** > * >@@ -34,6 +38,7 @@ > int portNumber; > Socket socket; > >+ Writer logFile; > /** > * NOTE: Code copied from junit.util.TestCaseClassLoader. > * >@@ -83,7 +88,6 @@ > while (st.hasMoreTokens()) { > this.pathItems[i++]= st.nextToken(); > } >- > } > public java.net.URL getResource(String name) { > return ClassLoader.getSystemResource(name); >@@ -192,8 +196,15 @@ > throw e.getTargetException(); > } > } >+ >+VerifyTests(String testName) { >+ try { >+ logFile = new FileWriter(new File("/tmp/test"+testName+".log")); >+ } catch (IOException e) { >+ } >+} > public static void main(String[] args) throws IOException { >- VerifyTests verify = new VerifyTests(); >+ VerifyTests verify = new VerifyTests(args[1]); > verify.portNumber = Integer.parseInt(args[0]); > verify.run(); > } >@@ -204,17 +215,30 @@ > server.close(); > > DataInputStream in = new DataInputStream(this.socket.getInputStream()); >- final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream()); >+ final OutputStream outputStream = this.socket.getOutputStream(); >+ final DataOutputStream out = new DataOutputStream(outputStream); > while (true) { > final String className = in.readUTF(); > Thread thread = new Thread() { > public void run() { > try { >+ logFile.write(className+" "+socket.isClosed()+"\n"); >+ logFile.flush(); > loadAndRun(className); >+ VerifyTests.this.logFile.write("\t \t-> "+socket.isClosed()+"\n"); >+ logFile.flush(); > out.writeBoolean(true); >+ VerifyTests.this.logFile.write("\t true\t->"+socket.isClosed()+"\n"); >+ logFile.flush(); > System.err.println(VerifyTests.class.getName()); > System.out.println(VerifyTests.class.getName()); > } catch (Throwable e) { >+ try { >+ logFile.write("Exception: "+e); >+ logFile.flush(); >+ } catch (IOException e2) { >+ // nop >+ } > e.printStackTrace(); > try { > System.err.println(VerifyTests.class.getName()); >@@ -226,6 +250,7 @@ > } > try { > out.flush(); >+ logFile.flush(); > } catch (IOException e) { > e.printStackTrace(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 414653
: 234192 |
237650
|
238801