1
/*******************************************************************************
2
* Copyright (c) 2009 Red Hat, Inc.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Red Hat - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.linuxtools.callgraph.launch.tests;
13
import org.eclipse.cdt.core.model.IBinary;
14
import org.eclipse.linuxtools.internal.callgraph.core.SystemTapUIErrorMessages;
15
import org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph;
16
import org.osgi.framework.Bundle;
17
import org.osgi.framework.FrameworkUtil;
22
public class LaunchShortcutsTest extends AbstractStapTest{
25
* Checks that the scripts are correct/exist and that the expected
30
protected void setUp() throws Exception {
32
proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
36
protected void tearDown() throws Exception {
42
public void testLaunchCallGraph() {
44
SystemTapUIErrorMessages.setActive(false);
46
LaunchStapGraph launch = new LaunchStapGraph();
47
launch.setTestMode(true);
49
IBinary bin = proj.getBinaryContainer().getBinaries()[0];
50
launch.launch(bin, "profile");
51
String script = launch.getScript();
52
System.out.println(script);
54
assert(script.contains("probe process(@1).function(\"calledOnce\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledOnce\").return{ returnFunction(probefunc()) }"));
55
assert(script.contains("probe process(@1).function(\"calledTwice\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledTwice\").return{ returnFunction(probefunc()) }"));
56
assert(script.contains("probe process(@1).function(\"main\").call{ callFunction(probefunc()) } probe process(@1).function(\"main\").return{ returnFunction(probefunc()) }"));
60
} catch (Exception e) {
66
protected Bundle getBundle() {
67
return FrameworkUtil.getBundle(this.getClass());