diff options
author | Alexander Kurtakov | 2013-05-10 14:20:35 +0000 |
---|---|---|
committer | Camilo Bernal | 2013-05-10 16:30:52 +0000 |
commit | bc07d87b5637f8f130734842bec1441cc9b45a0d (patch) | |
tree | 254e5c0a72f1fd74d936b61b428af8e0f6ec87ad | |
parent | e12eec03cb2da3c83fe5c90ae9a31b979c7ada84 (diff) | |
download | org.eclipse.linuxtools-bc07d87b5637f8f130734842bec1441cc9b45a0d.tar.gz org.eclipse.linuxtools-bc07d87b5637f8f130734842bec1441cc9b45a0d.tar.xz org.eclipse.linuxtools-bc07d87b5637f8f130734842bec1441cc9b45a0d.zip |
valgrind: empty fail() in tests are bad.
In case it fail you have no idea why it failed from the junit logs.
Replaced a number of them with asserts with messages so the reasong for
the failure is logged.
Change-Id: I6d3dc6773f43ebfac910dbdacbffdb0903a69f1f
Reviewed-on: https://git.eclipse.org/r/12709
Tested-by: Hudson CI
Reviewed-by: Camilo Bernal <cabernal@redhat.com>
IP-Clean: Camilo Bernal <cabernal@redhat.com>
Tested-by: Camilo Bernal <cabernal@redhat.com>
14 files changed, 576 insertions, 574 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.settings/org.eclipse.jdt.core.prefs b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.settings/org.eclipse.jdt.core.prefs index f15f655388..6bfd78aee4 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.settings/org.eclipse.jdt.core.prefs +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,90 @@ -#Thu Mar 12 10:51:52 EDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/LaunchConfigTabTest.java index e5f272e32a..440302943f 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/LaunchConfigTabTest.java @@ -27,11 +27,11 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class LaunchConfigTabTest extends AbstractCachegrindTest { - + protected ILaunchConfiguration config; protected Shell testShell; protected ValgrindOptionsTab tab; - protected CachegrindToolPage dynamicTab; + protected CachegrindToolPage dynamicTab; @Override protected void setUp() throws Exception { @@ -52,7 +52,7 @@ public class LaunchConfigTabTest extends AbstractCachegrindTest { deleteProject(proj); super.tearDown(); } - + private ILaunchConfigurationWorkingCopy initConfig() throws CoreException { ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); tab.setDefaults(wc); @@ -64,7 +64,7 @@ public class LaunchConfigTabTest extends AbstractCachegrindTest { this.dynamicTab = (CachegrindToolPage) dynamicTab; return wc; } - + private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) throws Exception { tab.performApply(wc); @@ -73,114 +73,98 @@ public class LaunchConfigTabTest extends AbstractCachegrindTest { ILaunch launch = doLaunch(config, testName); return launch; } - - public void testDefaults() throws Exception { + + public void testDefaults() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=cachegrind")); //$NON-NLS-1$ - assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ - assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ - - assertTrue(cmd.contains("--cache-sim=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--branch-sim=no")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--tool=cachegrind")); //$NON-NLS-1$ + assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("-q")); //$NON-NLS-1$ + assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ + assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ + assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ + assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ + assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ + assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ + + assertTrue(cmd.contains("--cache-sim=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--branch-sim=no")); //$NON-NLS-1$ } - - public void testNoSim() throws Exception { + + public void testNoSim() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getCacheButton().setSelection(false); tab.performApply(wc); wc.doSave(); - + assertFalse(tab.isValid(config)); } - + public void testBranchSim() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getBranchButton().setSelection(true); tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testBranchSim"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--branch-sim=yes")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--branch-sim=yes")); //$NON-NLS-1$ } - + public void testI1Cache() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getI1SizeSpinner().isEnabled()); dynamicTab.getI1Button().setSelection(true); dynamicTab.getI1Button().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getI1SizeSpinner().isEnabled()); - + dynamicTab.getI1SizeSpinner().setSelection(16384); dynamicTab.getI1AssocSpinner().setSelection(1); dynamicTab.getI1LineSizeSpinner().setSelection(16); - + tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testI1Cache"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--I1=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertTrue(cmd.contains("--I1=16384,1,16")); //$NON-NLS-1$ } - + public void testD1Cache() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getD1SizeSpinner().isEnabled()); dynamicTab.getD1Button().setSelection(true); dynamicTab.getD1Button().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getD1SizeSpinner().isEnabled()); - + dynamicTab.getD1SizeSpinner().setSelection(16384); dynamicTab.getD1AssocSpinner().setSelection(1); dynamicTab.getD1LineSizeSpinner().setSelection(16); - + tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testD1Cache"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--D1=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertTrue(cmd.contains("--D1=16384,1,16")); //$NON-NLS-1$ } - + public void testL2Cache() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); @@ -198,13 +182,9 @@ public class LaunchConfigTabTest extends AbstractCachegrindTest { ILaunch launch = saveAndLaunch(wc, "testL2Cache"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--L2=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertTrue(cmd.contains("--L2=16384,1,16")); //$NON-NLS-1$ } } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/.settings/org.eclipse.jdt.core.prefs b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/.settings/org.eclipse.jdt.core.prefs index f15f655388..6bfd78aee4 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/.settings/org.eclipse.jdt.core.prefs +++ b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,90 @@ -#Thu Mar 12 10:51:52 EDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 diff --git a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/helgrind/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/helgrind/tests/LaunchConfigTabTest.java index 8853ff0988..c433f3c701 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/helgrind/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/helgrind/tests/LaunchConfigTabTest.java @@ -26,11 +26,11 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class LaunchConfigTabTest extends AbstractHelgrindTest { - + protected ILaunchConfiguration config; protected Shell testShell; protected ValgrindOptionsTab tab; - protected HelgrindToolPage dynamicTab; + protected HelgrindToolPage dynamicTab; @Override protected void setUp() throws Exception { @@ -51,7 +51,7 @@ public class LaunchConfigTabTest extends AbstractHelgrindTest { deleteProject(proj); super.tearDown(); } - + private ILaunchConfigurationWorkingCopy initConfig() throws CoreException { ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); tab.setDefaults(wc); @@ -63,7 +63,7 @@ public class LaunchConfigTabTest extends AbstractHelgrindTest { this.dynamicTab = (HelgrindToolPage) dynamicTab; return wc; } - + private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) throws Exception { tab.performApply(wc); @@ -72,98 +72,76 @@ public class LaunchConfigTabTest extends AbstractHelgrindTest { ILaunch launch = doLaunch(config, testName); return launch; } - - public void testDefaults() throws Exception { + + public void testDefaults() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=helgrind")); //$NON-NLS-1$ - assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--track-lockorders=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--history-level=full")); //$NON-NLS-1$ - assertTrue(cmd.contains("--conflict-cache-size=1000000")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--tool=helgrind")); //$NON-NLS-1$ + assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("-q")); //$NON-NLS-1$ + assertTrue(cmd.contains("--track-lockorders=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--history-level=full")); //$NON-NLS-1$ + assertTrue(cmd.contains("--conflict-cache-size=1000000")); //$NON-NLS-1$ } - - public void testTrackLockorders() throws Exception { + + public void testTrackLockorders() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getLockordersButton().setSelection(false); tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--track-lockorders=no")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--track-lockorders=no")); //$NON-NLS-1$ } - - public void testHistoryNone() throws Exception { + + public void testHistoryNone() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getHistoryCombo().setText("none"); tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--history-level=none")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--history-level=none")); //$NON-NLS-1$ } - - public void testHistoryApprox() throws Exception { + + public void testHistoryApprox() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getHistoryCombo().setText("approx"); tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--history-level=approx")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--history-level=approx")); //$NON-NLS-1$ } - - public void testConflictCacheSize() throws Exception { + + public void testConflictCacheSize() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + dynamicTab.getCacheSizeSpinner().setSelection(123456); tab.performApply(wc); wc.doSave(); - + ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--conflict-cache-size=123456")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--conflict-cache-size=123456")); //$NON-NLS-1$ } - - } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.settings/org.eclipse.jdt.core.prefs b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.settings/org.eclipse.jdt.core.prefs index 1fb509677d..bbd3ae214b 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.settings/org.eclipse.jdt.core.prefs +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.settings/org.eclipse.jdt.core.prefs @@ -46,7 +46,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartExportTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartExportTest.java index f78922c490..ab7d27c013 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartExportTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartExportTest.java @@ -27,40 +27,37 @@ public class ChartExportTest extends AbstractMassifTest { protected void setUp() throws Exception { super.setUp(); proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - + pngPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); assertNotNull(pngPath); pngPath = pngPath.append("alloctest").append("chart.png"); //$NON-NLS-1$ //$NON-NLS-2$ } - + @Override protected void tearDown() throws Exception { File chartFile = pngPath.toFile(); if (chartFile.exists()) { chartFile.delete(); } - + deleteProject(proj); super.tearDown(); } - + public void testChartExportPNG() throws Exception { ILaunchConfiguration config = createConfiguration(proj.getProject()); doLaunch(config, "testDefaults"); //$NON-NLS-1$ - + IEditorInput input = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput(); - if (input instanceof ChartEditorInput) { - HeapChart chart = ((ChartEditorInput) input).getChart(); - - ChartPNG png = new ChartPNG(chart); - png.renderPNG(pngPath); - - File chartFile = pngPath.toFile(); - assertTrue(chartFile.exists()); - assertTrue(chartFile.length() > 0); - } else { - fail(); - } + assertTrue("input must be ChartEditorInput", input instanceof ChartEditorInput); + HeapChart chart = ((ChartEditorInput) input).getChart(); + + ChartPNG png = new ChartPNG(chart); + png.renderPNG(pngPath); + + File chartFile = pngPath.toFile(); + assertTrue(chartFile.exists()); + assertTrue(chartFile.length() > 0); } - + } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/DoubleClickTest.java index 1ecbea69bf..99b05c2127 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/DoubleClickTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/DoubleClickTest.java @@ -31,7 +31,7 @@ public class DoubleClickTest extends AbstractMassifTest { @Override protected void setUp() throws Exception { super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ + proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ } @Override @@ -39,11 +39,11 @@ public class DoubleClickTest extends AbstractMassifTest { deleteProject(proj); super.tearDown(); } - + private void doDoubleClick() { MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); MassifTreeViewer treeViewer = view.getTreeViewer(); - + MassifSnapshot[] snapshots = view.getSnapshots(); node = snapshots[1].getRoot(); // first detailed TreePath path = new TreePath(new Object[] { node }); @@ -51,17 +51,14 @@ public class DoubleClickTest extends AbstractMassifTest { node = node.getChildren()[0]; path = path.createChildPath(node); } - if (node.hasSourceFile()) { - treeViewer.getViewer().expandToLevel(node, AbstractTreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - - // do double click - IDoubleClickListener listener = treeViewer.getDoubleClickListener(); - listener.doubleClick(new DoubleClickEvent(treeViewer.getViewer(), selection)); - } - else { - fail(); - } + assertTrue(node.hasSourceFile()); + treeViewer.getViewer().expandToLevel(node, + AbstractTreeViewer.ALL_LEVELS); + TreeSelection selection = new TreeSelection(path); + + // do double click + IDoubleClickListener listener = treeViewer.getDoubleClickListener(); + listener.doubleClick(new DoubleClickEvent(treeViewer.getViewer(), selection)); } public void testDoubleClickFile() throws Exception { @@ -70,9 +67,9 @@ public class DoubleClickTest extends AbstractMassifTest { wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2); wc.doSave(); doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$ - + doDoubleClick(); - + checkFile(proj.getProject(), node); } @@ -82,9 +79,9 @@ public class DoubleClickTest extends AbstractMassifTest { wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2); wc.doSave(); doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ - + doDoubleClick(); - + checkLine(node); } } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/LaunchConfigTabTest.java index ee8b27770f..ceb5e9ce7a 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/LaunchConfigTabTest.java @@ -27,12 +27,12 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class LaunchConfigTabTest extends AbstractMassifTest { - + protected ValgrindOptionsTab tab; protected MassifToolPage dynamicTab; protected ILaunchConfiguration config; protected Shell testShell; - + @Override protected void setUp() throws Exception { super.setUp(); @@ -64,7 +64,7 @@ public class LaunchConfigTabTest extends AbstractMassifTest { this.dynamicTab = (MassifToolPage) dynamicTab; return wc; } - + private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) throws Exception { tab.performApply(wc); @@ -73,181 +73,141 @@ public class LaunchConfigTabTest extends AbstractMassifTest { ILaunch launch = doLaunch(config, testName); return launch; } - - public void testDefaults() throws Exception { + + public void testDefaults() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=massif")); //$NON-NLS-1$ - assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ - assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ - - assertTrue(cmd.contains("--heap=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--heap-admin=8")); //$NON-NLS-1$ - assertTrue(cmd.contains("--stacks=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--alloc-fn")); //$NON-NLS-1$ - assertTrue(cmd.contains("--threshold=1.0")); //$NON-NLS-1$ - assertTrue(cmd.contains("--peak-inaccuracy=1.0")); //$NON-NLS-1$ - assertTrue(cmd.contains("--time-unit=i")); //$NON-NLS-1$ - assertTrue(cmd.contains("--detailed-freq=10")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-snapshots=100")); //$NON-NLS-1$ - assertFalse(cmd.contains("--alignment=")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--tool=massif")); //$NON-NLS-1$ + assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("-q")); //$NON-NLS-1$ + assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ + assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ + assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ + assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ + assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ + assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ + + assertTrue(cmd.contains("--heap=yes")); //$NON-NLS-1$ + assertTrue(cmd.contains("--heap-admin=8")); //$NON-NLS-1$ + assertTrue(cmd.contains("--stacks=no")); //$NON-NLS-1$ + assertFalse(cmd.contains("--alloc-fn")); //$NON-NLS-1$ + assertTrue(cmd.contains("--threshold=1.0")); //$NON-NLS-1$ + assertTrue(cmd.contains("--peak-inaccuracy=1.0")); //$NON-NLS-1$ + assertTrue(cmd.contains("--time-unit=i")); //$NON-NLS-1$ + assertTrue(cmd.contains("--detailed-freq=10")); //$NON-NLS-1$ + assertTrue(cmd.contains("--max-snapshots=100")); //$NON-NLS-1$ + assertFalse(cmd.contains("--alignment=")); //$NON-NLS-1$ } - - public void testHeap() throws Exception { + + public void testHeap() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getHeapButton().setSelection(false); ILaunch launch = saveAndLaunch(wc, "testHeap"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--heap=no")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--heap=no")); //$NON-NLS-1$ } - - public void testHeapAdmin() throws Exception { + + public void testHeapAdmin() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getHeapAdminSpinner().setSelection(30); ILaunch launch = saveAndLaunch(wc, "testHeapAdmin"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--heap-admin=30")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--heap-admin=30")); //$NON-NLS-1$ } - - public void testStacks() throws Exception { + + public void testStacks() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getStacksButton().setSelection(true); ILaunch launch = saveAndLaunch(wc, "testStacks"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--stacks=yes")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--stacks=yes")); //$NON-NLS-1$ } - - public void testDepth() throws Exception { + + public void testDepth() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getDepthSpinner().setSelection(50); ILaunch launch = saveAndLaunch(wc, "testDepth"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--depth=50")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--depth=50")); //$NON-NLS-1$ } - - public void testAllocFn() throws Exception { + + public void testAllocFn() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getAllocFnList().add("foo"); //$NON-NLS-1$ ILaunch launch = saveAndLaunch(wc, "testAllocFn"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ } - - public void testAllocFnMultiple() throws Exception { + + public void testAllocFnMultiple() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getAllocFnList().add("foo"); //$NON-NLS-1$ dynamicTab.getAllocFnList().add("bar"); //$NON-NLS-1$ ILaunch launch = saveAndLaunch(wc, "testAllocFnMultiple"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ - assertTrue(cmd.contains("--alloc-fn=bar")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ + assertTrue(cmd.contains("--alloc-fn=bar")); //$NON-NLS-1$ } - - public void testAllocFnSpace() throws Exception { + + public void testAllocFnSpace() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getAllocFnList().add("operator new(unsigned)"); //$NON-NLS-1$ ILaunch launch = saveAndLaunch(wc, "testAllocFnSpace"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=operator new(unsigned)")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--alloc-fn=operator new(unsigned)")); //$NON-NLS-1$ } - - public void testThreshold() throws Exception { + + public void testThreshold() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getThresholdSpinner().setSelection(20); ILaunch launch = saveAndLaunch(wc, "testThreshold"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--threshold=2.0")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--threshold=2.0")); //$NON-NLS-1$ } - - public void testPeakInaccuracy() throws Exception { + + public void testPeakInaccuracy() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getPeakInaccuracySpinner().setSelection(0); ILaunch launch = saveAndLaunch(wc, "testPeakInaccuracy"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--peak-inaccuracy=0.0")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--peak-inaccuracy=0.0")); //$NON-NLS-1$ } - - public void testTimeUnitBytes() throws Exception { + + public void testTimeUnitBytes() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String[] items = dynamicTab.getTimeUnitCombo().getItems(); int ix = -1; @@ -259,17 +219,13 @@ public class LaunchConfigTabTest extends AbstractMassifTest { dynamicTab.getTimeUnitCombo().select(ix); ILaunch launch = saveAndLaunch(wc, "testTimeUnitBytes"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--time-unit=B")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--time-unit=B")); //$NON-NLS-1$ } - - public void testTimeUnitMilliseconds() throws Exception { + + public void testTimeUnitMilliseconds() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String[] items = dynamicTab.getTimeUnitCombo().getItems(); int ix = -1; @@ -281,54 +237,42 @@ public class LaunchConfigTabTest extends AbstractMassifTest { dynamicTab.getTimeUnitCombo().select(ix); ILaunch launch = saveAndLaunch(wc, "testTimeUnitMilliseconds"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--time-unit=ms")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--time-unit=ms")); //$NON-NLS-1$ } - - public void testDetailedFreq() throws Exception { + + public void testDetailedFreq() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getDetailedFreqSpinner().setSelection(1); ILaunch launch = saveAndLaunch(wc, "testDetailedFreq"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--detailed-freq=1")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--detailed-freq=1")); //$NON-NLS-1$ } - - public void testMaxSnapshots() throws Exception { + + public void testMaxSnapshots() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getMaxSnapshotsSpinner().setSelection(200); ILaunch launch = saveAndLaunch(wc, "testMaxSpapshots"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--max-snapshots=200")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--max-snapshots=200")); //$NON-NLS-1$ } - + public void testAlignment() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getAlignmentSpinner().getEnabled()); dynamicTab.getAlignmentButton().setSelection(true); dynamicTab.getAlignmentButton().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getAlignmentSpinner().getEnabled()); - + dynamicTab.getAlignmentSpinner().setSelection(512); tab.performApply(wc); config = wc.doSave(); @@ -337,24 +281,20 @@ public class LaunchConfigTabTest extends AbstractMassifTest { ILaunch launch = doLaunch(config, "testAlignment"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ } public void testAlignmentBad() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getAlignmentSpinner().getEnabled()); dynamicTab.getAlignmentButton().setSelection(true); dynamicTab.getAlignmentButton().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getAlignmentSpinner().getEnabled()); - + dynamicTab.getAlignmentSpinner().setSelection(63); tab.performApply(wc); config = wc.doSave(); diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.settings/org.eclipse.jdt.core.prefs b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.settings/org.eclipse.jdt.core.prefs index ca7c45d1b1..bbd3ae214b 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.settings/org.eclipse.jdt.core.prefs +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.settings/org.eclipse.jdt.core.prefs @@ -4,8 +4,13 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -41,7 +46,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java index f179c2b310..d95f49fa45 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java @@ -79,73 +79,62 @@ public class DoubleClickTest extends AbstractMemcheckTest { doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$ doDoubleClick(); - + IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) { - IFileEditorInput fileInput = (IFileEditorInput) input; - File expectedFile = new File(proj.getProject().getLocation().toOSString(), frame.getFile()); - File actualFile = fileInput.getFile().getLocation().toFile(); - - assertEquals(expectedFile.getCanonicalPath(), actualFile.getCanonicalPath()); - } - else { - fail(); - } + + assertTrue("Input should be IFileEditorInput", + input instanceof IFileEditorInput); + IFileEditorInput fileInput = (IFileEditorInput) input; + File expectedFile = new File(proj.getProject().getLocation() + .toOSString(), frame.getFile()); + File actualFile = fileInput.getFile().getLocation().toFile(); + + assertEquals(expectedFile.getCanonicalPath(), actualFile.getCanonicalPath()); } - + public void testDoubleClickLine() throws Exception { ILaunchConfiguration config = createConfiguration(proj.getProject()); doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } + + IEditorPart editor = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + assertTrue("editor should be ITextEditor", + editor instanceof ITextEditor); + ITextEditor textEditor = (ITextEditor) editor; + + ISelection selection = textEditor.getSelectionProvider().getSelection(); + assertTrue("selection must be TextSelection", + selection instanceof TextSelection); + TextSelection textSelection = (TextSelection) selection; + int line = textSelection.getStartLine() + 1; // zero-indexed + + assertEquals(frame.getLine(), line); } - + public void testDoubleClickLaunchRemoved() throws Exception { ILaunchConfiguration config = createConfiguration(proj.getProject()); ILaunch launch = doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ - + // Remove launch - tests #284919 DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch); doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } + + IEditorPart editor = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + assertTrue("editor should be ITextEditor", + editor instanceof ITextEditor); + ITextEditor textEditor = (ITextEditor) editor; + + ISelection selection = textEditor.getSelectionProvider().getSelection(); + assertTrue("selection must be TextSelection", + selection instanceof TextSelection); + TextSelection textSelection = (TextSelection) selection; + int line = textSelection.getStartLine() + 1; // zero-indexed + + assertEquals(frame.getLine(), line); } } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java index d042141dd8..b30513f418 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java @@ -85,7 +85,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { return launch; } - public void testDefaults() throws Exception { + public void testDefaults() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); @@ -112,7 +112,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { assertTrue(cmd.contains("--workaround-gcc296-bugs=no")); //$NON-NLS-1$ assertTrue(cmd.contains("--partial-loads-ok=no")); //$NON-NLS-1$ assertTrue(cmd.contains("--undef-value-errors=yes")); //$NON-NLS-1$ - + // 3.4.0 specific IProject project = CDebugUtils.verifyCProject(wc).getProject(); Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(project); @@ -126,7 +126,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { } } - public void testWSSuppresions() throws Exception { + public void testWSSuppresions() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String text = "${workspace_loc:/basicTest/testsuppfile.supp}"; //$NON-NLS-1$ tab.getSuppFileList().add(text); @@ -158,7 +158,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { fail(); } } - + public void testSuppressionsMultiple() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile.supp")).getLocation(); //$NON-NLS-1$ @@ -301,12 +301,12 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { public void testAlignment() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getAlignmentSpinner().getEnabled()); dynamicTab.getAlignmentButton().setSelection(true); dynamicTab.getAlignmentButton().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getAlignmentSpinner().getEnabled()); - + dynamicTab.getAlignmentSpinner().setSelection(512); tab.performApply(wc); config = wc.doSave(); @@ -315,24 +315,20 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { ILaunch launch = doLaunch(config, "testAlignment"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ } public void testAlignmentBad() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); - + assertFalse(dynamicTab.getAlignmentSpinner().getEnabled()); dynamicTab.getAlignmentButton().setSelection(true); dynamicTab.getAlignmentButton().notifyListeners(SWT.Selection, null); assertTrue(dynamicTab.getAlignmentSpinner().getEnabled()); - + dynamicTab.getAlignmentSpinner().setSelection(63); tab.performApply(wc); config = wc.doSave(); @@ -345,63 +341,49 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { dynamicTab.getLeakCheckButton().setSelection(false); ILaunch launch = saveAndLaunch(wc, "testNoLeakCheck"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-check=no")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--leak-check=no")); //$NON-NLS-1$ } - + public void testShowReachable() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); dynamicTab.getShowReachableButton().setSelection(true); ILaunch launch = saveAndLaunch(wc, "testShowReachable"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--show-reachable=yes")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--show-reachable=yes")); //$NON-NLS-1$ } public void testLeakResolutionMed() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String[] opts = dynamicTab.getLeakResCombo().getItems(); - int ix = Arrays.asList(opts).indexOf(MemcheckLaunchConstants.LEAK_RES_MED); + int ix = Arrays.asList(opts).indexOf( + MemcheckLaunchConstants.LEAK_RES_MED); dynamicTab.getLeakResCombo().select(ix); ILaunch launch = saveAndLaunch(wc, "testLeakResolutionMed"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-resolution=med")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--leak-resolution=med")); //$NON-NLS-1$ } public void testLeakResolutionHigh() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String[] opts = dynamicTab.getLeakResCombo().getItems(); - int ix = Arrays.asList(opts).indexOf(MemcheckLaunchConstants.LEAK_RES_HIGH); + int ix = Arrays.asList(opts).indexOf( + MemcheckLaunchConstants.LEAK_RES_HIGH); dynamicTab.getLeakResCombo().select(ix); ILaunch launch = saveAndLaunch(wc, "testLeakResolutionHigh"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-resolution=high")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--leak-resolution=high")); //$NON-NLS-1$ } public void testFreeListVol() throws Exception { @@ -409,14 +391,10 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { dynamicTab.getFreelistSpinner().setSelection(2000000); ILaunch launch = saveAndLaunch(wc, "testFreeListVol"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--freelist-vol=2000000")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--freelist-vol=2000000")); //$NON-NLS-1$ } public void testWorkaroundGCCBugs() throws Exception { @@ -424,14 +402,10 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { dynamicTab.getGccWorkaroundButton().setSelection(true); ILaunch launch = saveAndLaunch(wc, "testWorkaroundGCCBugs"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--workaround-gcc296-bugs=yes")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--workaround-gcc296-bugs=yes")); //$NON-NLS-1$ } public void testPartialLoads() throws Exception { @@ -439,14 +413,10 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { dynamicTab.getPartialLoadsButton().setSelection(true); ILaunch launch = saveAndLaunch(wc, "testPartialLoads"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--partial-loads-ok=yes")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--partial-loads-ok=yes")); //$NON-NLS-1$ } public void testUndefValueErrors() throws Exception { @@ -454,20 +424,17 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { dynamicTab.getUndefValueButton().setSelection(false); ILaunch launch = saveAndLaunch(wc, "testUndefValueErrors"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--undef-value-errors=no")); //$NON-NLS-1$ - } - else { - fail(); - } + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--undef-value-errors=no")); //$NON-NLS-1$ } - + public void testMainStackSize() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IProject project = CDebugUtils.verifyCProject(wc).getProject(); - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(project); + Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion( + project); if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { assertFalse(tab.getMainStackSizeSpinner().isEnabled()); tab.getMainStackSizeButton().setSelection(true); @@ -476,43 +443,34 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { tab.getMainStackSizeSpinner().setSelection(2048); ILaunch launch = saveAndLaunch(wc, "testMainStackFrame"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--main-stacksize=2048")); //$NON-NLS-1$ - } - else { - fail(); - } - } - else { + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--main-stacksize=2048")); //$NON-NLS-1$ + } else { assertNull(tab.getMainStackSizeButton()); assertNull(tab.getMainStackSizeSpinner()); } } - + public void testTrackOrigins() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IProject project = CDebugUtils.verifyCProject(config).getProject(); - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(project); + Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion( + project); if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { dynamicTab.getTrackOriginsButton().setSelection(true); ILaunch launch = saveAndLaunch(wc, "testTrackOrigins"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--track-origins=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - else { + assertTrue("process array should not be empty", p.length > 0); + String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); + assertEquals(0, p[0].getExitValue()); + assertTrue(cmd.contains("--track-origins=yes")); //$NON-NLS-1$ + } else { assertNull(dynamicTab.getTrackOriginsButton()); } } - + public void testTrackOriginsValidity() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IProject project = CDebugUtils.verifyCProject(config).getProject(); @@ -539,9 +497,9 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { doLaunch(config, "testValgrindError"); //$NON-NLS-1$ ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindMessage[] messages = view.getMessages(); + IValgrindMessage[] messages = view.getMessages(); assertTrue(messages.length > 0); - + String text = messages[0].getText(); assertTrue(text.contains(notExistentFile)); } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java index 9184bb1309..0ed94b88b7 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java @@ -33,7 +33,7 @@ import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; -public class LinkedResourceDoubleClickTest extends AbstractLinkedResourceMemcheckTest { +public class LinkedResourceDoubleClickTest extends AbstractLinkedResourceMemcheckTest { private ValgrindStackFrame frame; public void testLinkedDoubleClickFile() throws Exception { @@ -41,49 +41,43 @@ public class LinkedResourceDoubleClickTest extends AbstractLinkedResourceMemchec doLaunch(config, "testLinkedDoubleClickFile"); //$NON-NLS-1$ doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + + IEditorPart editor = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) { - IFileEditorInput fileInput = (IFileEditorInput) input; - IFolder srcFolder = proj.getProject().getFolder("src"); //$NON-NLS-1$ - File expectedFile = new File(srcFolder.getLocation().toOSString(), frame.getFile()); - File actualFile = fileInput.getFile().getLocation().toFile(); - - assertTrue(fileInput.getFile().isLinked(IResource.CHECK_ANCESTORS)); - assertEquals(expectedFile.getCanonicalPath(), actualFile.getCanonicalPath()); - } - else { - fail(); - } + assertTrue("editor input must be file input", + input instanceof IFileEditorInput); + IFileEditorInput fileInput = (IFileEditorInput) input; + IFolder srcFolder = proj.getProject().getFolder("src"); //$NON-NLS-1$ + File expectedFile = new File(srcFolder.getLocation().toOSString(), + frame.getFile()); + File actualFile = fileInput.getFile().getLocation().toFile(); + + assertTrue(fileInput.getFile().isLinked(IResource.CHECK_ANCESTORS)); + assertEquals(expectedFile.getCanonicalPath(), + actualFile.getCanonicalPath()); } - + public void testLinkedDoubleClickLine() throws Exception { ILaunchConfiguration config = createConfiguration(proj.getProject()); doLaunch(config, "testLinkedDoubleClickLine"); //$NON-NLS-1$ doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } + + IEditorPart editor = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + assertTrue("editor must be text editor", editor instanceof ITextEditor); + ITextEditor textEditor = (ITextEditor) editor; + + ISelection selection = textEditor.getSelectionProvider().getSelection(); + assertTrue("selection must be text one", + selection instanceof TextSelection); + TextSelection textSelection = (TextSelection) selection; + int line = textSelection.getStartLine() + 1; // zero-indexed + + assertEquals(frame.getLine(), line); } - + private void doDoubleClick() { ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); CoreMessagesViewer viewer = view.getMessagesViewer(); diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/MinVersionTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/MinVersionTest.java index bd83d4ca46..d816071f09 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/MinVersionTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/MinVersionTest.java @@ -30,23 +30,23 @@ public class MinVersionTest extends AbstractMemcheckTest { return "valgrind-3.2.1"; //$NON-NLS-1$ } } - + @Override protected void setUp() throws Exception { super.setUp(); proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - + saveVersion(); } private void saveVersion() { ValgrindLaunchPlugin.getDefault().setValgrindCommand(new ValgrindIncorrectVersion()); } - + @Override protected void tearDown() throws Exception { restoreVersion(); - + deleteProject(proj); super.tearDown(); } @@ -54,29 +54,27 @@ public class MinVersionTest extends AbstractMemcheckTest { private void restoreVersion() { ValgrindLaunchPlugin.getDefault().setValgrindCommand(new ValgrindCommand()); } - + public void testLaunchBadVersion() throws Exception { // Put this back so we can make a valid config restoreVersion(); ILaunchConfiguration config = createConfiguration(proj.getProject()); // For some reason we downgraded saveVersion(); - - CoreException ce = null; + try { doLaunch(config, "testDefaults"); //$NON-NLS-1$ } catch (CoreException e) { - ce = e; + assertNotNull(e); } - - assertNotNull(ce); + } - + public void testTabsBadVersion() throws Exception { Shell testShell = new Shell(Display.getDefault()); testShell.setLayout(new GridLayout()); ValgrindOptionsTab tab = new ValgrindOptionsTab(); - + ILaunchConfiguration config = getLaunchConfigType().newInstance(null, getLaunchManager() .generateLaunchConfigurationName( proj.getProject().getName())); @@ -85,10 +83,10 @@ public class MinVersionTest extends AbstractMemcheckTest { tab.createControl(testShell); tab.initializeFrom(config); tab.performApply(wc); - + assertFalse(tab.isValid(config)); assertNotNull(tab.getErrorMessage()); - + testShell.dispose(); } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/SignalTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/SignalTest.java index 8e4b91dd70..1ed7808c75 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/SignalTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/SignalTest.java @@ -16,23 +16,23 @@ import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart; import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; public class SignalTest extends AbstractMemcheckTest { - + @Override protected void setUp() throws Exception { super.setUp(); proj = createProjectAndBuild("segvtest"); //$NON-NLS-1$ } - + @Override protected void tearDown() throws Exception { deleteProject(proj); super.tearDown(); } - + public void testSegfaultHandle() throws Exception { ILaunchConfiguration config = createConfiguration(proj.getProject()); doLaunch(config, "testSegfault"); //$NON-NLS-1$ - + ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); IValgrindMessage[] messages = view.getMessages(); assertTrue(messages.length > 0); |