~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 * 
 
8
 * Contributors:
 
9
 *     Red Hat - initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.linuxtools.callgraph.launch.tests;
 
12
 
 
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;
 
18
 
 
19
 
 
20
 
 
21
 
 
22
public class LaunchShortcutsTest extends AbstractStapTest{
 
23
 
 
24
        /**
 
25
         * Checks that the scripts are correct/exist and that the expected 
 
26
         * command is sent.
 
27
         */
 
28
        
 
29
        @Override
 
30
        protected void setUp() throws Exception {
 
31
                super.setUp();
 
32
                proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
 
33
        }
 
34
        
 
35
        @Override
 
36
        protected void tearDown() throws Exception {
 
37
                deleteProject(proj);
 
38
                super.tearDown();
 
39
        }
 
40
        
 
41
        
 
42
        public void testLaunchCallGraph() {
 
43
                try {
 
44
                        SystemTapUIErrorMessages.setActive(false);
 
45
                        
 
46
                        LaunchStapGraph launch = new LaunchStapGraph();
 
47
                        launch.setTestMode(true);
 
48
                        
 
49
                        IBinary bin = proj.getBinaryContainer().getBinaries()[0];
 
50
                        launch.launch(bin, "profile");
 
51
                        String script = launch.getScript();
 
52
                        System.out.println(script);
 
53
                        
 
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())     }"));
 
57
 
 
58
                        
 
59
                        
 
60
                        } catch (Exception e) {
 
61
                                e.printStackTrace();
 
62
                        }
 
63
        }
 
64
 
 
65
        @Override
 
66
        protected Bundle getBundle() {
 
67
                return FrameworkUtil.getBundle(this.getClass());
 
68
        }
 
69
 
 
70
}