diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java index 29e9c8df562..7d0a1767764 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java @@ -64,7 +64,7 @@ public class PreprocessorSpeedTest { "#include \n"; CodeReader reader = new CodeReader(code.toCharArray()); - IScannerInfo info = msvcScannerInfo(); + IScannerInfo info = getScannerInfo(); long totalTime = 0; for (int i = 0; i < n; ++i) { long time = testScan(reader, false, info, ParserLanguage.CPP); @@ -111,7 +111,34 @@ public class PreprocessorSpeedTest { return totalTime; } - protected IScannerInfo msvcScannerInfo() { + protected IScannerInfo getScannerInfo() { + String config = System.getProperty("speedTest.config"); + + if (config == null) + return mingwScannerInfo(); + + if (config.equals("msvc")) + return msvcScannerInfo(); + else if (config.equals("msvc98")) + return msvc98ScannerInfo(); + else if (config.equals("ydl")) + return ydlScannerInfo(); + else + return mingwScannerInfo(); + } + + private IScannerInfo msvcScannerInfo() { + Map definitions = new Hashtable(); + //definitions.put( "__GNUC__", "3" ); //$NON-NLS-1$ //$NON-NLS-2$ + + String [] includePaths = new String[] { + "C:\\Program Files\\Microsoft SDK\\Include", + "C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include" + }; + return new ScannerInfo( definitions, includePaths ); + } + + protected IScannerInfo msvc98ScannerInfo() { Map definitions = new Hashtable(); String [] includePaths = new String[] { "C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include" diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/Scanner2SpeedTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/DOMScannerSpeedTest.java similarity index 91% rename from core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/Scanner2SpeedTest.java rename to core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/DOMScannerSpeedTest.java index 9b0fabac317..09323702c2c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/Scanner2SpeedTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/DOMScannerSpeedTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,13 +7,8 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ -/* - * Created on Jun 8, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ package org.eclipse.cdt.core.parser.tests.scanner2; import java.io.FileOutputStream; @@ -36,7 +31,7 @@ import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner; * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ -public class Scanner2SpeedTest extends SpeedTest2 { +public class DOMScannerSpeedTest extends SpeedTest2 { private static final ISourceElementRequestor CALLBACK = new NullSourceElementRequestor(); private PrintStream stream; @@ -47,7 +42,7 @@ public class Scanner2SpeedTest extends SpeedTest2 { if (args.length > 0) stream = new PrintStream(new FileOutputStream(args[0])); - new Scanner2SpeedTest().runTest(stream, 1); + new DOMScannerSpeedTest().runTest(stream, 30); } catch (Exception e) { System.out.println(e); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/SpeedTest2.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/SpeedTest2.java index 19a458a56c7..7ab81c33091 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/SpeedTest2.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/SpeedTest2.java @@ -116,6 +116,8 @@ public class SpeedTest2 extends TestCase { if (config.equals("msvc")) return msvcScannerInfo(false); + else if (config.equals("msvc98")) + return msvc98ScannerInfo(false); else if (config.equals("ydl")) return ydlScannerInfo(false); else @@ -137,6 +139,17 @@ public class SpeedTest2 extends TestCase { return new ScannerInfo( definitions, includePaths ); } + private IScannerInfo msvc98ScannerInfo(boolean quick) { + if( quick ) + return new ScannerInfo(); + Map definitions = new Hashtable(); + + String [] includePaths = new String[] { + "C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include" + }; + return new ScannerInfo( definitions, includePaths ); + } + private IScannerInfo mingwScannerInfo(boolean quick) { // TODO It would be easier and more flexible if we used discovery for this if( quick )