From b5dab03479a9d38f70fffc936e8276c9e51f858a Mon Sep 17 00:00:00 2001 From: Andrew Overholt Date: Fri, 3 Jun 2011 12:36:37 -0400 Subject: Don't run OProfile core tests on Hudson. The OProfile core tests require the OProfile kernel module to be loaded. Since we can't guarantee this will be the case on the Eclipse build infrastructure, we don't run these tests by default. The mechanism for excluding them is the same as the OProfile launch test suite.--- .../pom.xml | 3 +++ .../oprofile/core/tests/AllCoreTests.java | 4 ++++ .../oprofile/core/tests/CoreTestsPlugin.java | 11 ++++++++++- .../linuxtools/oprofile/core/tests/TestDummy.java | 22 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDummy.java diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/pom.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/pom.xml index cd4fced905..4e7ed81904 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/pom.xml +++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/pom.xml @@ -33,6 +33,9 @@ true false org.eclipse.sdk.ide + -Dorg.eclipse.linuxtools.oprofile.core.tests.runOprofile=no + org.eclipse.linuxtools.oprofile.core.tests + org.eclipse.linuxtools.oprofile.core.tests.AllCoreTests diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java index f89f6aa5fd..abba7d4491 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java @@ -18,11 +18,15 @@ public class AllCoreTests { public static Test suite() { TestSuite suite = new TestSuite("Test for org.eclipse.linuxtools.oprofile.core.tests"); //$NON-NLS-1$ + if (CoreTestsPlugin.RUN_OPROFILE) { suite.addTestSuite(TestModelDataParse.class); suite.addTestSuite(TestSessionsParse.class); suite.addTestSuite(TestCheckEventsParse.class); suite.addTestSuite(TestInfoParse.class); suite.addTestSuite(TestDataModel.class); + } + + suite.addTestSuite(TestDummy.class); return suite; } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java index dfc0de866f..551145de93 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. + * Copyright (c) 2009, 2011 Red Hat, Inc. * 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 @@ -18,6 +18,15 @@ import org.osgi.framework.BundleContext; */ public class CoreTestsPlugin extends Plugin { + /** + * Java system properties. + * usage: -Dorg.eclipse.linuxtools.oprofile.core.tests.runOprofile= [default: yes] + * if yes, will run the core tests + * no, will skip the core tests (they all require oOProfile to be set up) + */ + public static final String SYSTEM_PROPERTY_RUN_OPROFILE = "org.eclipse.linuxtools.oprofile.core.tests.runOprofile"; //$NON-NLS-1$ + public static final boolean RUN_OPROFILE = System.getProperty(SYSTEM_PROPERTY_RUN_OPROFILE, "yes").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$ + // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core.tests"; //$NON-NLS-1$ diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDummy.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDummy.java new file mode 100644 index 0000000000..b361c8bdd2 --- /dev/null +++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDummy.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2009 Red Hat, Inc. + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kent Sebastian - initial API and implementation + *******************************************************************************/ + +package org.eclipse.linuxtools.oprofile.core.tests; + +import junit.framework.TestCase; + +// Dummy test just so that the launch tests have something +// running when oprofile does not +public class TestDummy extends TestCase { + public void testPass() { + assertTrue(true); + } +} -- cgit v1.2.3