diff options
author | kh5325.kim <kh5325.kim@samsung.com> | 2013-04-02 20:25:17 +0900 |
---|---|---|
committer | kh5325.kim <kh5325.kim@samsung.com> | 2013-04-02 20:25:17 +0900 |
commit | 1f81ba951c1ea3b659539579c7fabdac783e9943 (patch) | |
tree | fd7824822c2277e34d93f21bd4336266ec67c779 | |
parent | 9a5aaee9ae21a2492d3da98a5116aed805834c13 (diff) | |
download | codecoverage-eplugin-1f81ba951c1ea3b659539579c7fabdac783e9943.tar.gz codecoverage-eplugin-1f81ba951c1ea3b659539579c7fabdac783e9943.tar.bz2 codecoverage-eplugin-1f81ba951c1ea3b659539579c7fabdac783e9943.zip |
Upload tizen_2.1 source
Change-Id: I79c784317c99377b48540417e1ec6bbba2b589c2
8 files changed, 161 insertions, 180 deletions
diff --git a/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CovManager.java b/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CovManager.java index 0379e3c..d84aabf 100644 --- a/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CovManager.java +++ b/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CovManager.java @@ -39,9 +39,9 @@ import org.eclipse.linuxtools.gcov.model.CovFileTreeElement; import org.eclipse.linuxtools.gcov.model.CovFolderTreeElement;
import org.eclipse.linuxtools.gcov.model.CovFunctionTreeElement;
import org.eclipse.linuxtools.gcov.model.CovRootTreeElement;
+import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.OSChecker;
import org.tizen.nativecommon.build.SmartBuildInterface;
-
/**
* @author Xavier Raynaud <xavier.raynaud@st.com>
*
@@ -101,9 +101,10 @@ public class CovManager implements Serializable { // parse GCDA file
traceFile = OpenTraceFileStream(gcdaPath);
if (noRcrd.getFnctns().isEmpty()){
- String message = gcnoPath + " doesn't contain any function:\n";
- Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
- throw new CoreException(status);
+ continue;
+// String message = gcnoPath + " doesn't contain any function:\n";
+// Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message);
+// throw new CoreException(status);
}
daRcrd = new GcdaRecordsParser(noRcrd.getFnctns());
daRcrd.parseGcdaRecord(traceFile);
@@ -243,13 +244,7 @@ public class CovManager implements Serializable { return nbrPgmRuns;
}
- /**
- * Retrieve a list containing gcda paths from a binary file
- * @return
- * @throws CoreException
- * @throws IOException
- * @throws InterruptedException
- */
+
public List<String> getGCDALocations() throws CoreException, IOException, InterruptedException
{
IBinaryObject binaryObject = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
@@ -286,6 +281,7 @@ public class CovManager implements Serializable { t.start();
p.waitFor();
t.join();
+
return l;
}
@@ -332,9 +328,9 @@ public class CovManager implements Serializable { // be prefixed by random printable characters so strip leading
// characters until the filepath starts with "X:/", "X:\", "/" or "\"
// FIXME: need a more robust mechanism to locate .gcda files [Bugzilla 329710]
- while ((line.length() > 6) && !line.matches("^([A-Za-z]:)?[/\\\\].*")) {
- line = line.substring(1);
- }
+// while ((line.length() > 6) && !line.matches("^([A-Za-z]:)?[/\\\\].*")) {
+// line = line.substring(1);
+// }
IPath p = new Path(line);
String filename = p.toString();
if (!list.contains(filename)) list.add(filename);
diff --git a/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java b/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java index c21e16f..0cd92e1 100644 --- a/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java +++ b/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java @@ -219,15 +219,17 @@ public class GcnoRecordsParser { continue;
}
}
- catch (EOFException e) {
-
- fnctn.setFunctionBlocks(blocks);
- fnctns.add(fnctn);
-
- break;
+ catch (EOFException e) {
+
+ if ( fnctn != null ) {
+ fnctn.setFunctionBlocks(blocks);
+ fnctns.add(fnctn);
+ }
+
+ break;
}
- }//while
+ }//while
}
/* Getters */
diff --git a/org.tizen.codecoverage.feature/feature.properties b/org.tizen.codecoverage.feature/feature.properties index 5714bd6..c03cf3e 100644 --- a/org.tizen.codecoverage.feature/feature.properties +++ b/org.tizen.codecoverage.feature/feature.properties @@ -18,24 +18,4 @@ description=Tool for checking the code coverage for native applications. # "copyright" property copyrightURL=https://developer.tizen.org -copyright=Copyright (c) - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Tizen SDK\n\ -\n\ -Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components. All open source software portions ("Open Source Software") are licensed under the open source licenses that accompany such Open Source Software.\n\ - \n\ -The licenses governing the Open Source Software are available at: http://developer.tizen.org/download/tizen_sdk_opensource_license.html\n\ - \n\ -Except for the Open Source Software contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Tizen Software Development Kit License Agreement, available at: http://developer.tizen.org/download/samsung_sdk_license.html\n\ - \n\ -You may access and download Tizen SDK Open Source Software at: http://developer.tizen.org/download/tizenopensdk.tar.gz\n\ - \n\ -BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS AND THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE OPEN SOURCE SOFTWARE LICENSE TERMS OR THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT, YOU MAY NOT DOWNLOAD OR USE TIZEN SDK.\n -########### end of license property ########################################## +copyright=Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. diff --git a/org.tizen.codecoverage.feature/feature.xml b/org.tizen.codecoverage.feature/feature.xml index 3af6918..1ab2063 100644 --- a/org.tizen.codecoverage.feature/feature.xml +++ b/org.tizen.codecoverage.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.tizen.codecoverage.feature" label="%featureName" - version="1.0.0.qualifier" + version="2.0.0.qualifier" provider-name="%providerName" plugin="org.tizen.codecoverage" license-feature="org.tizen.base.feature"> @@ -15,10 +15,6 @@ %copyright </copyright> - <license url=""> - %license - </license> - <plugin id="org.eclipse.linuxtools.binutils" download-size="0" diff --git a/org.tizen.codecoverage/META-INF/MANIFEST.MF b/org.tizen.codecoverage/META-INF/MANIFEST.MF index d12708f..446ec02 100644 --- a/org.tizen.codecoverage/META-INF/MANIFEST.MF +++ b/org.tizen.codecoverage/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.tizen.codecoverage;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.tizen.codecoverage.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.cdt.debug.core, org.eclipse.debug.core, org.eclipse.linuxtools.gcov, - org.tizen.common + org.tizen.common, + org.tizen.nativecommon Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Import-Package: org.tizen.common.connection, diff --git a/org.tizen.codecoverage/src/org/tizen/codecoverage/helper/GcovHelper.java b/org.tizen.codecoverage/src/org/tizen/codecoverage/helper/GcovHelper.java index ff487f4..7dd9578 100644 --- a/org.tizen.codecoverage/src/org/tizen/codecoverage/helper/GcovHelper.java +++ b/org.tizen.codecoverage/src/org/tizen/codecoverage/helper/GcovHelper.java @@ -20,12 +20,14 @@ package org.tizen.codecoverage.helper; +import java.util.LinkedList; import java.util.List; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -38,139 +40,131 @@ import org.eclipse.linuxtools.gcov.view.CovView; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.tizen.common.connection.ConnectionPlugin; +import org.tizen.common.util.IOUtil; +import org.tizen.nativecommon.ProjectUtil; import org.tizen.nativecpp.editors.manifest.PackageModel; import org.tizen.sdblib.IDevice; import org.tizen.sdblib.SyncService; import org.tizen.sdblib.SyncService.SyncResult; public class GcovHelper { - final static String DATA_DIR = "/data/"; - - static public void run(IProject project) { - // null check project - if (project == null || !project.exists()) { - final String message = "Please select a project."; - Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openInformation(s, "Project not found", message); - return; - } - - IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - if (currentDevice == null) { -// final String message = "Target device is not running"; -// Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); -// MessageDialog.openError(s, "Gcov Error", message); - return; - } - - String binary = GcovHelper.getBinary(project); - if (binary == null) { - final String message = "Gcov failed. Binary file not found.\n" - + "Please check Build Settings"; - Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openError(s, "Gcov Error", message); - return; - } - - try { - GcovHelper.downloadGcdaFile(binary); - } catch (Exception e) { - final String message = "Gcov failed. Coverage data file not found."; - Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openError(s, "Gcov Error", message); - return; - } - CovView.displayCovResults(binary); - } - - private static String getBinary(IResource binary, String target) { - if (binary.getLocation().toOSString().contains( target ) && binary.getLocation().lastSegment().contains(binary.getProject().getName())) { - return binary.getLocation().toOSString(); + final static String DATA_DIR = "/data/"; + + static public void run(IProject project) { + // null check project + if (project == null || !project.exists()) { + final String message = "Please select a project."; + Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + MessageDialog.openInformation(s, "Project not found", message); + return; + } + + IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + if (currentDevice == null) { + // final String message = "Target device is not running"; + // Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + // MessageDialog.openError(s, "Gcov Error", message); + return; + } + + String binary = GcovHelper.getBinary(project); + if (binary == null) { + final String message = "Gcov failed. Binary file not found.\n" + + "Please check Build Settings"; + Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + MessageDialog.openError(s, "Gcov Error", message); + return; + } + + try { + GcovHelper.downloadGcdaFile(binary); + } catch (Exception e) { + final String message = "Gcov failed. Coverage data file not found."; + Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + MessageDialog.openError(s, "Gcov Error", message); + return; } - return null; - } - // FIXME searching a selected binary is not complete - // This part is affected IDE launch part - // TODO Fix this method - public static String getBinary(IProject project) { - String binary = null; - ICProject cproject = CoreModel.getDefault().create(project); - if (cproject == null) { - return binary; - } - IBinary[] bins = null; - try { - bins = cproject.getBinaryContainer().getBinaries(); - } catch (CModelException e) { - e.printStackTrace(); - } - - IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - if (currentDevice.isEmulator()) { - for( IBinary bin : bins ) { - binary = getBinary( bin.getResource(), "Emulator" ); - break; - } - } else { - for( IBinary bin : bins ) { - binary = getBinary( bin.getResource(), "Device" ); - break; - } - } - return binary; - } - - static IProject getProject(IPath file) { - IFile c = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file); - return c.getProject(); - } - - public static void downloadGcdaFile(String binaryPath) throws Exception { - CovManager cvrgeMnger = null; - List<String> gcdaPaths = null; - cvrgeMnger = new CovManager(binaryPath); - try { - gcdaPaths = cvrgeMnger.getGCDALocations(); - } catch (Exception e) { - final String message = "Gcov failed. Binary not found."; - Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openError(s, "Gcov Error", message); - return; - } - // download gcda file - IPath file = new Path(binaryPath); - IProject project = getProject(file); - String targetPath = getGcdaPath(project); - - @SuppressWarnings("restriction") - IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); - @SuppressWarnings("restriction") - SyncService syncService = currentDevice.getSyncService(); - - for (String gcdaPath: gcdaPaths) { - int start = gcdaPath.lastIndexOf('/') + 1; - int end = gcdaPath.length(); - String gcdaFile = gcdaPath.substring(start, end); - String srcFile = targetPath + gcdaFile; - String dstFile = gcdaPath; - @SuppressWarnings("restriction") - SyncResult syncSuccess = syncService.pullFile(srcFile, dstFile, SyncService.getNullProgressMonitor()); - if (syncSuccess.getCode() != SyncService.RESULT_OK) { - Exception e = new Exception(); - throw e; - } - } - } - - static public String getGcdaPath(IProject project) { - String installPath = getPackageInstallPath(project); - String gcdaPath = installPath + DATA_DIR; - return gcdaPath; - } - - static String getPackageInstallPath(IProject project) { - PackageModel packageModel = PackageModel.newInstance(project); - String installPath = packageModel.getAppInstallPath(); - return installPath; - } + CovView.displayCovResults(binary); + } + + private static String getBinary(IResource binary, String target) { + if (binary.getLocation().toOSString().contains( target ) && binary.getLocation().lastSegment().contains(binary.getProject().getName())) { + return binary.getLocation().toOSString(); + } + return null; + } + // FIXME searching a selected binary is not complete + // This part is affected IDE launch part + // TODO Fix this method + public static String getBinary(IProject project) { + String binaryName = ProjectUtil.getBinaryName(project); + IConfiguration config = ProjectUtil.getDefaultConfiguration(project); + IFile binaryFile = project.getFile(config.getName() + "/" + binaryName); + + if ( binaryFile.exists() ) { + return binaryFile.getLocation().toString(); + } + else { + return null; + } + } + + static IProject getProject(IPath file) { + IFile c = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file); + return c.getProject(); + } + + public static void downloadGcdaFile(String binaryPath) throws Exception { + CovManager cvrgeMnger = null; + List<String> gcdaPaths = new LinkedList<String>(); + cvrgeMnger = new CovManager(binaryPath); + IPath binaryFile = new Path(binaryPath); + boolean isLLVM = false; + + try { + gcdaPaths = cvrgeMnger.getGCDALocations(); + } catch (Exception e) { + final String message = "Gcov failed. Binary not found."; + Shell s = PlatformUI.getWorkbench().getDisplay().getActiveShell(); + MessageDialog.openError(s, "Gcov Error", message); + return; + } + + IProject project = getProject(binaryFile); + + downloadGcda(gcdaPaths, binaryFile, project, isLLVM); + } + + public static void downloadGcda( List<String> gcdaPathsInGcno, IPath binaryPath, IProject project, boolean isLLVM ) throws Exception{ + IDevice currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + SyncService syncService = currentDevice.getSyncService(); + String dstFile = ""; + String srcFile = ""; + + String targetPath = getGcdaPath(project, currentDevice); + + + + try { + for (String gcdaPath: gcdaPathsInGcno) { + dstFile = gcdaPath; + srcFile = targetPath + gcdaPath; + + SyncResult syncSuccess = syncService.pullFile(srcFile, dstFile, SyncService.getNullProgressMonitor()); + if (syncSuccess.getCode() != SyncService.RESULT_OK) { + Exception e = new Exception(); + throw e; + } + } + } finally { + IOUtil.tryClose(syncService); + } + + } + + private static String getGcdaPath(IProject project, IDevice device) { + String installPath = ProjectUtil.getAppDirectory(project, device); + String gcdaPath = installPath + DATA_DIR; + return gcdaPath; + } } diff --git a/package/changelog b/package/changelog index c508596..77933fe 100644 --- a/package/changelog +++ b/package/changelog @@ -1,6 +1,18 @@ +* 2.1.3 +- modified a way to download gcda file form target when toolchain is LLVM +== kh5325.kim <kh5325.kim@samsung.com> 2013-03-27 +* 2.1.2 +- Merged the latest changes +== kh5325.kim <kh5325.kim@samsung.com> 2013-03-24 +* 2.1.1 +- Version up for Tizen 2.1 distribution +== donghee yang <donghee yang@samsung.com> 2013-03-15 +* 2.1.0 +- 2.1.0 Package +== kh5325.kim <kh5325.kim@samsung.com> 2013-03-08 * 1.0.19 -- Modified Provider -== kh5325.kim <kh5325.kim@samsung.com> 2013-02-14 +- If toolchain is LLVM, IDE cannot download gcda file. The problem was fixed. +== gune.kim <gune.kim@samsung.com> 2013-02-25 * 1.0.18 - In code coverage, the chart view cannot be expanded if is saved as XML source == gune.kim <gune.kim@samsung.com> 2012-12-03 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 32f21aa..16d0e40 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version:1.0.19 +Version:2.1.3 Source:codecoverage-eplugin Maintainer:kangho kim <kh5325.kim@samsung.com>, yoonki park <yoonki.park@samsung.com>, hyunsik non <hyunsik.noh@samsung.com>, taeyoung son <taeyoung2.son@samsung.com>, gune Kim <gune.kim@samsung.com>, ho namkoong <ho.namkoong@samsung.com>, hyeongseok heo <hyeong-seok.heo@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>, jihoon song <jihoon80.song@samsung.com>, changhyun lee <changhyun1.lee@samsung.com>, bonyong lee <bonyong.lee@samsung.com> |