Skip to main content
summaryrefslogtreecommitdiffstats
blob: 381f111ac14607e1f5ddd6db5b9b40ec4caddad0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * 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:
 *     Red Hat - initial API and implementation
 *******************************************************************************/
package org.eclipse.linuxtools.systemtap.local.launch.tests;

import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.linuxtools.systemtap.local.core.SystemTapUIErrorMessages;
import org.eclipse.linuxtools.systemtap.local.launch.LaunchStapGraph;
import org.osgi.framework.Bundle;




public class LaunchShortcutsTest extends AbstractStapTest{

	/**
	 * Checks that the scripts are correct/exist and that the expected 
	 * command is sent.
	 */
	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
	}
	
	@Override
	protected void tearDown() throws Exception {
		deleteProject(proj);
		super.tearDown();
	}
	
	
	public void testLaunchCallGraph() {
		try {
			SystemTapUIErrorMessages.setActive(false);
			
			LaunchStapGraph launch = new LaunchStapGraph();
			launch.setTestMode(true);
			
			IBinary bin = proj.getBinaryContainer().getBinaries()[0];
			launch.launch(bin, "profile");
			String script = launch.getScript();
			System.out.println(script);
			
			assert(script.contains("probe process(@1).function(\"calledOnce\").call{	callFunction(probefunc())	}	probe process(@1).function(\"calledOnce\").return{		returnFunction(probefunc())	}"));
			assert(script.contains("probe process(@1).function(\"calledTwice\").call{	callFunction(probefunc())	}	probe process(@1).function(\"calledTwice\").return{		returnFunction(probefunc())	}"));
			assert(script.contains("probe process(@1).function(\"main\").call{	callFunction(probefunc())	}	probe process(@1).function(\"main\").return{		returnFunction(probefunc())	}"));

			
			
			} catch (Exception e) {
				e.printStackTrace();
			}
	}

	@Override
	protected Bundle getBundle() {
		return Activator.getDefault().getBundle();
	}

}

Back to the top