diff options
Diffstat (limited to 'gcov')
46 files changed, 1950 insertions, 1950 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/pom.xml b/gcov/org.eclipse.linuxtools.gcov-feature/pom.xml index a0398234df..d94ec3c524 100644 --- a/gcov/org.eclipse.linuxtools.gcov-feature/pom.xml +++ b/gcov/org.eclipse.linuxtools.gcov-feature/pom.xml @@ -22,7 +22,7 @@ <packaging>eclipse-feature</packaging> <name>Linux Tools GCov Feature</name> - + <build> <plugins> <plugin> diff --git a/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml b/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml index 5e234505ab..daabd6c417 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml +++ b/gcov/org.eclipse.linuxtools.gcov.core/plugin.xml @@ -45,7 +45,7 @@ class="org.eclipse.linuxtools.internal.gcov.preferences.ColorPreferencesInitializer"> </initializer> </extension> - + <extension point="org.eclipse.ui.editors.markerAnnotationSpecification"> <specification diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/Activator.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/Activator.java index a2e1dc0cff..0c3744f4ff 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/Activator.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/Activator.java @@ -19,44 +19,44 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov.core"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov.core"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java index 395450aca8..9e084d2fd2 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/action/SwitchContentProviderAction.java @@ -18,28 +18,28 @@ import org.eclipse.linuxtools.internal.gcov.Activator; import org.eclipse.ui.plugin.AbstractUIPlugin; - /** - * This action changes the content provider - */ + /** + * This action changes the content provider + */ - public class SwitchContentProviderAction extends Action { + public class SwitchContentProviderAction extends Action { - private final ColumnViewer viewer; - private final IContentProvider provider; + private final ColumnViewer viewer; + private final IContentProvider provider; - public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider) { - super(name, AS_RADIO_BUTTON); - this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, iconPath)); - this.setToolTipText(name); - this.viewer = viewer; - this.provider = provider; - } + public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider) { + super(name, AS_RADIO_BUTTON); + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, iconPath)); + this.setToolTipText(name); + this.viewer = viewer; + this.provider = provider; + } - @Override - public void run() { - viewer.getControl().setRedraw(false); - viewer.setContentProvider(provider); - ((TreeViewer)viewer).expandToLevel(2); - viewer.getControl().setRedraw(true); - } - }
\ No newline at end of file + @Override + public void run() { + viewer.getControl().setRedraw(false); + viewer.setContentProvider(provider); + ((TreeViewer)viewer).expandToLevel(2); + viewer.getControl().setRedraw(true); + } + }
\ No newline at end of file diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/Messages.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/Messages.java index 8b8961aebd..dd402d2f85 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/Messages.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/dialog/Messages.java @@ -13,27 +13,27 @@ package org.eclipse.linuxtools.internal.gcov.dialog; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.dialog.messages"; //$NON-NLS-1$ - public static String OpenGCDialog_bin_browser_button_text; - public static String OpenGCDialog_bin_browser_fs_button_text; - public static String OpenGCDialog_bin_browser_handler_text; - public static String OpenGCDialog_no_bin_error_label; - public static String OpenGCDialog_bin_dne_error_label; - public static String OpenGCDialog_bin_group_header; - public static String OpenGCDialog_bin_group_label; - public static String OpenGCDialog_bin_group_tooltip; - public static String OpenGCDialog_coverage_mode_header; - public static String OpenGCDialog_coverage_mode_tooltip; - public static String OpenGCDialog_invalid_bin_error_title; - public static String OpenGCDialog_invalid_bin_error_message; - public static String OpenGCDialog_open_results; - public static String OpenGCDialog_summ_button_text; - public static String OpenGCDialog_open_file_button_text; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.dialog.messages"; //$NON-NLS-1$ + public static String OpenGCDialog_bin_browser_button_text; + public static String OpenGCDialog_bin_browser_fs_button_text; + public static String OpenGCDialog_bin_browser_handler_text; + public static String OpenGCDialog_no_bin_error_label; + public static String OpenGCDialog_bin_dne_error_label; + public static String OpenGCDialog_bin_group_header; + public static String OpenGCDialog_bin_group_label; + public static String OpenGCDialog_bin_group_tooltip; + public static String OpenGCDialog_coverage_mode_header; + public static String OpenGCDialog_coverage_mode_tooltip; + public static String OpenGCDialog_invalid_bin_error_title; + public static String OpenGCDialog_invalid_bin_error_message; + public static String OpenGCDialog_open_results; + public static String OpenGCDialog_summ_button_text; + public static String OpenGCDialog_open_file_button_text; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - } + private Messages() { + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java index de4eb6a664..d1b4784acd 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/AbstractTreeElement.java @@ -14,78 +14,78 @@ import java.util.LinkedList; public abstract class AbstractTreeElement implements TreeElement{ - /** - * - */ - private static final long serialVersionUID = -4911602250295116203L; - private final TreeElement parent; - private final LinkedList<TreeElement> children = new LinkedList<>(); - private final String name; - private final int totalLines; - private final int executedLines; - private final int instrumentedLines; - - public AbstractTreeElement(TreeElement parent, String name, int totalLines, - int executedLines, int instrumentedLines) { - this.parent = parent; - this.name = name; - this.totalLines = totalLines; - this.executedLines = executedLines; - this.instrumentedLines = instrumentedLines; - } - - @Override - public TreeElement getParent() { - return parent; - } - - @Override - public boolean hasChildren() { - return (children.size()>0); - } + /** + * + */ + private static final long serialVersionUID = -4911602250295116203L; + private final TreeElement parent; + private final LinkedList<TreeElement> children = new LinkedList<>(); + private final String name; + private final int totalLines; + private final int executedLines; + private final int instrumentedLines; - @Override - public LinkedList<? extends TreeElement> getChildren() { - return children; - } + public AbstractTreeElement(TreeElement parent, String name, int totalLines, + int executedLines, int instrumentedLines) { + this.parent = parent; + this.name = name; + this.totalLines = totalLines; + this.executedLines = executedLines; + this.instrumentedLines = instrumentedLines; + } - @Override - public String getName() { - return name; - } - - @Override - public TreeElement getRoot() { - if (parent == null) { - return this; - } - return parent.getRoot(); - } + @Override + public TreeElement getParent() { + return parent; + } - @Override - public int getExecutedLines() { - return executedLines; - } - - @Override - public int getInstrumentedLines() { - return instrumentedLines; - } + @Override + public boolean hasChildren() { + return (children.size()>0); + } - @Override - public float getCoveragePercentage() { - if (instrumentedLines !=0 ) { - return (100.f*executedLines)/(instrumentedLines); - } - else return 0; - } + @Override + public LinkedList<? extends TreeElement> getChildren() { + return children; + } - public void addChild(TreeElement child){ - children.add(child); - } - - @Override - public int getTotalLines() { - return totalLines; - } + @Override + public String getName() { + return name; + } + + @Override + public TreeElement getRoot() { + if (parent == null) { + return this; + } + return parent.getRoot(); + } + + @Override + public int getExecutedLines() { + return executedLines; + } + + @Override + public int getInstrumentedLines() { + return instrumentedLines; + } + + @Override + public float getCoveragePercentage() { + if (instrumentedLines !=0 ) { + return (100.f*executedLines)/(instrumentedLines); + } + else return 0; + } + + public void addChild(TreeElement child){ + children.add(child); + } + + @Override + public int getTotalLines() { + return totalLines; + } }
\ No newline at end of file diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java index 82a1d4e38b..69c24c2156 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFileTreeElement.java @@ -13,13 +13,13 @@ package org.eclipse.linuxtools.internal.gcov.model; public class CovFileTreeElement extends AbstractTreeElement { - /** - * - */ - private static final long serialVersionUID = -5017234616535899796L; + /** + * + */ + private static final long serialVersionUID = -5017234616535899796L; - public CovFileTreeElement(TreeElement parent, - String name, int totalLines, int executedLines, int instrumentedLines) { - super(parent, name, totalLines, executedLines, instrumentedLines); - } + public CovFileTreeElement(TreeElement parent, + String name, int totalLines, int executedLines, int instrumentedLines) { + super(parent, name, totalLines, executedLines, instrumentedLines); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java index 9e9b6c9549..1bd11f4333 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFolderTreeElement.java @@ -12,13 +12,13 @@ package org.eclipse.linuxtools.internal.gcov.model; public class CovFolderTreeElement extends AbstractTreeElement { - /** - * - */ - private static final long serialVersionUID = 583359546284716138L; + /** + * + */ + private static final long serialVersionUID = 583359546284716138L; - public CovFolderTreeElement(TreeElement parent, - String name, int totalLines, int executedLines, int instrumentedLines) { - super(parent, name, totalLines, executedLines, instrumentedLines); - } + public CovFolderTreeElement(TreeElement parent, + String name, int totalLines, int executedLines, int instrumentedLines) { + super(parent, name, totalLines, executedLines, instrumentedLines); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java index 239ac02bcd..31e06af866 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovFunctionTreeElement.java @@ -14,47 +14,47 @@ import java.util.LinkedList; public class CovFunctionTreeElement extends AbstractTreeElement { - - /** - * - */ - private static final long serialVersionUID = -2025221943523670378L; - private final String sourceFilePath; - private final long firstLnNmbr; - - public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath, - long firstLnNmbr, int executedLines, int instrumentedLines) { - super(parent, name, -1, executedLines, instrumentedLines); - this.sourceFilePath = sourceFilePath; - this.firstLnNmbr = firstLnNmbr; - } - - - /* no children for functions*/ - - @Override - public boolean hasChildren() { - return false; - } - - @Override - public LinkedList<? extends TreeElement> getChildren() { - return null; - } - - @Override - public void addChild(TreeElement child){ - } - - - /* specific methods for functions*/ - - public String getSourceFilePath() { - return sourceFilePath; - } - - public long getFirstLnNmbr() { - return firstLnNmbr; - } - + + /** + * + */ + private static final long serialVersionUID = -2025221943523670378L; + private final String sourceFilePath; + private final long firstLnNmbr; + + public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath, + long firstLnNmbr, int executedLines, int instrumentedLines) { + super(parent, name, -1, executedLines, instrumentedLines); + this.sourceFilePath = sourceFilePath; + this.firstLnNmbr = firstLnNmbr; + } + + + /* no children for functions*/ + + @Override + public boolean hasChildren() { + return false; + } + + @Override + public LinkedList<? extends TreeElement> getChildren() { + return null; + } + + @Override + public void addChild(TreeElement child){ + } + + + /* specific methods for functions*/ + + public String getSourceFilePath() { + return sourceFilePath; + } + + public long getFirstLnNmbr() { + return firstLnNmbr; + } + } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java index 51646602a2..d86e561d1c 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/CovRootTreeElement.java @@ -13,13 +13,13 @@ package org.eclipse.linuxtools.internal.gcov.model; public class CovRootTreeElement extends AbstractTreeElement { - /** - * - */ - private static final long serialVersionUID = 877070271548608926L; + /** + * + */ + private static final long serialVersionUID = 877070271548608926L; - public CovRootTreeElement(String name, int totalLines, int executedLines, - int instrumentedLines) { - super(null, name, totalLines, executedLines, instrumentedLines); - } + public CovRootTreeElement(String name, int totalLines, int executedLines, + int instrumentedLines) { + super(null, name, totalLines, executedLines, instrumentedLines); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java index ee6d708e6a..7e99c4d848 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/model/TreeElement.java @@ -14,14 +14,14 @@ import java.io.Serializable; import java.util.LinkedList; public interface TreeElement extends Serializable{ - TreeElement getParent(); - LinkedList<? extends TreeElement> getChildren(); - boolean hasChildren(); - TreeElement getRoot(); + TreeElement getParent(); + LinkedList<? extends TreeElement> getChildren(); + boolean hasChildren(); + TreeElement getRoot(); - String getName(); - int getExecutedLines(); - int getInstrumentedLines(); - int getTotalLines(); - float getCoveragePercentage(); + String getName(); + int getExecutedLines(); + int getInstrumentedLines(); + int getTotalLines(); + float getCoveragePercentage(); } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java index 6323c8cbea..7db610d4ac 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Arc.java @@ -15,117 +15,117 @@ import java.util.List; public class Arc implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 4104429137191407662L; - - private static final int VCOV_ARC_ON_TREE = (1 << 0); - private static final int VCOV_ARC_FAKE = (1 << 1); - private static final int VCOV_ARC_FALLTHROUGH = (1 << 2); - - private final Block srcBlock; - private final Block dstnatnBlock; - private final long flag; - private final boolean fake; - private final boolean onTree; - private final boolean fallthrough; - - private long count = 0; - private boolean countValid = false; - private boolean isCallNonReturn = false; // Arc is for a function that abnormally returns - private boolean isNonLoclaReturn = false; // Arc is for catch/setjump - private boolean isUnconditionnal = false; // Is an unconditional branch. - - /** - * Constructor - */ - public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams) { - this.flag = flag; - this.dstnatnBlock = otherArcParams.get(dstnatnBlockIndice); - this.srcBlock = otherArcParams.get(srcBlockIndice); - this.count = 0; - this.countValid = false; - if ((flag & VCOV_ARC_ON_TREE) != 0) { - onTree = true; - fake = false; - fallthrough = false; - } else if ((flag & VCOV_ARC_FAKE) != 0) { - onTree = false; - fake = true; - fallthrough = true; - } else if ((flag & VCOV_ARC_FALLTHROUGH) != 0) { - onTree = false; - fake = false; - fallthrough = true; - } else { - onTree = false; - fake = false; - fallthrough = false; - } - } - - public Block getDstnatnBlock() { - return dstnatnBlock; - } - - public long getFlag() { - return flag; - } - - public boolean isFake() { - return fake; - } - - public boolean isOnTree() { - return onTree; - } - - public boolean isFallthrough() { - return fallthrough; - } - - public boolean isUnconditionnal() { - return isUnconditionnal; - } - - public boolean isNonLoclaReturn() { - return isNonLoclaReturn; - } - - public boolean isCallNonReturn() { - return isCallNonReturn; - } - - public void setCallNonReturn(boolean isCallNonReturn) { - this.isCallNonReturn = isCallNonReturn; - } - - public void setNonLoclaReturn(boolean isNonLoclaReturn) { - this.isNonLoclaReturn = isNonLoclaReturn; - } - - public void setUnconditionnal(boolean isUnconditionnal) { - this.isUnconditionnal = isUnconditionnal; - } - - public Block getSrcBlock() { - return srcBlock; - } - - public void setCount(long count) { - this.count = count; - } - - public void setCountValid(boolean countValid) { - this.countValid = countValid; - } - - public long getCount() { - return count; - } - - public boolean isCountValid() { - return countValid; - } + /** + * + */ + private static final long serialVersionUID = 4104429137191407662L; + + private static final int VCOV_ARC_ON_TREE = (1 << 0); + private static final int VCOV_ARC_FAKE = (1 << 1); + private static final int VCOV_ARC_FALLTHROUGH = (1 << 2); + + private final Block srcBlock; + private final Block dstnatnBlock; + private final long flag; + private final boolean fake; + private final boolean onTree; + private final boolean fallthrough; + + private long count = 0; + private boolean countValid = false; + private boolean isCallNonReturn = false; // Arc is for a function that abnormally returns + private boolean isNonLoclaReturn = false; // Arc is for catch/setjump + private boolean isUnconditionnal = false; // Is an unconditional branch. + + /** + * Constructor + */ + public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams) { + this.flag = flag; + this.dstnatnBlock = otherArcParams.get(dstnatnBlockIndice); + this.srcBlock = otherArcParams.get(srcBlockIndice); + this.count = 0; + this.countValid = false; + if ((flag & VCOV_ARC_ON_TREE) != 0) { + onTree = true; + fake = false; + fallthrough = false; + } else if ((flag & VCOV_ARC_FAKE) != 0) { + onTree = false; + fake = true; + fallthrough = true; + } else if ((flag & VCOV_ARC_FALLTHROUGH) != 0) { + onTree = false; + fake = false; + fallthrough = true; + } else { + onTree = false; + fake = false; + fallthrough = false; + } + } + + public Block getDstnatnBlock() { + return dstnatnBlock; + } + + public long getFlag() { + return flag; + } + + public boolean isFake() { + return fake; + } + + public boolean isOnTree() { + return onTree; + } + + public boolean isFallthrough() { + return fallthrough; + } + + public boolean isUnconditionnal() { + return isUnconditionnal; + } + + public boolean isNonLoclaReturn() { + return isNonLoclaReturn; + } + + public boolean isCallNonReturn() { + return isCallNonReturn; + } + + public void setCallNonReturn(boolean isCallNonReturn) { + this.isCallNonReturn = isCallNonReturn; + } + + public void setNonLoclaReturn(boolean isNonLoclaReturn) { + this.isNonLoclaReturn = isNonLoclaReturn; + } + + public void setUnconditionnal(boolean isUnconditionnal) { + this.isUnconditionnal = isUnconditionnal; + } + + public Block getSrcBlock() { + return srcBlock; + } + + public void setCount(long count) { + this.count = count; + } + + public void setCountValid(boolean countValid) { + this.countValid = countValid; + } + + public long getCount() { + return count; + } + + public boolean isCountValid() { + return countValid; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java index 4afe47f229..b5c68b46d6 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Block.java @@ -15,163 +15,163 @@ import java.util.ArrayList; public class Block implements Serializable{ - /** - * - */ - private static final long serialVersionUID = -7665287885679756014L; - private final ArrayList<Arc> entryArcs = new ArrayList<>(); - private final ArrayList<Arc> exitArcs = new ArrayList<>(); - private final long flag; - private long numSuccs = 0; - private long numPreds = 0; - private long count = 0; - private boolean isCallSite = false;// Does the call - private boolean isCallReturn = false; // Is the return - private boolean isNonLocalReturn = false; - private boolean validChain = false; - private boolean invalidChain = false; - private boolean countValid = false; - private final BlkLine blkline = new BlkLine(); - - /** - * Constructor - */ - public Block(long flag) { - this.flag = flag; - } - - - /* getters & setters */ - public long getFlag() { - return flag; - } - - public ArrayList<Arc> getEntryArcs() { - return entryArcs; - } - - public ArrayList<Arc> getExitArcs() { - return exitArcs; - } - - public boolean isCallSite() { - return isCallSite; - } - - public boolean isCallReturn() { - return isCallReturn; - } - - public boolean isNonLocalReturn() { - return isNonLocalReturn; - } - - public void addEntryArcs(Arc arcEntry) { - this.entryArcs.add(arcEntry); - } - - public void addExitArcs(Arc arcExit) { - this.exitArcs.add(arcExit); - } - - public void setCallSite(boolean isCallSite) { - this.isCallSite = isCallSite; - } - - public void setCallReturn(boolean isCallReturn) { - this.isCallReturn = isCallReturn; - } - - public void setNonLocalReturn(boolean isNonLocalReturn) { - this.isNonLocalReturn = isNonLocalReturn; - } - - public void decNumSuccs() { - this.numSuccs--; - } - - public void decNumPreds() { - this.numPreds--; - } - - public void incNumPreds() { - this.numPreds++; - } - - public void incNumSuccs() { - this.numSuccs++; - } - - public boolean isValidChain() { - return validChain; - } - - public void setValidChain(boolean validChain) { - this.validChain = validChain; - } - - public boolean isInvalidChain() { - return invalidChain; - } - - public void setInvalidChain(boolean invalidChain) { - this.invalidChain = invalidChain; - } - - public long getCount() { - return count; - } - - public void setCount(long count) { - this.count = count; - } - - public void setCountValid(boolean countValid) { - this.countValid = countValid; - } - - public boolean isCountValid() { - return countValid; - } - - public long getNumSuccs() { - return numSuccs; - } - - public long getNumPreds() { - return numPreds; - } - - public void setNumSuccs(long numSuccs) { - this.numSuccs = numSuccs; - } - - public void setNumPreds(long numPreds) { - this.numPreds = numPreds; - } - - public long[] getEncoding() { - return blkline.encoding; - } - - public void setEncoding(long[] lineNos) { - this.blkline.encoding = lineNos; - } - - public int getLineNum() { - return blkline.num; - } - - public void setNumLine(int numline) { - this.blkline.num = numline; - } - - static class BlkLine implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 2757557929188979686L; - public long[] encoding; - public int num; - } + /** + * + */ + private static final long serialVersionUID = -7665287885679756014L; + private final ArrayList<Arc> entryArcs = new ArrayList<>(); + private final ArrayList<Arc> exitArcs = new ArrayList<>(); + private final long flag; + private long numSuccs = 0; + private long numPreds = 0; + private long count = 0; + private boolean isCallSite = false;// Does the call + private boolean isCallReturn = false; // Is the return + private boolean isNonLocalReturn = false; + private boolean validChain = false; + private boolean invalidChain = false; + private boolean countValid = false; + private final BlkLine blkline = new BlkLine(); + + /** + * Constructor + */ + public Block(long flag) { + this.flag = flag; + } + + + /* getters & setters */ + public long getFlag() { + return flag; + } + + public ArrayList<Arc> getEntryArcs() { + return entryArcs; + } + + public ArrayList<Arc> getExitArcs() { + return exitArcs; + } + + public boolean isCallSite() { + return isCallSite; + } + + public boolean isCallReturn() { + return isCallReturn; + } + + public boolean isNonLocalReturn() { + return isNonLocalReturn; + } + + public void addEntryArcs(Arc arcEntry) { + this.entryArcs.add(arcEntry); + } + + public void addExitArcs(Arc arcExit) { + this.exitArcs.add(arcExit); + } + + public void setCallSite(boolean isCallSite) { + this.isCallSite = isCallSite; + } + + public void setCallReturn(boolean isCallReturn) { + this.isCallReturn = isCallReturn; + } + + public void setNonLocalReturn(boolean isNonLocalReturn) { + this.isNonLocalReturn = isNonLocalReturn; + } + + public void decNumSuccs() { + this.numSuccs--; + } + + public void decNumPreds() { + this.numPreds--; + } + + public void incNumPreds() { + this.numPreds++; + } + + public void incNumSuccs() { + this.numSuccs++; + } + + public boolean isValidChain() { + return validChain; + } + + public void setValidChain(boolean validChain) { + this.validChain = validChain; + } + + public boolean isInvalidChain() { + return invalidChain; + } + + public void setInvalidChain(boolean invalidChain) { + this.invalidChain = invalidChain; + } + + public long getCount() { + return count; + } + + public void setCount(long count) { + this.count = count; + } + + public void setCountValid(boolean countValid) { + this.countValid = countValid; + } + + public boolean isCountValid() { + return countValid; + } + + public long getNumSuccs() { + return numSuccs; + } + + public long getNumPreds() { + return numPreds; + } + + public void setNumSuccs(long numSuccs) { + this.numSuccs = numSuccs; + } + + public void setNumPreds(long numPreds) { + this.numPreds = numPreds; + } + + public long[] getEncoding() { + return blkline.encoding; + } + + public void setEncoding(long[] lineNos) { + this.blkline.encoding = lineNos; + } + + public int getLineNum() { + return blkline.num; + } + + public void setNumLine(int numline) { + this.blkline.num = numline; + } + + static class BlkLine implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 2757557929188979686L; + public long[] encoding; + public int num; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java index 1c469dad7c..4a59f8cc2c 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java @@ -52,8 +52,8 @@ import org.eclipse.ui.PlatformUI; public class CovManager implements Serializable { /** - * - */ + * + */ private static final long serialVersionUID = 5582066617970911413L; // input private final String binaryPath; @@ -263,9 +263,9 @@ public class CovManager implements Serializable { File dir = null; do { if (postfix.isEmpty()) { - postfix = f.getName(); + postfix = f.getName(); } else { - postfix = f.getName() + File.separator + postfix; + postfix = f.getName() + File.separator + postfix; } f = f.getParentFile(); if (f != null) { @@ -289,7 +289,7 @@ public class CovManager implements Serializable { fg.setText(NLS.bind(Messages.CovManager_No_FilePath_Error, new Object[] { filePath, filename })); String s = fg.open(); if (s == null) { - return null; + return null; } else { f = new File(s).getAbsoluteFile(); addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile()); diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java index 761289ee43..d7b30c27fc 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CoverageInfo.java @@ -14,39 +14,39 @@ import java.io.Serializable; public class CoverageInfo implements Serializable{ - /** - * - */ - private static final long serialVersionUID = -6067335353999481231L; - - private int linesInstrumented = 0; - private int linesExecuted = 0; - - /** - * Constructor - */ - public CoverageInfo() { - - } - - - /*getters & setters */ - - public int getLinesInstrumented() { - return linesInstrumented; - } - - public int getLinesExecuted() { - return linesExecuted; - } - - public void incLinesInstrumented(){ - this.linesInstrumented++; - } - - public void incLinesExecuted(){ - this.linesExecuted++; - } - - + /** + * + */ + private static final long serialVersionUID = -6067335353999481231L; + + private int linesInstrumented = 0; + private int linesExecuted = 0; + + /** + * Constructor + */ + public CoverageInfo() { + + } + + + /*getters & setters */ + + public int getLinesInstrumented() { + return linesInstrumented; + } + + public int getLinesExecuted() { + return linesExecuted; + } + + public void incLinesInstrumented(){ + this.linesInstrumented++; + } + + public void incLinesExecuted(){ + this.linesExecuted++; + } + + } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java index 65f3d244ae..00f46b6b86 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java @@ -15,51 +15,51 @@ import java.util.ArrayList; public class Folder implements Serializable { - /** - * - */ - private static final long serialVersionUID = 5155033391199109661L; - private final String path; - private final ArrayList<SourceFile> srcFiles = new ArrayList<>(); - private int numLines = 0; - private int linesInstrumented = 0; - private int linesExecuted = 0; - - /** - * Constructor - */ - public Folder(String path) { - this.path = path; - } - - - public void accumulateSourcesCounts(){ - for (SourceFile srcFile: srcFiles) { - numLines += srcFile.getNumLines(); - linesInstrumented += srcFile.getLinesInstrumented(); - linesExecuted += srcFile.getLinesExecuted(); - } - } - - public String getPath() { - return path; - } - - public ArrayList<SourceFile> getSrcFiles() { - return srcFiles; - } - - public void addSrcFiles(SourceFile srcFile) { - this.srcFiles.add(srcFile); - } - - public int getNumLines() { - return numLines; - } - public int getLinesExecuted() { - return linesExecuted; - } - public int getLinesInstrumented() { - return linesInstrumented; - } + /** + * + */ + private static final long serialVersionUID = 5155033391199109661L; + private final String path; + private final ArrayList<SourceFile> srcFiles = new ArrayList<>(); + private int numLines = 0; + private int linesInstrumented = 0; + private int linesExecuted = 0; + + /** + * Constructor + */ + public Folder(String path) { + this.path = path; + } + + + public void accumulateSourcesCounts(){ + for (SourceFile srcFile: srcFiles) { + numLines += srcFile.getNumLines(); + linesInstrumented += srcFile.getLinesInstrumented(); + linesExecuted += srcFile.getLinesExecuted(); + } + } + + public String getPath() { + return path; + } + + public ArrayList<SourceFile> getSrcFiles() { + return srcFiles; + } + + public void addSrcFiles(SourceFile srcFile) { + this.srcFiles.add(srcFile); + } + + public int getNumLines() { + return numLines; + } + public int getLinesExecuted() { + return linesExecuted; + } + public int getLinesInstrumented() { + return linesInstrumented; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java index 54c139c5a7..51c01be56d 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java @@ -16,8 +16,8 @@ import java.util.ArrayList; public class GcnoFunction implements Serializable, Comparable<GcnoFunction> { /** - * - */ + * + */ private static final long serialVersionUID = -4159055012321132651L; private final long ident; diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java index a3fbc5ae34..2629a5f424 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Line.java @@ -15,27 +15,27 @@ import java.io.Serializable; public class Line implements Serializable{ - /** */ - private static final long serialVersionUID = 8804878976767948267L; - private boolean exists = false; - private long count = 0; + /** */ + private static final long serialVersionUID = 8804878976767948267L; + private boolean exists = false; + private long count = 0; - /*Getters & setters*/ + /*Getters & setters*/ - public boolean exists() { - return exists; - } + public boolean exists() { + return exists; + } - public void setExists(boolean exists) { - this.exists = exists; - } + public void setExists(boolean exists) { + this.exists = exists; + } - public void setCount(long count) { - this.count = count; - } + public void setCount(long count) { + this.count = count; + } - public long getCount() { - return count; - } + public long getCount() { + return count; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java index b89ebec9af..dd18295eaa 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Messages.java @@ -13,28 +13,28 @@ package org.eclipse.linuxtools.internal.gcov.parser; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.parser.messages"; //$NON-NLS-1$ - public static String CovManager_Parsing_Done; - public static String CovManager_Retrieval_Error; - public static String CovManager_Strings; - public static String CovManager_Summary; - public static String CovManager_No_Funcs_Error; - public static String CovManager_No_FilePath_Error; + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.parser.messages"; //$NON-NLS-1$ + public static String CovManager_Parsing_Done; + public static String CovManager_Retrieval_Error; + public static String CovManager_Strings; + public static String CovManager_Summary; + public static String CovManager_No_Funcs_Error; + public static String CovManager_No_FilePath_Error; - public static String GcdaRecordsParser_content_inconsistent; - public static String GcdaRecordsParser_func_block_empty; - public static String GcdaRecordsParser_func_counter_error; - public static String GcdaRecordsParser_magic_num_error; - public static String GcdaRecordsParser_checksum_error; - public static String GcdaRecordsParser_func_not_found; - public static String GcnoRecordsParser_null_string; - public static String GcnoRecordsParser_magic_num_error; + public static String GcdaRecordsParser_content_inconsistent; + public static String GcdaRecordsParser_func_block_empty; + public static String GcdaRecordsParser_func_counter_error; + public static String GcdaRecordsParser_magic_num_error; + public static String GcdaRecordsParser_checksum_error; + public static String GcdaRecordsParser_func_not_found; + public static String GcnoRecordsParser_null_string; + public static String GcnoRecordsParser_magic_num_error; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - } + private Messages() { + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java index 8544a5ca12..b2ac834160 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java @@ -17,96 +17,96 @@ import java.util.TreeSet; public class SourceFile implements Serializable { - /** - * - */ - private static final long serialVersionUID = -9182882194956475711L; - private final String name; - private final int index; - private final ArrayList<Line> lines = new ArrayList<>(); - private final TreeSet<GcnoFunction> fnctns = new TreeSet<>(); - private int numLines = 1; - private final CoverageInfo cvrge = new CoverageInfo(); - private long maxCount = -1; - - /** - * Constructor - */ - public SourceFile(String name, int index) { - this.name = name; - this.index = index; - } - - - public void accumulateLineCounts() { - for (Line line : lines) { - if (line.exists()) { - cvrge.incLinesInstrumented(); - if (line.getCount() != 0) { - cvrge.incLinesExecuted(); - } - } - } - } - - public long getmaxLineCount() { - if (maxCount < 0) { - for (Line line : lines) { - if (line.getCount() > maxCount) { - maxCount = line.getCount(); - } - } - } - return maxCount; - } - - /* getters & setters */ - - - - public int getLinesExecuted() { - return cvrge.getLinesExecuted(); - } - - public int getLinesInstrumented() { - return cvrge.getLinesInstrumented(); - } - - public String getName() { - return name; - } - - public ArrayList<Line> getLines() { - return lines; - } - - public SortedSet<GcnoFunction> getFnctns() { - return fnctns; - } - - public void addFnctn(GcnoFunction fnctn) { - this.fnctns.add(fnctn); - } - - public int getNumLines() { - return numLines; - } - - public void setNumLines(int numLines) { - this.numLines = numLines; - } - - public int getIndex() { - return index; - } - - public void createLines() { - int n = getNumLines(); - lines.ensureCapacity(n); - for (int j = 0; j < n; j++) { - lines.add(new Line()); - } - } - - + /** + * + */ + private static final long serialVersionUID = -9182882194956475711L; + private final String name; + private final int index; + private final ArrayList<Line> lines = new ArrayList<>(); + private final TreeSet<GcnoFunction> fnctns = new TreeSet<>(); + private int numLines = 1; + private final CoverageInfo cvrge = new CoverageInfo(); + private long maxCount = -1; + + /** + * Constructor + */ + public SourceFile(String name, int index) { + this.name = name; + this.index = index; + } + + + public void accumulateLineCounts() { + for (Line line : lines) { + if (line.exists()) { + cvrge.incLinesInstrumented(); + if (line.getCount() != 0) { + cvrge.incLinesExecuted(); + } + } + } + } + + public long getmaxLineCount() { + if (maxCount < 0) { + for (Line line : lines) { + if (line.getCount() > maxCount) { + maxCount = line.getCount(); + } + } + } + return maxCount; + } + + /* getters & setters */ + + + + public int getLinesExecuted() { + return cvrge.getLinesExecuted(); + } + + public int getLinesInstrumented() { + return cvrge.getLinesInstrumented(); + } + + public String getName() { + return name; + } + + public ArrayList<Line> getLines() { + return lines; + } + + public SortedSet<GcnoFunction> getFnctns() { + return fnctns; + } + + public void addFnctn(GcnoFunction fnctn) { + this.fnctns.add(fnctn); + } + + public int getNumLines() { + return numLines; + } + + public void setNumLines(int numLines) { + this.numLines = numLines; + } + + public int getIndex() { + return index; + } + + public void createLines() { + int n = getNumLines(); + lines.ensureCapacity(n); + for (int j = 0; j < n; j++) { + lines.add(new Line()); + } + } + + } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/preferences/Messages.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/preferences/Messages.java index 10c5ff65e0..79a6dc3ea6 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/preferences/Messages.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/preferences/Messages.java @@ -13,19 +13,19 @@ package org.eclipse.linuxtools.internal.gcov.preferences; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.preferences.messages"; //$NON-NLS-1$ - public static String ColorPreferencePage_BackColorHighest; - public static String ColorPreferencePage_BackColorLowest; - public static String ColorPreferencePage_BackColorNotCovered; - public static String ColorPreferencePage_ColorizeCode; - public static String ColorPreferencePage_Description; - public static String ColorPreferencePage_Title; - public static String ColorPreferencePage_UseGradient; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.gcov.preferences.messages"; //$NON-NLS-1$ + public static String ColorPreferencePage_BackColorHighest; + public static String ColorPreferencePage_BackColorLowest; + public static String ColorPreferencePage_BackColorNotCovered; + public static String ColorPreferencePage_ColorizeCode; + public static String ColorPreferencePage_Description; + public static String ColorPreferencePage_Title; + public static String ColorPreferencePage_UseGradient; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - } + private Messages() { + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java index e4baf5ab2e..2654767960 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/BEDataInputStream.java @@ -18,67 +18,67 @@ import java.io.IOException; */ public class BEDataInputStream implements DataInput { - private final DataInputStream in; - private final byte[] buffer = new byte[8]; - - /** - * Constructor - * @param in - */ - public BEDataInputStream(DataInputStream in) { - this.in = in; - } - - - /* - * (non-Javadoc) - * @see java.io.DataInput#readShort() - */ - @Override - public final short readShort() throws IOException - { - return in.readShort(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readUnsignedShort() - */ - @Override - public final int readUnsignedShort() throws IOException - { - return in.readUnsignedShort(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readChar() - */ - @Override - public final char readChar() throws IOException - { - return in.readChar(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readInt() - */ - @Override - public final int readInt() throws IOException - { - return in.readInt(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readLong() - */ - @Override - public final long readLong() throws IOException - { - in.readFully(buffer, 0, 8); - return (((long)buffer[7] << 32) + + private final DataInputStream in; + private final byte[] buffer = new byte[8]; + + /** + * Constructor + * @param in + */ + public BEDataInputStream(DataInputStream in) { + this.in = in; + } + + + /* + * (non-Javadoc) + * @see java.io.DataInput#readShort() + */ + @Override + public final short readShort() throws IOException + { + return in.readShort(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readUnsignedShort() + */ + @Override + public final int readUnsignedShort() throws IOException + { + return in.readUnsignedShort(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readChar() + */ + @Override + public final char readChar() throws IOException + { + return in.readChar(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readInt() + */ + @Override + public final int readInt() throws IOException + { + return in.readInt(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readLong() + */ + @Override + public final long readLong() throws IOException + { + in.readFully(buffer, 0, 8); + return (((long)buffer[7] << 32) + ((long)(buffer[6] & 255) << 40) + ((long)(buffer[5] & 255) << 48) + ((long)(buffer[4] & 255) << 56) + @@ -86,120 +86,120 @@ public class BEDataInputStream implements DataInput { ((buffer[2] & 255) << 8) + ((buffer[1] & 255) << 16) + ((buffer[0] & 255) << 24)); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readFloat() - */ - @Override - public final float readFloat() throws IOException - { - return Float.intBitsToFloat(readInt()); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readDouble() - */ - @Override - public final double readDouble() throws IOException - { - return Double.longBitsToDouble(readLong()); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readBoolean() - */ - @Override - public boolean readBoolean() throws IOException { - return in.readBoolean(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readByte() - */ - @Override - public byte readByte() throws IOException { - return in.readByte(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readFully(byte[]) - */ - @Override - public void readFully(byte[] b) throws IOException { - in.readFully(b); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readFully(byte[], int, int) - */ - @Override - public void readFully(byte[] b, int off, int len) throws IOException { - in.readFully(b,off,len); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readLine() - */ - @Override - @Deprecated - public String readLine() throws IOException { - return in.readLine(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readUTF() - */ - @Override - public String readUTF() throws IOException { - return in.readUTF(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#readUnsignedByte() - */ - @Override - public int readUnsignedByte() throws IOException { - return in.readUnsignedByte(); - } - - /* - * (non-Javadoc) - * @see java.io.DataInput#skipBytes(int) - */ - @Override - public int skipBytes(int n) throws IOException { - return in.skipBytes(n); - } - - /** - * Close this stream. - */ - public void close() throws IOException { - in.close(); - } - - public final long readUnsignedInt() throws IOException - { - in.readFully(buffer, 0, 4); - return - (( - (buffer[0]) << 24 | - (buffer[1]&0xff) << 16 | - (buffer[2]&0xff) << 8 | - (buffer[3]&0xff) - ) - & MasksGenerator.UNSIGNED_INT_MASK ); - } + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readFloat() + */ + @Override + public final float readFloat() throws IOException + { + return Float.intBitsToFloat(readInt()); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readDouble() + */ + @Override + public final double readDouble() throws IOException + { + return Double.longBitsToDouble(readLong()); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readBoolean() + */ + @Override + public boolean readBoolean() throws IOException { + return in.readBoolean(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readByte() + */ + @Override + public byte readByte() throws IOException { + return in.readByte(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readFully(byte[]) + */ + @Override + public void readFully(byte[] b) throws IOException { + in.readFully(b); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readFully(byte[], int, int) + */ + @Override + public void readFully(byte[] b, int off, int len) throws IOException { + in.readFully(b,off,len); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readLine() + */ + @Override + @Deprecated + public String readLine() throws IOException { + return in.readLine(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readUTF() + */ + @Override + public String readUTF() throws IOException { + return in.readUTF(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#readUnsignedByte() + */ + @Override + public int readUnsignedByte() throws IOException { + return in.readUnsignedByte(); + } + + /* + * (non-Javadoc) + * @see java.io.DataInput#skipBytes(int) + */ + @Override + public int skipBytes(int n) throws IOException { + return in.skipBytes(n); + } + + /** + * Close this stream. + */ + public void close() throws IOException { + in.close(); + } + + public final long readUnsignedInt() throws IOException + { + in.readFully(buffer, 0, 4); + return + (( + (buffer[0]) << 24 | + (buffer[1]&0xff) << 16 | + (buffer[2]&0xff) << 8 | + (buffer[3]&0xff) + ) + & MasksGenerator.UNSIGNED_INT_MASK ); + } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java index eb8a61ba9d..63330ae1e9 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/utils/MasksGenerator.java @@ -11,5 +11,5 @@ package org.eclipse.linuxtools.internal.gcov.utils; public class MasksGenerator { - public static final long UNSIGNED_INT_MASK = 0xffffffffL; + public static final long UNSIGNED_INT_MASK = 0xffffffffL; } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java index 2bdf41efae..bcb8d1f02c 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFileContentProvider.java @@ -20,41 +20,41 @@ import org.eclipse.linuxtools.internal.gcov.model.TreeElement; public class CovFileContentProvider extends CovFolderContentProvider { - public static final CovFileContentProvider sharedInstance = new CovFileContentProvider(); - - /** - * Constructor - */ - protected CovFileContentProvider() { - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof CovRootTreeElement) { - CovRootTreeElement root = (CovRootTreeElement) parentElement; - LinkedList<? extends TreeElement> ret = getElementChildrenList(root); - return ret.toArray(); - } - return super.getChildren(parentElement); - } - - protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) { - LinkedList<TreeElement> ret = new LinkedList<>(); - LinkedList<? extends TreeElement> list = root.getChildren(); - for (TreeElement folderlist : list) { - LinkedList<? extends TreeElement> partialList = folderlist.getChildren(); - ret.addAll(partialList); - } - return ret; - } - - @Override - public Object getParent(Object element) { - Object o = super.getParent(element); - if (o instanceof CovFolderTreeElement) { - o = super.getParent(o); - } - return o; - } + public static final CovFileContentProvider sharedInstance = new CovFileContentProvider(); + + /** + * Constructor + */ + protected CovFileContentProvider() { + } + + @Override + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof CovRootTreeElement) { + CovRootTreeElement root = (CovRootTreeElement) parentElement; + LinkedList<? extends TreeElement> ret = getElementChildrenList(root); + return ret.toArray(); + } + return super.getChildren(parentElement); + } + + protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) { + LinkedList<TreeElement> ret = new LinkedList<>(); + LinkedList<? extends TreeElement> list = root.getChildren(); + for (TreeElement folderlist : list) { + LinkedList<? extends TreeElement> partialList = folderlist.getChildren(); + ret.addAll(partialList); + } + return ret; + } + + @Override + public Object getParent(Object element) { + Object o = super.getParent(element); + if (o instanceof CovFolderTreeElement) { + o = super.getParent(o); + } + return o; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java index 16e872f67e..1915efbb29 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java @@ -20,57 +20,57 @@ import org.eclipse.linuxtools.internal.gcov.parser.CovManager; public class CovFolderContentProvider implements ITreeContentProvider { - /** Shared instance: this class is implemented as a Singleton */ - public static final CovFolderContentProvider sharedInstance = new CovFolderContentProvider(); + /** Shared instance: this class is implemented as a Singleton */ + public static final CovFolderContentProvider sharedInstance = new CovFolderContentProvider(); - protected CovFolderContentProvider(){ - } + protected CovFolderContentProvider(){ + } - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof TreeElement) { - TreeElement elem = (TreeElement) parentElement; - LinkedList<? extends TreeElement> list = elem.getChildren(); - if (list != null) - return list.toArray(); - } - return null; - } + @Override + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof TreeElement) { + TreeElement elem = (TreeElement) parentElement; + LinkedList<? extends TreeElement> list = elem.getChildren(); + if (list != null) + return list.toArray(); + } + return null; + } - @Override - public Object getParent(Object element) { - if (element instanceof TreeElement) { - TreeElement elem = (TreeElement) element; - return elem.getParent(); - } - return null; - } + @Override + public Object getParent(Object element) { + if (element instanceof TreeElement) { + TreeElement elem = (TreeElement) element; + return elem.getParent(); + } + return null; + } - @Override - public boolean hasChildren(Object element) { - if (element instanceof TreeElement) { - TreeElement elem = (TreeElement) element; - return elem.hasChildren(); - } - return false; - } + @Override + public boolean hasChildren(Object element) { + if (element instanceof TreeElement) { + TreeElement elem = (TreeElement) element; + return elem.hasChildren(); + } + return false; + } - @Override - public Object[] getElements(Object inputElement) { - if (inputElement instanceof CovManager) { - CovManager cvrgMnger = (CovManager)inputElement; - return new Object[] { - cvrgMnger.getRootNode() - }; - } - return new Object[0]; - } + @Override + public Object[] getElements(Object inputElement) { + if (inputElement instanceof CovManager) { + CovManager cvrgMnger = (CovManager)inputElement; + return new Object[] { + cvrgMnger.getRootNode() + }; + } + return new Object[0]; + } - @Override - public void dispose() { - } + @Override + public void dispose() { + } - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java index 9b4dabf81d..56b71b8e35 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFunctionContentProvider.java @@ -21,33 +21,33 @@ import org.eclipse.linuxtools.internal.gcov.model.TreeElement; public class CovFunctionContentProvider extends CovFileContentProvider { - public static final CovFunctionContentProvider sharedInstance = new CovFunctionContentProvider(); - - /** - * Constructor - */ - protected CovFunctionContentProvider() { - } - - @Override - protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) { - LinkedList<? extends TreeElement> list = super.getElementChildrenList(root); - LinkedList<TreeElement> ret = new LinkedList<>(); - for (TreeElement histTreeElem : list) { - LinkedList<? extends TreeElement> partialList = histTreeElem.getChildren(); - ret.addAll(partialList); - } - return ret; - } - - - @Override - public Object getParent(Object element) { - Object o = super.getParent(element); - if (o instanceof CovFileTreeElement) { - o = super.getParent(o); - } - return o; - } + public static final CovFunctionContentProvider sharedInstance = new CovFunctionContentProvider(); + + /** + * Constructor + */ + protected CovFunctionContentProvider() { + } + + @Override + protected LinkedList<? extends TreeElement> getElementChildrenList(CovRootTreeElement root) { + LinkedList<? extends TreeElement> list = super.getElementChildrenList(root); + LinkedList<TreeElement> ret = new LinkedList<>(); + for (TreeElement histTreeElem : list) { + LinkedList<? extends TreeElement> partialList = histTreeElem.getChildren(); + ret.addAll(partialList); + } + return ret; + } + + + @Override + public Object getParent(Object element) { + Object o = super.getParent(element); + if (o instanceof CovFileTreeElement) { + o = super.getParent(o); + } + return o; + } }
\ No newline at end of file diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java index b311a70462..b474157764 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovViewer.java @@ -35,75 +35,75 @@ import org.eclipse.swt.widgets.Composite; public class CovViewer extends AbstractSTTreeViewer { - private ISTDataViewersField[] fields; + private ISTDataViewersField[] fields; - /** - * Constructor - * @param parent - */ - public CovViewer(Composite parent) { - super(parent, SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL | SWT.MULTI | - SWT.FULL_SELECTION); - } + /** + * Constructor + * @param parent + */ + public CovViewer(Composite parent) { + super(parent, SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL | SWT.MULTI | + SWT.FULL_SELECTION); + } - @Override - protected IContentProvider createContentProvider() { - return CovFileContentProvider.sharedInstance; + @Override + protected IContentProvider createContentProvider() { + return CovFileContentProvider.sharedInstance; - } + } - @Override - public ISTDataViewersField[] getAllFields() { - if (fields == null) { - fields = new ISTDataViewersField[] { - new FieldName(), - new FieldTotalLines(), - new FieldInstrumentedLines(), - new FieldExecutedLines(), - new FieldCoveragePercentage() }; - } - return fields; - } + @Override + public ISTDataViewersField[] getAllFields() { + if (fields == null) { + fields = new ISTDataViewersField[] { + new FieldName(), + new FieldTotalLines(), + new FieldInstrumentedLines(), + new FieldExecutedLines(), + new FieldCoveragePercentage() }; + } + return fields; + } - @Override - public IDialogSettings getDialogSettings() { - return org.eclipse.linuxtools.internal.gcov.Activator.getDefault().getDialogSettings(); - } + @Override + public IDialogSettings getDialogSettings() { + return org.eclipse.linuxtools.internal.gcov.Activator.getDefault().getDialogSettings(); + } - @Override - protected void handleOpenEvent(OpenEvent event) { + @Override + protected void handleOpenEvent(OpenEvent event) { - IStructuredSelection selection = (IStructuredSelection) event - .getSelection(); - TreeElement element = (TreeElement) selection.getFirstElement(); + IStructuredSelection selection = (IStructuredSelection) event + .getSelection(); + TreeElement element = (TreeElement) selection.getFirstElement(); - if (element != null) { - if (element.getParent() != null) { - String sourceLoc = ""; //$NON-NLS-1$ - long lineNumber = 0; + if (element != null) { + if (element.getParent() != null) { + String sourceLoc = ""; //$NON-NLS-1$ + long lineNumber = 0; - if (element.getClass() == CovFileTreeElement.class) { - sourceLoc = element.getName(); - } else if (element.getClass() == CovFunctionTreeElement.class) { - sourceLoc = ((CovFunctionTreeElement) element).getSourceFilePath(); - lineNumber =((CovFunctionTreeElement)element).getFirstLnNmbr(); - } - CovManager cvm = (CovManager) this.getInput(); - SourceFile sourceFile = cvm.getSourceFile(sourceLoc); - if (sourceFile != null) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - String binaryLoc = cvm.getBinaryPath(); - IPath binaryPath = new Path(binaryLoc); - IFile binary = root.getFileForLocation(binaryPath); - IProject project = null; - if (binary != null) { - project = binary.getProject(); - } + if (element.getClass() == CovFileTreeElement.class) { + sourceLoc = element.getName(); + } else if (element.getClass() == CovFunctionTreeElement.class) { + sourceLoc = ((CovFunctionTreeElement) element).getSourceFilePath(); + lineNumber =((CovFunctionTreeElement)element).getFirstLnNmbr(); + } + CovManager cvm = (CovManager) this.getInput(); + SourceFile sourceFile = cvm.getSourceFile(sourceLoc); + if (sourceFile != null) { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + String binaryLoc = cvm.getBinaryPath(); + IPath binaryPath = new Path(binaryLoc); + IFile binary = root.getFileForLocation(binaryPath); + IProject project = null; + if (binary != null) { + project = binary.getProject(); + } - OpenSourceFileAction.openAnnotatedSourceFile(project, - binary, sourceFile, (int)lineNumber); - } - } - } - } + OpenSourceFileAction.openAnnotatedSourceFile(project, + binary, sourceFile, (int)lineNumber); + } + } + } + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java index cfd5fe7334..03e8e8430d 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java @@ -49,9 +49,9 @@ import org.eclipse.ui.texteditor.ITextEditor; */ public final class GcovAnnotationModel implements IAnnotationModel { - private static final String THOROUGH_COVERAGE = "org.eclipse.linuxtools.gcov.ThoroughCoverageAnnotation"; //$NON-NLS-1$ - private static final String COVERAGE = "org.eclipse.linuxtools.gcov.CoverageAnnotation"; //$NON-NLS-1$ - private static final String NO_COVERAGE = "org.eclipse.linuxtools.gcov.NoCoverageAnnotation"; //$NON-NLS-1$ + private static final String THOROUGH_COVERAGE = "org.eclipse.linuxtools.gcov.ThoroughCoverageAnnotation"; //$NON-NLS-1$ + private static final String COVERAGE = "org.eclipse.linuxtools.gcov.CoverageAnnotation"; //$NON-NLS-1$ + private static final String NO_COVERAGE = "org.eclipse.linuxtools.gcov.NoCoverageAnnotation"; //$NON-NLS-1$ /** Key for identifying our model from other Editor models. */ private static final Object KEY = new Object(); diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java index b3f89e5322..191116aeae 100644 --- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java +++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java @@ -18,53 +18,53 @@ import org.eclipse.linuxtools.internal.gcov.parser.SourceFile; public class STAnnotatedSourceNotFoundEditorInput extends STCSourceNotFoundEditorInput { - private final SourceFile sourceFile; - - public STAnnotatedSourceNotFoundEditorInput(IProject project, - SourceFile sourceFile, - IPath sourcePath, int lineNumber) { - super(project, sourcePath, lineNumber); - this.sourceFile = sourceFile; - } + private final SourceFile sourceFile; - /** - * @return the sourceFile - */ - public SourceFile getSourceFile() { - return sourceFile; - } + public STAnnotatedSourceNotFoundEditorInput(IProject project, + SourceFile sourceFile, + IPath sourcePath, int lineNumber) { + super(project, sourcePath, lineNumber); + this.sourceFile = sourceFile; + } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result - + ((sourceFile == null) ? 0 : sourceFile.hashCode()); - return result; - } + /** + * @return the sourceFile + */ + public SourceFile getSourceFile() { + return sourceFile; + } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - final STAnnotatedSourceNotFoundEditorInput other = (STAnnotatedSourceNotFoundEditorInput) obj; - if (sourceFile == null) { - if (other.sourceFile != null) { - return false; - } - } else if (!sourceFile.equals(other.sourceFile)) - return false; - return true; - } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + + ((sourceFile == null) ? 0 : sourceFile.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + final STAnnotatedSourceNotFoundEditorInput other = (STAnnotatedSourceNotFoundEditorInput) obj; + if (sourceFile == null) { + if (other.sourceFile != null) { + return false; + } + } else if (!sourceFile.equals(other.sourceFile)) + return false; + return true; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.docs/build-helper.xml b/gcov/org.eclipse.linuxtools.gcov.docs/build-helper.xml index 8b2a68cdf4..73561c4eaf 100644 --- a/gcov/org.eclipse.linuxtools.gcov.docs/build-helper.xml +++ b/gcov/org.eclipse.linuxtools.gcov.docs/build-helper.xml @@ -5,7 +5,7 @@ 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 --> @@ -14,58 +14,58 @@ Generate Eclipse help content for the Linux Tools gcov user guide </description> - <property name="gcov.help.doc.url.base" value="http://wiki.eclipse.org"/> - <property name="gcov.wiki.url.base" value="${gcov.help.doc.url.base}/Linux_Tools_Project/GCov"/> - <property name="imageFolder" value="images"/> + <property name="gcov.help.doc.url.base" value="http://wiki.eclipse.org"/> + <property name="gcov.wiki.url.base" value="${gcov.help.doc.url.base}/Linux_Tools_Project/GCov"/> + <property name="imageFolder" value="images"/> - <path id="wikitext.tasks.classpath"> - <!-- Replace dir with the dir you have wikitext installed into.--> - <fileset dir="/usr/share/eclipse/dropins/mylyn/eclipse/plugins"> - <include name="org.eclipse.mylyn.wikitext.*core*.jar" /> - </fileset> - </path> - <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties" /> - <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" /> + <path id="wikitext.tasks.classpath"> + <!-- Replace dir with the dir you have wikitext installed into.--> + <fileset dir="/usr/share/eclipse/dropins/mylyn/eclipse/plugins"> + <include name="org.eclipse.mylyn.wikitext.*core*.jar" /> + </fileset> + </path> + <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties" /> + <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" /> - <target name="all" description="Generate Eclipse help content for the Linux Tools gcov user guide"> - <mediawiki-to-eclipse-help wikiBaseUrl="${gcov.help.doc.url.base}" title="GCov User Guide" formatoutput="true" dest="." templateExcludes="*eclipseproject*"> + <target name="all" description="Generate Eclipse help content for the Linux Tools gcov user guide"> + <mediawiki-to-eclipse-help wikiBaseUrl="${gcov.help.doc.url.base}" title="GCov User Guide" formatoutput="true" dest="." templateExcludes="*eclipseproject*"> - <path name="Linux_Tools_Project/GCov/User_Guide" title="GCov Plug-in User Guide" generateToc="false"/> - <stylesheet url="book.css" /> - <pageAppendum> + <path name="Linux_Tools_Project/GCov/User_Guide" title="GCov Plug-in User Guide" generateToc="false"/> + <stylesheet url="book.css" /> + <pageAppendum> = Updating This Document = - -This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit + +This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit http://wiki.eclipse.org/Linux_Tools_Project/GCov/User_Guide </pageAppendum> - </mediawiki-to-eclipse-help> - <antcall target="test" /> - </target> + </mediawiki-to-eclipse-help> + <antcall target="test" /> + </target> - <target name="test" description="verify that all of the HTML files are well-formed XML"> - <echo level="info"> + <target name="test" description="verify that all of the HTML files are well-formed XML"> + <echo level="info"> Validating help content XML and HTML files: The Eclipse help system expects well-formed XML - + If validation fails it is because either: - + * the userguide source code is poorly formed, or * the WikiText MediaWiki parser has a bug - + Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source, or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block) - </echo> + </echo> - <!-- - Don't bother with DTD validation: we only care if the files are well-formed. - We therefore provide an empty DTD - --> - <echo file="tmp/__empty.dtd" message="" /> - <xmlvalidate lenient="true"> - <fileset dir="Linux_Tools_Project"> - <include name="**/*.html" /> - </fileset> - <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd" /> - </xmlvalidate> - <delete dir="tmp"/> - </target> + <!-- + Don't bother with DTD validation: we only care if the files are well-formed. + We therefore provide an empty DTD + --> + <echo file="tmp/__empty.dtd" message="" /> + <xmlvalidate lenient="true"> + <fileset dir="Linux_Tools_Project"> + <include name="**/*.html" /> + </fileset> + <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd" /> + </xmlvalidate> + <delete dir="tmp"/> + </target> </project> diff --git a/gcov/org.eclipse.linuxtools.gcov.docs/toc.xml b/gcov/org.eclipse.linuxtools.gcov.docs/toc.xml index 603e401e10..aad7a23e6d 100644 --- a/gcov/org.eclipse.linuxtools.gcov.docs/toc.xml +++ b/gcov/org.eclipse.linuxtools.gcov.docs/toc.xml @@ -1,12 +1,12 @@ <?xml version='1.0' encoding='utf-8' ?> <toc topic="Linux_Tools_Project/GCov/User_Guide/User-Guide.html" label="GCov User Guide"> - <topic href="Linux_Tools_Project/GCov/User_Guide/User-Guide.html" label="GCov Plug-in User Guide"> - <topic href="Linux_Tools_Project/GCov/User_Guide/User-Guide.html" label="Overview"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Installation-and-Set-Up.html" label="Installation and Set-Up"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Opening-gcov-result.html" label="Opening gcov result"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Profiling-Code-Coverage.html" label="Profiling Code Coverage"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Gcov-main-view.html" label="Gcov main view"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Troubleshooting.html" label="Troubleshooting"></topic> - <topic href="Linux_Tools_Project/GCov/User_Guide/Updating-This-Document.html" label="Updating This Document"></topic> - </topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/User-Guide.html" label="GCov Plug-in User Guide"> + <topic href="Linux_Tools_Project/GCov/User_Guide/User-Guide.html" label="Overview"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Installation-and-Set-Up.html" label="Installation and Set-Up"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Opening-gcov-result.html" label="Opening gcov result"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Profiling-Code-Coverage.html" label="Profiling Code Coverage"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Gcov-main-view.html" label="Gcov main view"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Troubleshooting.html" label="Troubleshooting"></topic> + <topic href="Linux_Tools_Project/GCov/User_Guide/Updating-This-Document.html" label="Updating This Document"></topic> + </topic> </toc>
\ No newline at end of file diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/plugin.xml b/gcov/org.eclipse.linuxtools.gcov.launch/plugin.xml index 32b82373cf..5039066a27 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/plugin.xml +++ b/gcov/org.eclipse.linuxtools.gcov.launch/plugin.xml @@ -12,5 +12,5 @@ tabgroup="org.eclipse.linuxtools.internal.gcov.launch.GcovLaunchConfigurationTabGroup" type="coverage"> </provider> - </extension> + </extension> </plugin> diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationDelegate.java b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationDelegate.java index 123083e7b2..d562a61396 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationDelegate.java +++ b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationDelegate.java @@ -41,118 +41,118 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; public class GcovLaunchConfigurationDelegate extends AbstractCLaunchDelegate { - protected ILaunchConfiguration config; - - @Override - public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { - this.config = config; - IPath exePath = getExePath(config); - - /* - * this code written by QNX Software Systems and others and was - * originally in the CDT under LocalCDILaunchDelegate::RunLocalApplication - */ - //set up and launch the local c/c++ program - IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(getProject()); - - File workDir = getWorkingDirectory(config); - if (workDir == null) { - workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$ - } - String arguments[] = getProgramArgumentsArray( config ); - - //add a listener for termination of the launch - ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager(); - lmgr.addLaunchListener(new LaunchTerminationWatcher(launch, exePath)); - - Process process = launcher.execute(exePath, arguments, getEnvironment(config), new Path(workDir.getAbsolutePath()), monitor); - - DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ) ); - - } - - //A class used to listen for the termination of the current launch, and - // run some functions when it is finished. - class LaunchTerminationWatcher implements ILaunchesListener2 { - private ILaunch launch; - private IPath exePath; - public LaunchTerminationWatcher(ILaunch il, IPath exePath) { - launch = il; - this.exePath = exePath; - } - @Override - public void launchesTerminated(ILaunch[] launches) { - - for (ILaunch l : launches) { - /** - * Dump samples from the daemon, - * shut down the daemon, - * activate the OProfile view (open it if it isn't already), - * refresh the view (which parses the data/ui model and displays it). - */ - if (l.equals(launch)) { - //need to run this in the ui thread otherwise get SWT Exceptions - // based on concurrency issues - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - String s = exePath.toOSString(); - CovManager cvrgeMnger = new CovManager(s, getProject()); - - try { - List<String> gcdaPaths = cvrgeMnger.getGCDALocations(); - if (gcdaPaths.isEmpty()) { - String title = GcovLaunchMessages.GcovCompilerOptions_msg; - String message = GcovLaunchMessages.GcovCompileAgain_msg; - Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openWarning(parent, title, message); - } - CovView.displayCovResults(s, null); - GcovAnnotationModelTracker.getInstance().addProject(getProject(), exePath); - GcovAnnotationModelTracker.getInstance().annotateAllCEditors(); - } catch (InterruptedException e) { - // Do nothing - } - } - }); - } - } - - } - @Override - public void launchesAdded(ILaunch[] launches) { /* dont care */} - @Override - public void launchesChanged(ILaunch[] launches) { /* dont care */ } - @Override - public void launchesRemoved(ILaunch[] launches) { /* dont care */ } - - } - - @Override - protected String getPluginID() { - return GcovLaunchPlugin.PLUGIN_ID; - } - - /* all these functions exist to be overridden by the test class in order to allow launch testing */ - - private IProject getProject(){ - try{ - return CDebugUtils.verifyCProject(config).getProject(); - } catch (CoreException e) { - e.printStackTrace(); - } - return null; - } - /** - * - * Return the exe path of the binary to be profiled. - * @param config - * @return the exe path of the binary stored in the configuration - * @throws CoreException - * @since 1.1 - */ - private static IPath getExePath(ILaunchConfiguration config) throws CoreException{ - return CDebugUtils.verifyProgramPath( config ); - } + protected ILaunchConfiguration config; + + @Override + public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { + this.config = config; + IPath exePath = getExePath(config); + + /* + * this code written by QNX Software Systems and others and was + * originally in the CDT under LocalCDILaunchDelegate::RunLocalApplication + */ + //set up and launch the local c/c++ program + IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(getProject()); + + File workDir = getWorkingDirectory(config); + if (workDir == null) { + workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$ + } + String arguments[] = getProgramArgumentsArray( config ); + + //add a listener for termination of the launch + ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager(); + lmgr.addLaunchListener(new LaunchTerminationWatcher(launch, exePath)); + + Process process = launcher.execute(exePath, arguments, getEnvironment(config), new Path(workDir.getAbsolutePath()), monitor); + + DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ) ); + + } + + //A class used to listen for the termination of the current launch, and + // run some functions when it is finished. + class LaunchTerminationWatcher implements ILaunchesListener2 { + private ILaunch launch; + private IPath exePath; + public LaunchTerminationWatcher(ILaunch il, IPath exePath) { + launch = il; + this.exePath = exePath; + } + @Override + public void launchesTerminated(ILaunch[] launches) { + + for (ILaunch l : launches) { + /** + * Dump samples from the daemon, + * shut down the daemon, + * activate the OProfile view (open it if it isn't already), + * refresh the view (which parses the data/ui model and displays it). + */ + if (l.equals(launch)) { + //need to run this in the ui thread otherwise get SWT Exceptions + // based on concurrency issues + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + String s = exePath.toOSString(); + CovManager cvrgeMnger = new CovManager(s, getProject()); + + try { + List<String> gcdaPaths = cvrgeMnger.getGCDALocations(); + if (gcdaPaths.isEmpty()) { + String title = GcovLaunchMessages.GcovCompilerOptions_msg; + String message = GcovLaunchMessages.GcovCompileAgain_msg; + Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + MessageDialog.openWarning(parent, title, message); + } + CovView.displayCovResults(s, null); + GcovAnnotationModelTracker.getInstance().addProject(getProject(), exePath); + GcovAnnotationModelTracker.getInstance().annotateAllCEditors(); + } catch (InterruptedException e) { + // Do nothing + } + } + }); + } + } + + } + @Override + public void launchesAdded(ILaunch[] launches) { /* dont care */} + @Override + public void launchesChanged(ILaunch[] launches) { /* dont care */ } + @Override + public void launchesRemoved(ILaunch[] launches) { /* dont care */ } + + } + + @Override + protected String getPluginID() { + return GcovLaunchPlugin.PLUGIN_ID; + } + + /* all these functions exist to be overridden by the test class in order to allow launch testing */ + + private IProject getProject(){ + try{ + return CDebugUtils.verifyCProject(config).getProject(); + } catch (CoreException e) { + e.printStackTrace(); + } + return null; + } + /** + * + * Return the exe path of the binary to be profiled. + * @param config + * @return the exe path of the binary stored in the configuration + * @throws CoreException + * @since 1.1 + */ + private static IPath getExePath(ILaunchConfiguration config) throws CoreException{ + return CDebugUtils.verifyProgramPath( config ); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationTabGroup.java b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationTabGroup.java index 845fb5ad02..3a115cf790 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationTabGroup.java +++ b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchConfigurationTabGroup.java @@ -7,18 +7,18 @@ * * Contributors: * Red Hat Inc. - initial API and implementation - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.launch; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup; public class GcovLaunchConfigurationTabGroup extends - ProfileLaunchConfigurationTabGroup { + ProfileLaunchConfigurationTabGroup { + + @Override + public AbstractLaunchConfigurationTab[] getProfileTabs() { + return new AbstractLaunchConfigurationTab[0]; + } - @Override - public AbstractLaunchConfigurationTab[] getProfileTabs() { - return new AbstractLaunchConfigurationTab[0]; - } - } diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchMessages.java b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchMessages.java index 16537adcf9..a9b0d25c4f 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchMessages.java +++ b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchMessages.java @@ -14,11 +14,11 @@ import org.eclipse.osgi.util.NLS; public class GcovLaunchMessages extends NLS { - public static String GcovCompilerOptions_msg; - public static String GcovCompileAgain_msg; + public static String GcovCompilerOptions_msg; + public static String GcovCompileAgain_msg; - static { - NLS.initializeMessages(GcovLaunchMessages.class.getName(), GcovLaunchMessages.class); - } + static { + NLS.initializeMessages(GcovLaunchMessages.class.getName(), GcovLaunchMessages.class); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchPlugin.java b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchPlugin.java index 6ddafaddec..800e3d6564 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchPlugin.java +++ b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchPlugin.java @@ -16,10 +16,10 @@ package org.eclipse.linuxtools.internal.gcov.launch; * The main plugin class to be used in the desktop. */ public class GcovLaunchPlugin { - //shared cache instance for configuration + //shared cache instance for configuration - public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov.launch"; //$NON-NLS-1$ - public static final String ID_GCOV_VIEW = "org.eclipse.linuxtools.gcov.view"; //$NON-NLS-1$ - public static final String LAUNCH_ID = PLUGIN_ID + ".gcovLaunch"; //$NON-NLS-1$ + public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov.launch"; //$NON-NLS-1$ + public static final String ID_GCOV_VIEW = "org.eclipse.linuxtools.gcov.view"; //$NON-NLS-1$ + public static final String LAUNCH_ID = PLUGIN_ID + ".gcovLaunch"; //$NON-NLS-1$ } diff --git a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchShortcut.java b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchShortcut.java index e738f532f5..c5536ab836 100644 --- a/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchShortcut.java +++ b/gcov/org.eclipse.linuxtools.gcov.launch/src/org/eclipse/linuxtools/internal/gcov/launch/GcovLaunchShortcut.java @@ -8,7 +8,7 @@ * Contributors: * Elliott Baron <ebaron@redhat.com> - initial API and implementation * Red Hat Inc. - modification to use code in this plug-in - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.launch; import org.eclipse.debug.core.ILaunchConfigurationType; @@ -18,18 +18,18 @@ import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut; public class GcovLaunchShortcut extends ProfileLaunchShortcut { - @Override - protected void setDefaultProfileAttributes( - ILaunchConfigurationWorkingCopy wc) { - } + @Override + protected void setDefaultProfileAttributes( + ILaunchConfigurationWorkingCopy wc) { + } - /** - * Method getValgrindLaunchConfigType. - * @return ILaunchConfigurationType - */ - @Override - protected ILaunchConfigurationType getLaunchConfigType() { - return getLaunchManager().getLaunchConfigurationType(GcovLaunchPlugin.LAUNCH_ID); - } + /** + * Method getValgrindLaunchConfigType. + * @return ILaunchConfigurationType + */ + @Override + protected ILaunchConfigurationType getLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType(GcovLaunchPlugin.LAUNCH_ID); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/pom.xml b/gcov/org.eclipse.linuxtools.gcov.test/pom.xml index 720424295a..6f3b4e3349 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/pom.xml +++ b/gcov/org.eclipse.linuxtools.gcov.test/pom.xml @@ -36,7 +36,7 @@ </excludes> <testSuite>org.eclipse.linuxtools.gcov.test</testSuite> <testClass>org.eclipse.linuxtools.internal.gcov.test.AllGcovTests</testClass> - <useUIHarness>true</useUIHarness> + <useUIHarness>true</useUIHarness> <useUIThread>false</useUIThread> <product>org.eclipse.platform.ide</product> <dependencies> @@ -50,7 +50,7 @@ <artifactId>org.eclipse.platform.feature.group</artifactId> <version>${sdk-version}</version> </dependency> - </dependencies> + </dependencies> </configuration> </plugin> </plugins> diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java index 83c006133e..c2a8fabc05 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java @@ -5,9 +5,9 @@ import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ - GcovTestC.class, - GcovTestCPP.class, - GcovTestCLibrary.class + GcovTestC.class, + GcovTestCPP.class, + GcovTestCLibrary.class }) public class AllGcovTests { diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java index b423f3278d..0e4893b964 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java @@ -53,453 +53,453 @@ import org.junit.After; import org.osgi.framework.FrameworkUtil; public abstract class GcovTest { - private static final String PROJECT_EXPLORER = "Project Explorer"; - private static SWTBotView projectExplorer; - private static SWTBotShell mainShell; - - private static final class UnCheckTest implements ICondition { - SWTBotCheckBox checkBox; - - public UnCheckTest(SWTBotCheckBox bot) { - checkBox = bot; - } - - @Override - public boolean test() { - return !checkBox.isChecked(); - } - - @Override - public void init(SWTBot bot) { - } - - @Override - public String getFailureMessage() { - return null; - } - } - - private static class NodeAvailableAndSelect extends DefaultCondition { - - private SWTBotTree tree; - private String parent; - private String node; - - /** - * Wait for a tree node (with a known parent) to become visible, and select it - * when it does. Note that this wait condition should only be used after having - * made an attempt to reveal the node. - * @param tree The SWTBotTree that contains the node to select. - * @param parent The text of the parent node that contains the node to select. - * @param node The text of the node to select. - */ - NodeAvailableAndSelect(SWTBotTree tree, String parent, String node){ - this.tree = tree; - this.node = node; - this.parent = parent; - } - - @Override - public boolean test() { - try { - SWTBotTreeItem parentNode = tree.getTreeItem(parent); - parentNode.getNode(node).select(); - return true; - } catch (WidgetNotFoundException e) { - return false; - } - } - - @Override - public String getFailureMessage() { - return "Timed out waiting for " + node; //$NON-NLS-1$ - } - } - - public static SWTWorkbenchBot init(String PROJECT_NAME, String PROJECT_TYPE) - throws Exception { - SWTWorkbenchBot bot = new SWTWorkbenchBot(); - bot.captureScreenshot(PROJECT_NAME + ".beforeClass.1.jpg"); - try { - bot.viewByTitle("Welcome").close(); - // hide Subclipse Usage stats popup if present/installed - bot.shell("Subclipse Usage").activate(); - bot.button("Cancel").click(); - } catch (WidgetNotFoundException e) { - // ignore - } - - bot.perspectiveByLabel("C/C++").activate(); - for (SWTBotShell sh : bot.shells()) { - if (sh.getText().startsWith("C/C++")) { - sh.activate(); - bot.waitUntil(Conditions.shellIsActive(sh.getText())); - mainShell = sh; - break; - } - } - - bot.captureScreenshot(PROJECT_NAME + ".beforeClass.2.jpg"); - // Turn off automatic building by default - SWTBotMenu windowsMenu = bot.menu("Window"); - windowsMenu.menu("Preferences").click(); - SWTBotShell shell = bot.shell("Preferences"); - shell.activate(); - bot.text().setText("Workspace"); - bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Workspace")); - SWTBotCheckBox buildAuto = bot.checkBox("Build automatically"); - if (buildAuto != null && buildAuto.isChecked()) { - buildAuto.click(); - } - bot.waitUntil(new UnCheckTest(buildAuto)); - bot.button("Apply").click(); - bot.button("OK").click(); - bot.waitUntil(Conditions.shellCloses(shell)); - - - // define & repopulate project explorer - projectExplorer = bot.viewByTitle(PROJECT_EXPLORER); - GcovTest.createProject(bot, PROJECT_NAME, PROJECT_TYPE); - GcovTest.populateProject(bot, PROJECT_NAME); - GcovTest.compileProject(bot, PROJECT_NAME); - return bot; - } - - @After - public void cleanUp() { - SWTWorkbenchBot bot = new SWTWorkbenchBot(); - SWTBotShell[] shells = bot.shells(); - for (final SWTBotShell shell : shells) { - String shellTitle = shell.getText(); - if (shellTitle.length() > 0 - && !shellTitle.startsWith("SystemTap IDE") - && !shellTitle.startsWith("Quick Access")) { - UIThreadRunnable.syncExec(new VoidResult() { - @Override - public void run() { - if (shell.widget.getParent() != null) { - shell.close(); - } - } - }); - } - } - bot.closeAllEditors(); - } - - public static void cleanup(SWTWorkbenchBot bot) { - // clear project explorer - exitProjectFolder(bot); - projectExplorer.setFocus(); - SWTBotTree treeBot = projectExplorer.bot().tree(); - for (SWTBotTreeItem treeItem : treeBot.getAllItems()) { - removeTreeItem(bot, treeItem); - } - } - - /** - * Enter the project folder so as to avoid expanding trees later - */ - private static SWTBotView enterProjectFolder(SWTWorkbenchBot bot, String projectName) { - projectExplorer.bot().tree().select(projectName). - contextMenu("Go Into").click(); - bot.waitUntil(waitForWidget(WidgetMatcherFactory.withText( - projectName), projectExplorer.getWidget())); - return projectExplorer; - } - - /** - * Exit from the project tree. - */ - private static void exitProjectFolder(SWTWorkbenchBot bot) { - try { - SWTBotToolbarButton forwardButton = projectExplorer.toolbarPushButton("Forward"); - projectExplorer.toolbarPushButton("Back to Workspace").click(); - bot.waitUntil(widgetIsEnabled(forwardButton)); - } catch (WidgetNotFoundException e) { - // Already exited from project folder - } - } - - public static void createProject(SWTWorkbenchBot bot, String projectName, String projectType) { - mainShell.activate(); - SWTBotMenu fileMenu = bot.menu("File"); - SWTBotMenu newMenu = fileMenu.menu("New"); - SWTBotMenu projectMenu = newMenu.menu(projectType); - projectMenu.click(); - - SWTBotShell shell = bot.shell(projectType); - shell.activate(); - - bot.tree().expandNode("Makefile project").select("Empty Project"); - bot.textWithLabel("Project name:").setText(projectName); - bot.table().select("Linux GCC"); - - bot.button("Next >").click(); - bot.button("Finish").click(); - bot.waitUntil(Conditions.shellCloses(shell)); - } - - public static void populateProject(SWTWorkbenchBot bot, String projectName) throws Exception { - IProject project = ResourcesPlugin.getWorkspace().getRoot() - .getProject(projectName); - try (InputStream is = FileLocator.openStream( - FrameworkUtil.getBundle(GcovTest.class), new Path("resource/" - + projectName + "/content"), false); - LineNumberReader lnr = new LineNumberReader( - new InputStreamReader(is))) { - String filename; - while (null != (filename = lnr.readLine())) { - final ProgressMonitor pm = new ProgressMonitor(); - final IFile ifile = project.getFile(filename); - InputStream fis = FileLocator.openStream(FrameworkUtil - .getBundle(GcovTest.class), new Path("resource/" - + projectName + "/" + filename), false); - ifile.create(fis, true, pm); - bot.waitUntil(new DefaultCondition() { - - @Override - public boolean test() { - return pm.isDone(); - } - - @Override - public String getFailureMessage() { - return ifile + " not yet created after 6000ms"; - } - }, 6000); - } - } - } - - public static void compileProject(SWTWorkbenchBot bot, String projectName) { - SWTBotTree treeBot = projectExplorer.bot().tree(); - treeBot.setFocus(); - treeBot = treeBot.select(projectName); - bot.waitUntil(Conditions.treeHasRows(treeBot, 1)); - mainShell.activate(); - SWTBotMenu menu = bot.menu("Build Project"); - menu.click(); - bot.waitUntil(new JobsRunning(ResourcesPlugin.FAMILY_MANUAL_BUILD), 30000); - } - - private static void removeTreeItem(SWTWorkbenchBot bot, - SWTBotTreeItem treeItem) { - String shellTitle = "Delete Resources"; - treeItem.contextMenu("Delete").click(); - Matcher<Shell> withText = withText(shellTitle); - bot.waitUntil(Conditions.waitForShell(withText)); - SWTBotShell deleteShell = bot.shell(shellTitle); - deleteShell.activate(); - bot.button("OK").click(); - // Another shell (with the same name!) may appear if resources aren't synced. - // If it does appear, it will be a child of the first shell. - try { - bot.waitUntil(Conditions.shellCloses(deleteShell)); - } catch (TimeoutException e) { - SWTBotShell deleteShell2; - try { - deleteShell2 = bot.shell(shellTitle, deleteShell.widget); - } catch (WidgetNotFoundException e2) { - // If the other shell isn't found, that means the first one just didn't close. - System.out.println("ERROR: \"Delete Resources\" shell did not close, and no extra shell appeared"); - throw e; - } - System.out.println("Deleting out-of-sync resources - new \"Delete Resources\" shell found"); - deleteShell2.activate(); - bot.button("Continue").click(); - bot.waitUntil(Conditions.shellCloses(deleteShell2)); - bot.waitUntil(Conditions.shellCloses(deleteShell)); - } - } - - private static TreeSet<String> getGcovFiles(SWTWorkbenchBot bot, String projectName) throws Exception { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - TreeSet<String> ret = new TreeSet<>(); - for (IResource r : project.members()) { - if (r.getType() == IResource.FILE && r.exists()) { - if (r.getName().endsWith(".gcda") || r.getName().endsWith(".gcno")) { - ret.add(r.getFullPath().toOSString()); - } - } - } - return ret; - } - - private static void testGcovSummary(SWTWorkbenchBot bot, String projectName, String filename, String binName, - boolean testProducedReference) throws Exception { - IPath filePath = new Path(filename); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); - String binPath = file.getProject().getFile(binName).getLocation().toOSString(); - - openResource(bot, file.getName()); - Matcher<Shell> withText = withText("Gcov - Open coverage results..."); - bot.waitUntil(Conditions.waitForShell(withText)); - - SWTBotShell shell = bot.shell("Gcov - Open coverage results..."); - shell.activate(); - bot.textInGroup("Binary File", 0).setText(binPath); - bot.button("OK").click(); - bot.waitUntil(Conditions.shellCloses(shell)); - - SWTBotView botView = bot.viewByTitle("gcov"); - // The following cannot be tested on 4.2 because the SWTBot implementation of toolbarButton() - // is broken there because it relies PartPane having a method getPane() which is no longer true. - botView.toolbarButton("Sort coverage per function").click(); - dumpCSV(bot, botView, projectName, "function", testProducedReference); - botView.toolbarButton("Sort coverage per file").click(); - dumpCSV(bot, botView, projectName, "file", testProducedReference); - botView.toolbarButton("Sort coverage per folder").click(); - dumpCSV(bot, botView, projectName, "folder", testProducedReference); - botView.close(); - } - - private static void openResource(SWTWorkbenchBot bot, String fileName) { - mainShell.activate(); - bot.menu("Navigate").menu("Open Resource...").click(); - bot.waitUntil(Conditions.shellIsActive("Open Resource")); - SWTBotShell shell = bot.shell("Open Resource"); - shell.activate(); - bot.text().setText(fileName); - bot.button("Open").click(); - bot.waitUntil(Conditions.shellCloses(shell)); - } - - private static void testGcovFileDetails(SWTWorkbenchBot bot, String projectName, String filename, String binName) throws Exception { - IPath filePath = new Path(filename); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); - String binPath = file.getProject().getFile(binName).getLocation().toOSString(); - - openResource(bot, file.getName()); - Matcher<Shell> withText = withText("Gcov - Open coverage results..."); - bot.waitUntil(Conditions.waitForShell(withText)); - - SWTBotShell shell = bot.shell("Gcov - Open coverage results..."); - shell.activate(); - bot.textInGroup("Binary File", 0).setText(binPath); - SWTBotRadio button = bot.radioInGroup("Coverage result", 0); - button.click(); - bot.button("OK").click(); - bot.waitUntil(Conditions.shellCloses(shell)); - - SWTBotEditor editor = bot.activeEditor(); - SWTBotEclipseEditor edt = editor.toTextEditor(); /* just to verify that the correct file was found */ - edt.close(); - } - - private static void testGcovLaunchSummary(SWTWorkbenchBot bot, String projectName, String binName) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - String binLocation = project.getFile(binName).getLocation().toOSString(); - IPath binPath = new Path(binLocation); - IFile binFile = ResourcesPlugin.getWorkspace().getRoot().getFile(binPath); - - SWTBot viewBot = projectExplorer.bot(); - - SWTBotTree treeBot = viewBot.tree(); - treeBot.setFocus(); - // We need to select the binary, but in the tree, it may have additional info appended to the - // name such as [x86_64/le]. So, we look at all nodes of the project and look for the one that - // starts with our binary file name. We can then select the node. - enterProjectFolder(bot, projectName); - bot.waitUntil(Conditions.waitForWidget(withText(projectName), projectExplorer.getWidget())); - - SWTBotTreeItem[] nodes = treeBot.getAllItems(); - String binNodeName = binFile.getName(); - for (SWTBotTreeItem node : nodes) { - if (node.getText().startsWith(binNodeName)) { - node.select(); - break; - } - } - assertNotEquals(treeBot.selectionCount(), 0); - String menuItem = "Profiling Tools"; - String subMenuItem = "1 Profile Code Coverage"; - click(contextMenu(treeBot, menuItem, subMenuItem)); - - final boolean result[] = new boolean[1]; - Display.getDefault().syncExec(new Runnable() { - - @Override - public void run() { - try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage() - .showView("org.eclipse.linuxtools.gcov.view"); - result[0] = true; - } catch (PartInitException e) { - result[0] = false; - } - } - }); - assertTrue(result[0]); - SWTBotView botView = bot.viewByTitle("gcov"); - - botView.close(); - } - - private static void dumpCSV(SWTWorkbenchBot bot, SWTBotView botView, String projectName, String type, - boolean testProducedReference) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - botView.toolbarButton("Export to CSV").click(); - SWTBotShell shell = bot.shell("Export to CSV"); - shell.activate(); - String s = project.getLocation() + "/" + type + "-dump.csv"; - new File(s).delete(); - bot.text().setText(s); - bot.button("OK").click(); - bot.waitUntil(new JobsRunning(STExportToCSVAction.EXPORT_TO_CSV_JOB_FAMILY), 3000); - if (testProducedReference) { - String ref = STJunitUtils.getAbsolutePath(FrameworkUtil.getBundle(GcovTest.class).getSymbolicName(), "resource/" + projectName + "/" + type + ".csv"); - STJunitUtils.compareIgnoreEOL(project.getLocation() + "/" + type + "-dump.csv", ref, false); - } - } - - public static void openGcovFileDetails(SWTWorkbenchBot bot, String projectName) throws Exception { - openGcovFileDetails(bot, projectName, "a.out"); - } - - public static void openGcovSummary(SWTWorkbenchBot bot, String projectName, boolean testProducedReference) - throws Exception { - openGcovSummary(bot, projectName, "a.out", testProducedReference); - } - - public static void openGcovSummary(SWTWorkbenchBot bot, String projectName, String binName, - boolean testProducedReference) throws Exception { - TreeSet<String> ts = getGcovFiles(bot, projectName); - for (String string : ts) { - testGcovSummary(bot, projectName, string, binName, testProducedReference); - } - } - - public static void openGcovFileDetails(SWTWorkbenchBot bot, - String projectName, String binName) throws Exception { - TreeSet<String> ts = getGcovFiles(bot, projectName); - for (String string : ts) { - testGcovFileDetails(bot, projectName, string, binName); - } - } - - public static void openGcovSummaryByLaunch(SWTWorkbenchBot bot, - String projectName) { - testGcovLaunchSummary(bot, projectName, "a.out"); - } - - /** - * Click on the specified MenuItem. - * @param menuItem MenuItem item to click - */ - private static void click(final MenuItem menuItem) { - final Event event = new Event(); - event.time = (int) System.currentTimeMillis(); - event.widget = menuItem; - event.display = menuItem.getDisplay(); - event.type = SWT.Selection; - - UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() { - @Override - public void run() { - menuItem.notifyListeners(SWT.Selection, event); - } - }); - } + private static final String PROJECT_EXPLORER = "Project Explorer"; + private static SWTBotView projectExplorer; + private static SWTBotShell mainShell; + + private static final class UnCheckTest implements ICondition { + SWTBotCheckBox checkBox; + + public UnCheckTest(SWTBotCheckBox bot) { + checkBox = bot; + } + + @Override + public boolean test() { + return !checkBox.isChecked(); + } + + @Override + public void init(SWTBot bot) { + } + + @Override + public String getFailureMessage() { + return null; + } + } + + private static class NodeAvailableAndSelect extends DefaultCondition { + + private SWTBotTree tree; + private String parent; + private String node; + + /** + * Wait for a tree node (with a known parent) to become visible, and select it + * when it does. Note that this wait condition should only be used after having + * made an attempt to reveal the node. + * @param tree The SWTBotTree that contains the node to select. + * @param parent The text of the parent node that contains the node to select. + * @param node The text of the node to select. + */ + NodeAvailableAndSelect(SWTBotTree tree, String parent, String node){ + this.tree = tree; + this.node = node; + this.parent = parent; + } + + @Override + public boolean test() { + try { + SWTBotTreeItem parentNode = tree.getTreeItem(parent); + parentNode.getNode(node).select(); + return true; + } catch (WidgetNotFoundException e) { + return false; + } + } + + @Override + public String getFailureMessage() { + return "Timed out waiting for " + node; //$NON-NLS-1$ + } + } + + public static SWTWorkbenchBot init(String PROJECT_NAME, String PROJECT_TYPE) + throws Exception { + SWTWorkbenchBot bot = new SWTWorkbenchBot(); + bot.captureScreenshot(PROJECT_NAME + ".beforeClass.1.jpg"); + try { + bot.viewByTitle("Welcome").close(); + // hide Subclipse Usage stats popup if present/installed + bot.shell("Subclipse Usage").activate(); + bot.button("Cancel").click(); + } catch (WidgetNotFoundException e) { + // ignore + } + + bot.perspectiveByLabel("C/C++").activate(); + for (SWTBotShell sh : bot.shells()) { + if (sh.getText().startsWith("C/C++")) { + sh.activate(); + bot.waitUntil(Conditions.shellIsActive(sh.getText())); + mainShell = sh; + break; + } + } + + bot.captureScreenshot(PROJECT_NAME + ".beforeClass.2.jpg"); + // Turn off automatic building by default + SWTBotMenu windowsMenu = bot.menu("Window"); + windowsMenu.menu("Preferences").click(); + SWTBotShell shell = bot.shell("Preferences"); + shell.activate(); + bot.text().setText("Workspace"); + bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Workspace")); + SWTBotCheckBox buildAuto = bot.checkBox("Build automatically"); + if (buildAuto != null && buildAuto.isChecked()) { + buildAuto.click(); + } + bot.waitUntil(new UnCheckTest(buildAuto)); + bot.button("Apply").click(); + bot.button("OK").click(); + bot.waitUntil(Conditions.shellCloses(shell)); + + + // define & repopulate project explorer + projectExplorer = bot.viewByTitle(PROJECT_EXPLORER); + GcovTest.createProject(bot, PROJECT_NAME, PROJECT_TYPE); + GcovTest.populateProject(bot, PROJECT_NAME); + GcovTest.compileProject(bot, PROJECT_NAME); + return bot; + } + + @After + public void cleanUp() { + SWTWorkbenchBot bot = new SWTWorkbenchBot(); + SWTBotShell[] shells = bot.shells(); + for (final SWTBotShell shell : shells) { + String shellTitle = shell.getText(); + if (shellTitle.length() > 0 + && !shellTitle.startsWith("SystemTap IDE") + && !shellTitle.startsWith("Quick Access")) { + UIThreadRunnable.syncExec(new VoidResult() { + @Override + public void run() { + if (shell.widget.getParent() != null) { + shell.close(); + } + } + }); + } + } + bot.closeAllEditors(); + } + + public static void cleanup(SWTWorkbenchBot bot) { + // clear project explorer + exitProjectFolder(bot); + projectExplorer.setFocus(); + SWTBotTree treeBot = projectExplorer.bot().tree(); + for (SWTBotTreeItem treeItem : treeBot.getAllItems()) { + removeTreeItem(bot, treeItem); + } + } + + /** + * Enter the project folder so as to avoid expanding trees later + */ + private static SWTBotView enterProjectFolder(SWTWorkbenchBot bot, String projectName) { + projectExplorer.bot().tree().select(projectName). + contextMenu("Go Into").click(); + bot.waitUntil(waitForWidget(WidgetMatcherFactory.withText( + projectName), projectExplorer.getWidget())); + return projectExplorer; + } + + /** + * Exit from the project tree. + */ + private static void exitProjectFolder(SWTWorkbenchBot bot) { + try { + SWTBotToolbarButton forwardButton = projectExplorer.toolbarPushButton("Forward"); + projectExplorer.toolbarPushButton("Back to Workspace").click(); + bot.waitUntil(widgetIsEnabled(forwardButton)); + } catch (WidgetNotFoundException e) { + // Already exited from project folder + } + } + + public static void createProject(SWTWorkbenchBot bot, String projectName, String projectType) { + mainShell.activate(); + SWTBotMenu fileMenu = bot.menu("File"); + SWTBotMenu newMenu = fileMenu.menu("New"); + SWTBotMenu projectMenu = newMenu.menu(projectType); + projectMenu.click(); + + SWTBotShell shell = bot.shell(projectType); + shell.activate(); + + bot.tree().expandNode("Makefile project").select("Empty Project"); + bot.textWithLabel("Project name:").setText(projectName); + bot.table().select("Linux GCC"); + + bot.button("Next >").click(); + bot.button("Finish").click(); + bot.waitUntil(Conditions.shellCloses(shell)); + } + + public static void populateProject(SWTWorkbenchBot bot, String projectName) throws Exception { + IProject project = ResourcesPlugin.getWorkspace().getRoot() + .getProject(projectName); + try (InputStream is = FileLocator.openStream( + FrameworkUtil.getBundle(GcovTest.class), new Path("resource/" + + projectName + "/content"), false); + LineNumberReader lnr = new LineNumberReader( + new InputStreamReader(is))) { + String filename; + while (null != (filename = lnr.readLine())) { + final ProgressMonitor pm = new ProgressMonitor(); + final IFile ifile = project.getFile(filename); + InputStream fis = FileLocator.openStream(FrameworkUtil + .getBundle(GcovTest.class), new Path("resource/" + + projectName + "/" + filename), false); + ifile.create(fis, true, pm); + bot.waitUntil(new DefaultCondition() { + + @Override + public boolean test() { + return pm.isDone(); + } + + @Override + public String getFailureMessage() { + return ifile + " not yet created after 6000ms"; + } + }, 6000); + } + } + } + + public static void compileProject(SWTWorkbenchBot bot, String projectName) { + SWTBotTree treeBot = projectExplorer.bot().tree(); + treeBot.setFocus(); + treeBot = treeBot.select(projectName); + bot.waitUntil(Conditions.treeHasRows(treeBot, 1)); + mainShell.activate(); + SWTBotMenu menu = bot.menu("Build Project"); + menu.click(); + bot.waitUntil(new JobsRunning(ResourcesPlugin.FAMILY_MANUAL_BUILD), 30000); + } + + private static void removeTreeItem(SWTWorkbenchBot bot, + SWTBotTreeItem treeItem) { + String shellTitle = "Delete Resources"; + treeItem.contextMenu("Delete").click(); + Matcher<Shell> withText = withText(shellTitle); + bot.waitUntil(Conditions.waitForShell(withText)); + SWTBotShell deleteShell = bot.shell(shellTitle); + deleteShell.activate(); + bot.button("OK").click(); + // Another shell (with the same name!) may appear if resources aren't synced. + // If it does appear, it will be a child of the first shell. + try { + bot.waitUntil(Conditions.shellCloses(deleteShell)); + } catch (TimeoutException e) { + SWTBotShell deleteShell2; + try { + deleteShell2 = bot.shell(shellTitle, deleteShell.widget); + } catch (WidgetNotFoundException e2) { + // If the other shell isn't found, that means the first one just didn't close. + System.out.println("ERROR: \"Delete Resources\" shell did not close, and no extra shell appeared"); + throw e; + } + System.out.println("Deleting out-of-sync resources - new \"Delete Resources\" shell found"); + deleteShell2.activate(); + bot.button("Continue").click(); + bot.waitUntil(Conditions.shellCloses(deleteShell2)); + bot.waitUntil(Conditions.shellCloses(deleteShell)); + } + } + + private static TreeSet<String> getGcovFiles(SWTWorkbenchBot bot, String projectName) throws Exception { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + TreeSet<String> ret = new TreeSet<>(); + for (IResource r : project.members()) { + if (r.getType() == IResource.FILE && r.exists()) { + if (r.getName().endsWith(".gcda") || r.getName().endsWith(".gcno")) { + ret.add(r.getFullPath().toOSString()); + } + } + } + return ret; + } + + private static void testGcovSummary(SWTWorkbenchBot bot, String projectName, String filename, String binName, + boolean testProducedReference) throws Exception { + IPath filePath = new Path(filename); + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); + String binPath = file.getProject().getFile(binName).getLocation().toOSString(); + + openResource(bot, file.getName()); + Matcher<Shell> withText = withText("Gcov - Open coverage results..."); + bot.waitUntil(Conditions.waitForShell(withText)); + + SWTBotShell shell = bot.shell("Gcov - Open coverage results..."); + shell.activate(); + bot.textInGroup("Binary File", 0).setText(binPath); + bot.button("OK").click(); + bot.waitUntil(Conditions.shellCloses(shell)); + + SWTBotView botView = bot.viewByTitle("gcov"); + // The following cannot be tested on 4.2 because the SWTBot implementation of toolbarButton() + // is broken there because it relies PartPane having a method getPane() which is no longer true. + botView.toolbarButton("Sort coverage per function").click(); + dumpCSV(bot, botView, projectName, "function", testProducedReference); + botView.toolbarButton("Sort coverage per file").click(); + dumpCSV(bot, botView, projectName, "file", testProducedReference); + botView.toolbarButton("Sort coverage per folder").click(); + dumpCSV(bot, botView, projectName, "folder", testProducedReference); + botView.close(); + } + + private static void openResource(SWTWorkbenchBot bot, String fileName) { + mainShell.activate(); + bot.menu("Navigate").menu("Open Resource...").click(); + bot.waitUntil(Conditions.shellIsActive("Open Resource")); + SWTBotShell shell = bot.shell("Open Resource"); + shell.activate(); + bot.text().setText(fileName); + bot.button("Open").click(); + bot.waitUntil(Conditions.shellCloses(shell)); + } + + private static void testGcovFileDetails(SWTWorkbenchBot bot, String projectName, String filename, String binName) throws Exception { + IPath filePath = new Path(filename); + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); + String binPath = file.getProject().getFile(binName).getLocation().toOSString(); + + openResource(bot, file.getName()); + Matcher<Shell> withText = withText("Gcov - Open coverage results..."); + bot.waitUntil(Conditions.waitForShell(withText)); + + SWTBotShell shell = bot.shell("Gcov - Open coverage results..."); + shell.activate(); + bot.textInGroup("Binary File", 0).setText(binPath); + SWTBotRadio button = bot.radioInGroup("Coverage result", 0); + button.click(); + bot.button("OK").click(); + bot.waitUntil(Conditions.shellCloses(shell)); + + SWTBotEditor editor = bot.activeEditor(); + SWTBotEclipseEditor edt = editor.toTextEditor(); /* just to verify that the correct file was found */ + edt.close(); + } + + private static void testGcovLaunchSummary(SWTWorkbenchBot bot, String projectName, String binName) { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + String binLocation = project.getFile(binName).getLocation().toOSString(); + IPath binPath = new Path(binLocation); + IFile binFile = ResourcesPlugin.getWorkspace().getRoot().getFile(binPath); + + SWTBot viewBot = projectExplorer.bot(); + + SWTBotTree treeBot = viewBot.tree(); + treeBot.setFocus(); + // We need to select the binary, but in the tree, it may have additional info appended to the + // name such as [x86_64/le]. So, we look at all nodes of the project and look for the one that + // starts with our binary file name. We can then select the node. + enterProjectFolder(bot, projectName); + bot.waitUntil(Conditions.waitForWidget(withText(projectName), projectExplorer.getWidget())); + + SWTBotTreeItem[] nodes = treeBot.getAllItems(); + String binNodeName = binFile.getName(); + for (SWTBotTreeItem node : nodes) { + if (node.getText().startsWith(binNodeName)) { + node.select(); + break; + } + } + assertNotEquals(treeBot.selectionCount(), 0); + String menuItem = "Profiling Tools"; + String subMenuItem = "1 Profile Code Coverage"; + click(contextMenu(treeBot, menuItem, subMenuItem)); + + final boolean result[] = new boolean[1]; + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + try { + PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage() + .showView("org.eclipse.linuxtools.gcov.view"); + result[0] = true; + } catch (PartInitException e) { + result[0] = false; + } + } + }); + assertTrue(result[0]); + SWTBotView botView = bot.viewByTitle("gcov"); + + botView.close(); + } + + private static void dumpCSV(SWTWorkbenchBot bot, SWTBotView botView, String projectName, String type, + boolean testProducedReference) { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + botView.toolbarButton("Export to CSV").click(); + SWTBotShell shell = bot.shell("Export to CSV"); + shell.activate(); + String s = project.getLocation() + "/" + type + "-dump.csv"; + new File(s).delete(); + bot.text().setText(s); + bot.button("OK").click(); + bot.waitUntil(new JobsRunning(STExportToCSVAction.EXPORT_TO_CSV_JOB_FAMILY), 3000); + if (testProducedReference) { + String ref = STJunitUtils.getAbsolutePath(FrameworkUtil.getBundle(GcovTest.class).getSymbolicName(), "resource/" + projectName + "/" + type + ".csv"); + STJunitUtils.compareIgnoreEOL(project.getLocation() + "/" + type + "-dump.csv", ref, false); + } + } + + public static void openGcovFileDetails(SWTWorkbenchBot bot, String projectName) throws Exception { + openGcovFileDetails(bot, projectName, "a.out"); + } + + public static void openGcovSummary(SWTWorkbenchBot bot, String projectName, boolean testProducedReference) + throws Exception { + openGcovSummary(bot, projectName, "a.out", testProducedReference); + } + + public static void openGcovSummary(SWTWorkbenchBot bot, String projectName, String binName, + boolean testProducedReference) throws Exception { + TreeSet<String> ts = getGcovFiles(bot, projectName); + for (String string : ts) { + testGcovSummary(bot, projectName, string, binName, testProducedReference); + } + } + + public static void openGcovFileDetails(SWTWorkbenchBot bot, + String projectName, String binName) throws Exception { + TreeSet<String> ts = getGcovFiles(bot, projectName); + for (String string : ts) { + testGcovFileDetails(bot, projectName, string, binName); + } + } + + public static void openGcovSummaryByLaunch(SWTWorkbenchBot bot, + String projectName) { + testGcovLaunchSummary(bot, projectName, "a.out"); + } + + /** + * Click on the specified MenuItem. + * @param menuItem MenuItem item to click + */ + private static void click(final MenuItem menuItem) { + final Event event = new Event(); + event.time = (int) System.currentTimeMillis(); + event.widget = menuItem; + event.display = menuItem.getDisplay(); + event.type = SWT.Selection; + + UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() { + @Override + public void run() { + menuItem.notifyListeners(SWT.Selection, event); + } + }); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestC.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestC.java index 6b37fe3ba1..50f7e4fdf5 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestC.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestC.java @@ -10,33 +10,33 @@ import org.junit.runner.RunWith; @RunWith(SWTBotJunit4ClassRunner.class) public class GcovTestC { - private static SWTWorkbenchBot bot; - - private static final String PROJECT_NAME = "Gcov_C_test"; - private static final String PROJECT_TYPE = "C Project"; - - @BeforeClass - public static void beforeClass() throws Exception { - bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); - } - - @AfterClass - public static void afterClass() { - GcovTest.cleanup(bot); - } - - @Test - public void openGcovFileDetails() throws Exception { - GcovTest.openGcovFileDetails(bot, PROJECT_NAME); - } - - @Test - public void openGcovSummary() throws Exception { - GcovTest.openGcovSummary(bot, PROJECT_NAME, true); - } - - @Test - public void testGcovSummaryByLaunch() { - GcovTest.openGcovSummaryByLaunch(bot, PROJECT_NAME); - } + private static SWTWorkbenchBot bot; + + private static final String PROJECT_NAME = "Gcov_C_test"; + private static final String PROJECT_TYPE = "C Project"; + + @BeforeClass + public static void beforeClass() throws Exception { + bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); + } + + @AfterClass + public static void afterClass() { + GcovTest.cleanup(bot); + } + + @Test + public void openGcovFileDetails() throws Exception { + GcovTest.openGcovFileDetails(bot, PROJECT_NAME); + } + + @Test + public void openGcovSummary() throws Exception { + GcovTest.openGcovSummary(bot, PROJECT_NAME, true); + } + + @Test + public void testGcovSummaryByLaunch() { + GcovTest.openGcovSummaryByLaunch(bot, PROJECT_NAME); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java index e1c08534a8..0eea908c9c 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java @@ -10,30 +10,30 @@ import org.junit.runner.RunWith; @RunWith(SWTBotJunit4ClassRunner.class) public class GcovTestCLibrary { - private static SWTWorkbenchBot bot; - - private static final String PROJECT_NAME = "Gcov_C_library_test"; - private static final String PROJECT_TYPE = "C Project"; - private static final String BIN_NAME = "libtestgcovlib.so"; - - @BeforeClass - public static void beforeClass() throws Exception { - bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); - } - - @AfterClass - public static void afterClass() { - GcovTest.cleanup(bot); - } - - @Test - public void openGcovFileDetails() throws Exception { - GcovTest.openGcovFileDetails(bot, PROJECT_NAME, BIN_NAME); - } - - @Test - public void openGcovSummary() throws Exception { - GcovTest.openGcovSummary(bot, PROJECT_NAME, BIN_NAME, true); - } + private static SWTWorkbenchBot bot; + + private static final String PROJECT_NAME = "Gcov_C_library_test"; + private static final String PROJECT_TYPE = "C Project"; + private static final String BIN_NAME = "libtestgcovlib.so"; + + @BeforeClass + public static void beforeClass() throws Exception { + bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); + } + + @AfterClass + public static void afterClass() { + GcovTest.cleanup(bot); + } + + @Test + public void openGcovFileDetails() throws Exception { + GcovTest.openGcovFileDetails(bot, PROJECT_NAME, BIN_NAME); + } + + @Test + public void openGcovSummary() throws Exception { + GcovTest.openGcovSummary(bot, PROJECT_NAME, BIN_NAME, true); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCPP.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCPP.java index 3bfebd99ad..18b57aa50d 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCPP.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCPP.java @@ -10,33 +10,33 @@ import org.junit.runner.RunWith; @RunWith(SWTBotJunit4ClassRunner.class) public class GcovTestCPP { - private static SWTWorkbenchBot bot; - - private static final String PROJECT_NAME = "Gcov_CPP_test"; - private static final String PROJECT_TYPE = "C++ Project"; - - @BeforeClass - public static void beforeClass() throws Exception { - bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); - } - - @AfterClass - public static void afterClass() { - GcovTest.cleanup(bot); - } - - @Test - public void openGcovFileDetails() throws Exception { - GcovTest.openGcovFileDetails(bot, PROJECT_NAME); - } - - @Test - public void openGcovSummary() throws Exception { - GcovTest.openGcovSummary(bot, PROJECT_NAME, false); - } - - @Test - public void testGcovSummaryByLaunch() { - GcovTest.openGcovSummaryByLaunch(bot, PROJECT_NAME); - } + private static SWTWorkbenchBot bot; + + private static final String PROJECT_NAME = "Gcov_CPP_test"; + private static final String PROJECT_TYPE = "C++ Project"; + + @BeforeClass + public static void beforeClass() throws Exception { + bot = GcovTest.init(PROJECT_NAME, PROJECT_TYPE); + } + + @AfterClass + public static void afterClass() { + GcovTest.cleanup(bot); + } + + @Test + public void openGcovFileDetails() throws Exception { + GcovTest.openGcovFileDetails(bot, PROJECT_NAME); + } + + @Test + public void openGcovSummary() throws Exception { + GcovTest.openGcovSummary(bot, PROJECT_NAME, false); + } + + @Test + public void testGcovSummaryByLaunch() { + GcovTest.openGcovSummaryByLaunch(bot, PROJECT_NAME); + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/JobsRunning.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/JobsRunning.java index e49a10907f..dbd3c3df74 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/JobsRunning.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/JobsRunning.java @@ -6,25 +6,25 @@ import org.eclipse.swtbot.swt.finder.waits.ICondition; public class JobsRunning implements ICondition { - private final Object family; - - public JobsRunning(Object family) { - this.family = family; - } - - @Override - public boolean test() { - Job[] allJobs = Job.getJobManager().find(family); - return allJobs.length == 0; - } - - @Override - public void init(SWTBot bot) { - - } - - @Override - public String getFailureMessage() { - return "Jobs still running..."; - } + private final Object family; + + public JobsRunning(Object family) { + this.family = family; + } + + @Override + public boolean test() { + Job[] allJobs = Job.getJobManager().find(family); + return allJobs.length == 0; + } + + @Override + public void init(SWTBot bot) { + + } + + @Override + public String getFailureMessage() { + return "Jobs still running..."; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/ProgressMonitor.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/ProgressMonitor.java index 424d96abe0..ea39f69b9e 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/ProgressMonitor.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/ProgressMonitor.java @@ -4,16 +4,16 @@ import org.eclipse.core.runtime.NullProgressMonitor; public class ProgressMonitor extends NullProgressMonitor { - private boolean done = false; - - public boolean isDone() { - return done; - } + private boolean done = false; - @Override - public void done() { - super.done(); - done = true; - } + public boolean isDone() { + return done; + } + + @Override + public void done() { + super.done(); + done = true; + } } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java index e27e56f6c5..070431c0bf 100755 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java @@ -34,66 +34,66 @@ import org.osgi.framework.Bundle; */ public class STJunitUtils { - /** - * Utility method to compare files - * @param dumpFile - * @param refFile - * @return - */ - public static boolean compareIgnoreEOL(String dumpFile, String refFile, boolean deleteDumpFileIfOk) { - String message = "Comparing ref file (" + refFile + ")and dump file (" - + dumpFile + ")"; - boolean equals = false; - try (LineNumberReader is1 = new LineNumberReader(new FileReader( - dumpFile)); - LineNumberReader is2 = new LineNumberReader(new FileReader( - refFile))) { - do { - String line1 = is1.readLine(); - String line2 = is2.readLine(); - if (line1 == null) { - if (line2 == null) { - equals = true; - } - break; - } else if (line2 == null || !line1.equals(line2)) { - break; - } - } while (true); + /** + * Utility method to compare files + * @param dumpFile + * @param refFile + * @return + */ + public static boolean compareIgnoreEOL(String dumpFile, String refFile, boolean deleteDumpFileIfOk) { + String message = "Comparing ref file (" + refFile + ")and dump file (" + + dumpFile + ")"; + boolean equals = false; + try (LineNumberReader is1 = new LineNumberReader(new FileReader( + dumpFile)); + LineNumberReader is2 = new LineNumberReader(new FileReader( + refFile))) { + do { + String line1 = is1.readLine(); + String line2 = is2.readLine(); + if (line1 == null) { + if (line2 == null) { + equals = true; + } + break; + } else if (line2 == null || !line1.equals(line2)) { + break; + } + } while (true); - if (!equals) { - assertEquals(message + ": not correspond ", true, false); - } + if (!equals) { + assertEquals(message + ": not correspond ", true, false); + } - // delete dump only for successful tests - if (equals && deleteDumpFileIfOk) { - new File(dumpFile).delete(); - } - } catch (FileNotFoundException _) { - message += "... FAILED: One of these files may not exist"; - assertNull(message, _); - } catch (Exception e) { - message += ": exception raised ... FAILED"; - assertNull(message, e); - } - return equals; - } + // delete dump only for successful tests + if (equals && deleteDumpFileIfOk) { + new File(dumpFile).delete(); + } + } catch (FileNotFoundException _) { + message += "... FAILED: One of these files may not exist"; + assertNull(message, _); + } catch (Exception e) { + message += ": exception raised ... FAILED"; + assertNull(message, e); + } + return equals; + } - /** - * Gets the absolute path of a resource in the given plugin - * @param pluginId - * @param relativeName - * @return an absolute path to a file - */ - public static String getAbsolutePath(String pluginId, String relativeName) { - Bundle b = Platform.getBundle(pluginId); - URL url = FileLocator.find(b, new Path(relativeName), null); - try { - url = FileLocator.toFileURL(url); - } catch (IOException e) { - assertNotNull("Problem locating " + relativeName + " in" + pluginId,e); - } - String filename = url.getFile(); - return filename; - } + /** + * Gets the absolute path of a resource in the given plugin + * @param pluginId + * @param relativeName + * @return an absolute path to a file + */ + public static String getAbsolutePath(String pluginId, String relativeName) { + Bundle b = Platform.getBundle(pluginId); + URL url = FileLocator.find(b, new Path(relativeName), null); + try { + url = FileLocator.toFileURL(url); + } catch (IOException e) { + assertNotNull("Problem locating " + relativeName + " in" + pluginId,e); + } + String filename = url.getFile(); + return filename; + } } |