mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
Patch for Vladimir Hirsl.
This patch adds some missing source folders to the ui.tests library.
This commit is contained in:
parent
b73e87b69b
commit
d45de32ff5
13 changed files with 229 additions and 42 deletions
|
@ -4,11 +4,11 @@
|
|||
<classpathentry kind="src" path="ui/"/>
|
||||
<classpathentry kind="src" path="core/"/>
|
||||
<classpathentry kind="src" path="model/"/>
|
||||
<classpathentry kind="src" path="build"/>
|
||||
<classpathentry kind="src" path="parser"/>
|
||||
<classpathentry kind="src" path="failures"/>
|
||||
<classpathentry kind="src" path="build/"/>
|
||||
<classpathentry kind="src" path="parser/"/>
|
||||
<classpathentry kind="src" path="failures/"/>
|
||||
<classpathentry kind="src" path="suite/"/>
|
||||
<classpathentry kind="src" path="/org.apache.xerces"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.cdt.core"/>
|
||||
|
@ -20,8 +20,7 @@
|
|||
<classpathentry kind="src" path="/org.eclipse.swt"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.ui"/>
|
||||
<classpathentry kind="src" path="/org.junit"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.update.core"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" path="suite"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
<project>org.eclipse.core.runtime</project>
|
||||
<project>org.eclipse.swt</project>
|
||||
<project>org.eclipse.ui</project>
|
||||
<project>org.eclipse.update.core</project>
|
||||
<project>org.junit</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
Added testPointersToMembers() and testPointersToMemberFunctions() to DOMTests.
|
||||
Added testBug36290() and testBug36931() to DOMTests.
|
||||
|
||||
2003-06-16 Vladimir Hirsl
|
||||
Added /build, /parser, /failures and /suite directories to the library.
|
||||
Copied resources from /model/org.eclipse.cdt.core.model.tests.resources
|
||||
to /model/org/clipse/cdt/core/model/tests/resources/cmodel.
|
||||
Added class AISResultPrinter to format test results.
|
||||
Class AutomatedIntegrationSuite now implements IPlatformRunnable.
|
||||
|
||||
2003-06-13 John Camelon
|
||||
Added Class/Base infrastructure to public interfaces & requestor callback.
|
||||
Moved many internal interfaces to external packages.
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
source.cdtuitests.jar = src/,\
|
||||
ui/,\
|
||||
core/,\
|
||||
model/
|
||||
ui/,\
|
||||
core/,\
|
||||
model/,\
|
||||
build/,\
|
||||
parser/,\
|
||||
failures/,\
|
||||
suite/
|
||||
bin.includes = plugin.xml,\
|
||||
about.html,\
|
||||
plugin.properties,\
|
||||
test.xml
|
||||
about.html
|
||||
src.includes = plugin.xml,\
|
||||
about.html,\
|
||||
plugin.properties,\
|
||||
test.xml
|
||||
|
||||
about.html =
|
||||
|
|
|
@ -29,7 +29,7 @@ public class IIncludeTests extends IntegratedCModelTest {
|
|||
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
|
||||
*/
|
||||
public String getSourcefileSubdir() {
|
||||
return "model/org.eclipse.cdt.core.model.tests.resources/";
|
||||
return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public class IMacroTests extends IntegratedCModelTest {
|
|||
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
|
||||
*/
|
||||
public String getSourcefileSubdir() {
|
||||
return "model/org.eclipse.cdt.core.model.tests.resources/";
|
||||
return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
* @see org.eclipse.cdt.internal.core.model.IntegratedCModelTest
|
||||
*/
|
||||
public String getSourcefileSubdir() {
|
||||
return "model/org.eclipse.cdt.core.model.tests.resources/";
|
||||
return "model/org/eclipse/cdt/core/model/tests/resources/cmodel/";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
// include
|
||||
#include <stdio.h>
|
||||
#include "whatever.h"
|
||||
#include <src/slash.h>
|
||||
#include <src\backslash.h>
|
||||
#include "Program Files/space.h"
|
||||
#include "../up1dir.h"
|
||||
#include "./samedir.h"
|
||||
#include "different_extension1.hpp"
|
||||
#include "different_extension2.hh"
|
||||
#include "different_extension3.x"
|
||||
#include <no_extension>
|
||||
# include "whitespace_after_hash"
|
||||
#include "whitespace_before_hash"
|
||||
|
||||
// failure cases:
|
||||
#include garbage
|
||||
#include "resync_after_bad_parse_1"
|
||||
#include
|
||||
#include "resync_after_bad_parse_2"
|
||||
#include "one" "two" "three"
|
||||
#include "resync_after_bad_parse_3"
|
||||
|
||||
// from the Spec:
|
||||
|
||||
// from [C, 6.10.p8]
|
||||
// should fail
|
||||
#define EMPTY
|
||||
EMPTY #include "invalid.h"
|
||||
|
||||
// from [C, 6.10.2.p8]:
|
||||
// should equal #include "myInclude1.h"
|
||||
#define MYINCFILE "myInclude1.h"
|
||||
#include MYINCFILE
|
||||
|
||||
// from [C, 6.10.3.5.p6]:
|
||||
// should equal #include "vers2.h"
|
||||
#define INCFILE(x) vers ## x
|
||||
#define xstr(x) str(x)
|
||||
#define str(x) #x
|
||||
#include xstr(INCFILE(2)).h
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// macro
|
||||
#define SINGLETON
|
||||
#define NUMBER 1
|
||||
#define PRINT(string,msg) printf(string, msg)
|
|
@ -0,0 +1,4 @@
|
|||
// IStructure
|
||||
struct foo {
|
||||
int bar;
|
||||
};
|
|
@ -2,7 +2,7 @@
|
|||
<plugin
|
||||
id="org.eclipse.cdt.ui.tests"
|
||||
name="org.eclipse.cdt.ui.tests"
|
||||
version="1.1.0"
|
||||
version="1.2.0.5"
|
||||
class="org.eclipse.cdt.testplugin.CTestPlugin">
|
||||
|
||||
<runtime>
|
||||
|
@ -12,7 +12,6 @@
|
|||
</runtime>
|
||||
<requires>
|
||||
<import plugin="org.apache.xerces"/>
|
||||
<import plugin="org.eclipse.core.boot"/>
|
||||
<import plugin="org.eclipse.core.resources"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.cdt.core"/>
|
||||
|
@ -20,7 +19,6 @@
|
|||
<import plugin="org.eclipse.swt"/>
|
||||
<import plugin="org.eclipse.ui"/>
|
||||
<import plugin="org.junit"/>
|
||||
<import plugin="org.eclipse.update.core"/>
|
||||
</requires>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Created on Jun 5, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
package org.eclipse.cdt.core.suite;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
import junit.textui.ResultPrinter;
|
||||
|
||||
/**
|
||||
* @author vhirsl
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class AISResultPrinter extends ResultPrinter {
|
||||
|
||||
/**
|
||||
* @param writer
|
||||
*/
|
||||
public AISResultPrinter(PrintStream writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError)
|
||||
*/
|
||||
public void addFailure(Test test, AssertionFailedError t) {
|
||||
super.addFailure(test, t);
|
||||
getWriter().print("---> ");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
|
||||
*/
|
||||
public void addError(Test test, Throwable t) {
|
||||
super.addError(test, t);
|
||||
getWriter().print("---> ");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestListener#startTest(junit.framework.Test)
|
||||
*/
|
||||
public void startTest(Test test) {
|
||||
getWriter().print(".");
|
||||
}
|
||||
|
||||
}
|
|
@ -12,8 +12,12 @@ import junit.framework.TestSuite;
|
|||
import junit.framework.TestResult;
|
||||
import junit.framework.TestListener;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.core.boot.IPlatformRunnable;
|
||||
|
||||
import org.eclipse.cdt.core.build.managed.tests.AllBuildTests;
|
||||
import org.eclipse.cdt.core.model.tests.AllCoreTests;
|
||||
|
@ -30,13 +34,11 @@ import org.eclipse.cdt.core.model.failedTests.*;
|
|||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class AutomatedIntegrationSuite extends TestSuite implements TestListener {
|
||||
public class AutomatedIntegrationSuite extends TestSuite
|
||||
implements TestListener, IPlatformRunnable {
|
||||
|
||||
private TestResult testResult = null;
|
||||
private String currentTestName;
|
||||
// Statistical information
|
||||
private int numberOfRuns = 0;
|
||||
private int numberOfFailures = 0;
|
||||
private int numberOfErrors = 0;
|
||||
// success tests
|
||||
private int numberOfSuccessTests = 0;
|
||||
private int numberOfFailedSuccessTests = 0;
|
||||
|
@ -65,6 +67,9 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
public static Test suite() {
|
||||
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
|
||||
|
||||
// First test to trigger report generation
|
||||
suite.addTest(suite.new GenerateReport("startSuccessTests"));
|
||||
|
||||
// Add all success tests
|
||||
suite.addTest(AllBuildTests.suite());
|
||||
suite.addTest(ParserTestSuite.suite());
|
||||
|
@ -93,6 +98,8 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
* Overloaded method
|
||||
*/
|
||||
public void run(TestResult result) {
|
||||
// To get counts from the result
|
||||
testResult = result;
|
||||
// Add oneself as a listener
|
||||
result.addListener(this);
|
||||
// Call a base class method
|
||||
|
@ -106,27 +113,25 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
* An error occurred.
|
||||
*/
|
||||
public void addError(Test test, Throwable t) {
|
||||
++numberOfErrors;
|
||||
System.out.println("Error : " + test);
|
||||
System.out.println("\tReason : " + t);
|
||||
System.out.println("\tStack trace : ");
|
||||
t.printStackTrace(System.out);
|
||||
// System.out.println("Error : " + test);
|
||||
// System.out.println("\tReason : " + t);
|
||||
// System.out.println("\tStack trace : ");
|
||||
// t.printStackTrace(System.out);
|
||||
}
|
||||
/**
|
||||
* A failure occurred.
|
||||
*/
|
||||
public void addFailure(Test test, AssertionFailedError t) {
|
||||
++numberOfFailures;
|
||||
if (failedTests) {
|
||||
++numberOfFailedFailedTests;
|
||||
}
|
||||
else {
|
||||
++numberOfFailedSuccessTests;
|
||||
}
|
||||
System.out.println("Failure : " + test);
|
||||
System.out.println("\tReason : " + t);
|
||||
System.out.println("\tStackTrace : ");
|
||||
t.printStackTrace(System.out);
|
||||
// System.out.println("Failure : " + test);
|
||||
// System.out.println("\tReason : " + t);
|
||||
// System.out.println("\tStackTrace : ");
|
||||
// t.printStackTrace(System.out);
|
||||
}
|
||||
/**
|
||||
* A test ended.
|
||||
|
@ -140,15 +145,14 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
skipTest = false;
|
||||
}
|
||||
else {
|
||||
++numberOfRuns;
|
||||
if (failedTests) {
|
||||
++numberOfFailedTests;
|
||||
System.out.println(test);
|
||||
// System.out.println(test);
|
||||
}
|
||||
else {
|
||||
++numberOfSuccessTests;
|
||||
}
|
||||
// System.out.println(test);
|
||||
System.out.println(test);
|
||||
}
|
||||
currentTestName = null;
|
||||
}
|
||||
|
@ -174,11 +178,17 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
protected void generateReport() {
|
||||
System.out.println("\n*** Generating report: ***\n");
|
||||
int numberOfRuns = testResult.runCount();
|
||||
int numberOfFailures = testResult.failureCount();
|
||||
int numberOfErrors = testResult.errorCount();
|
||||
|
||||
System.out.println();
|
||||
System.out.println("*** Generating report: ***");
|
||||
System.out.println();
|
||||
System.out.println("\tNumber of runs: " + numberOfRuns);
|
||||
System.out.println("\tNumber of failures: " + numberOfFailures);
|
||||
System.out.println("\tNumber of errors: " + numberOfErrors);
|
||||
float successRate = (numberOfRuns-numberOfFailures)/(float)numberOfRuns;
|
||||
float successRate = (numberOfRuns-numberOfFailures-numberOfErrors)/(float)numberOfRuns;
|
||||
DecimalFormat df = new DecimalFormat("##.##%");
|
||||
System.out.println("Sanity success rate : " + df.format(successRate));
|
||||
System.out.println("\tNumber of success tests: " + numberOfSuccessTests);
|
||||
|
@ -189,12 +199,23 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
(float)(numberOfSuccessTests+numberOfFailedTests-numberOfFailedFailedTests);
|
||||
System.out.print("Observed success test rate : " + df.format(successRate));
|
||||
System.out.println(" (failed success tests = " + numberOfFailedSuccessTests + ", failed failed tests = " + numberOfFailedFailedTests + ")");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private void startFailedTests() {
|
||||
failedTests = true;
|
||||
System.out.println("\n*** Starting failed tests ***\n");
|
||||
}
|
||||
private void startSuccessTests() {
|
||||
failedTests = false;
|
||||
System.out.println();
|
||||
System.out.println("*** Starting success tests ***");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private void startFailedTests() {
|
||||
failedTests = true;
|
||||
System.out.println();
|
||||
System.out.println("*** Starting failed tests ***");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
/*
|
||||
* Public inner class to invoke generateReport
|
||||
*
|
||||
|
@ -217,6 +238,14 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
AutomatedIntegrationSuite.this.generateReport();
|
||||
}
|
||||
|
||||
public void startSuccessTests() {
|
||||
// skip this one
|
||||
AutomatedIntegrationSuite.this.skipTest = true;
|
||||
|
||||
// Calls a method of the outer class
|
||||
AutomatedIntegrationSuite.this.startSuccessTests();
|
||||
}
|
||||
|
||||
public void startFailedTests() {
|
||||
// skip this one
|
||||
AutomatedIntegrationSuite.this.skipTest = true;
|
||||
|
@ -224,5 +253,54 @@ public class AutomatedIntegrationSuite extends TestSuite implements TestListener
|
|||
// Calls a method of the outer class
|
||||
AutomatedIntegrationSuite.this.startFailedTests();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.Test#countTestCases()
|
||||
* We don't want these test cases to be counted
|
||||
*/
|
||||
public int countTestCases() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.boot.IPlatformRunnable#run(java.lang.Object)
|
||||
*/
|
||||
public Object run(Object args) throws Exception {
|
||||
// Used when started from as a regression test suite after the build
|
||||
TestRunner testRunner = new TestRunner(new AISResultPrinter(System.out));
|
||||
TestResult testResult = testRunner.doRun(suite());
|
||||
|
||||
return prepareReport(testResult);
|
||||
}
|
||||
|
||||
protected ArrayList prepareReport(TestResult testResult) {
|
||||
// TestRunner.run(suite());
|
||||
ArrayList efMessages = new ArrayList();
|
||||
int errorCount = testResult.errorCount();
|
||||
int failureCount = testResult.failureCount();
|
||||
if (errorCount > 0) {
|
||||
String em = new String("There ");
|
||||
em += (errorCount == 1)?"is ":"are ";
|
||||
em += Integer.toString(errorCount);
|
||||
em += " error";
|
||||
em += (errorCount == 1)?"!":"s!";
|
||||
efMessages.add(em);
|
||||
}
|
||||
if (failureCount > 0) {
|
||||
String fm = new String("There ");
|
||||
fm += (failureCount == 1)?"is ":"are ";
|
||||
fm += Integer.toString(failureCount);
|
||||
fm += " failure";
|
||||
fm += (failureCount == 1)?"!":"s!";
|
||||
efMessages.add(fm);
|
||||
}
|
||||
if (efMessages.isEmpty()) {
|
||||
efMessages.add(new String("Regression test run SUCCESSFUL!"));
|
||||
}
|
||||
else {
|
||||
efMessages.add(new String("Please see raw test suite output for details."));
|
||||
}
|
||||
return efMessages;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue