summaryrefslogtreecommitdiff
path: root/org.eclipse.linuxtools.gcov.test/test_c
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:58:36 +0900
committerHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:58:36 +0900
commit25b26f6ed69014262fc536f6cadd1add400bff20 (patch)
treeb8d2e7f35889963c81c5120c372c4b4ae53b1382 /org.eclipse.linuxtools.gcov.test/test_c
parentb46fd4f6e8283f5da6795b12ecf77adcf49525fe (diff)
downloadcodecoverage-eplugin-tizen_2.0.tar.gz
codecoverage-eplugin-tizen_2.0.tar.bz2
codecoverage-eplugin-tizen_2.0.zip
Diffstat (limited to 'org.eclipse.linuxtools.gcov.test/test_c')
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/Makefile8
-rwxr-xr-xorg.eclipse.linuxtools.gcov.test/test_c/a.outbin0 -> 30722 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/fact.c19
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/fact.gcdabin0 -> 168 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/fact.gcnobin0 -> 480 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/main.c28
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/main.gcdabin0 -> 176 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/main.gcnobin0 -> 676 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/mult.c21
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/mult.gcdabin0 -> 152 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/mult.gcnobin0 -> 500 bytes
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref30
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/testView.ref8
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref9
-rw-r--r--org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref5
15 files changed, 128 insertions, 0 deletions
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/Makefile b/org.eclipse.linuxtools.gcov.test/test_c/Makefile
new file mode 100644
index 0000000..9771c05
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/Makefile
@@ -0,0 +1,8 @@
+build a.out:
+ gcc -fprofile-arcs -ftest-coverage *.c
+
+all: a.out
+ ./$< 1 2 3 4 5 6
+
+clean:
+ rm -f *.o a.out *.gcno *.gcda
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/a.out b/org.eclipse.linuxtools.gcov.test/test_c/a.out
new file mode 100755
index 0000000..baebd86
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/a.out
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/fact.c b/org.eclipse.linuxtools.gcov.test/test_c/fact.c
new file mode 100644
index 0000000..f37737a
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/fact.c
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+long mult(long val1, long val2);
+
+long fact(long val)
+{
+ int k = 100;
+ for (; k-->0;);
+ if (val == 1) return 1;
+ return mult(val,fact(val-1));
+}
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda b/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda
new file mode 100644
index 0000000..0515b5e
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno b/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno
new file mode 100644
index 0000000..d9242a8
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/main.c b/org.eclipse.linuxtools.gcov.test/test_c/main.c
new file mode 100644
index 0000000..6065d93
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/main.c
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+long fact(long val);
+
+int main(int argc, char** argv)
+{
+ int i = 1;
+ for (; i<argc; i++)
+ {
+ unsigned long val = strtol(argv[i],NULL,10);
+ unsigned long res = fact(val);
+ int k = 1000;
+ for (; k-->0;);
+ printf("%li! = %li\n", val, res);
+ }
+ return 0;
+}
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/main.gcda b/org.eclipse.linuxtools.gcov.test/test_c/main.gcda
new file mode 100644
index 0000000..bcbaaac
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/main.gcda
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/main.gcno b/org.eclipse.linuxtools.gcov.test/test_c/main.gcno
new file mode 100644
index 0000000..3581c98
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/main.gcno
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/mult.c b/org.eclipse.linuxtools.gcov.test/test_c/mult.c
new file mode 100644
index 0000000..62abaa9
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/mult.c
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+long mult(long val1, long val2)
+{
+ int k = 50;
+ long res = 0;
+ for (; k-->0;);
+ while(val2-->0)
+ {
+ res += val1;
+ }
+ return res;
+}
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda b/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda
new file mode 100644
index 0000000..12b1038
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno b/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno
new file mode 100644
index 0000000..d7b49a8
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno
Binary files differ
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref b/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref
new file mode 100644
index 0000000..bdb5e51
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref
@@ -0,0 +1,30 @@
+Parse gcda and gcno files done, resolve graph algorithm executed, now display results
+- PRINT FUNCTIONS ARRAY :
+-- FUNCTION 0
+ name = fact
+ instrumentd lines = 5
+ executed lines = 5
+-- FUNCTION 1
+ name = main
+ instrumentd lines = 9
+ executed lines = 9
+-- FUNCTION 2
+ name = mult
+ instrumentd lines = 7
+ executed lines = 7
+- PRINT SRCS ARRAY :
+-- FILE 0
+ name = fact.c
+ total lines = 19
+ instrumentd lines = 5
+ executed lines = 5
+-- FILE 1
+ name = main.c
+ total lines = 28
+ instrumentd lines = 9
+ executed lines = 9
+-- FILE 2
+ name = mult.c
+ total lines = 21
+ instrumentd lines = 7
+ executed lines = 7
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/testView.ref b/org.eclipse.linuxtools.gcov.test/test_c/testView.ref
new file mode 100644
index 0000000..2dc8ff6
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/testView.ref
@@ -0,0 +1,8 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;fact.c;19;5;5;100.0
+ | +-;fact;;5;5;100.0
+ +-;main.c;28;9;9;100.0
+ | +-;main;;9;9;100.0
+ +-;mult.c;21;7;7;100.0
+ +-;mult;;7;7;100.0
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref b/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref
new file mode 100644
index 0000000..2f8156b
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref
@@ -0,0 +1,9 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;?;68;21;21;100.0
+ +-;fact.c;19;5;5;100.0
+ | +-;fact;;5;5;100.0
+ +-;main.c;28;9;9;100.0
+ | +-;main;;9;9;100.0
+ +-;mult.c;21;7;7;100.0
+ +-;mult;;7;7;100.0
diff --git a/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref b/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref
new file mode 100644
index 0000000..c24b616
--- /dev/null
+++ b/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref
@@ -0,0 +1,5 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;fact;;5;5;100.0
+ +-;main;;9;9;100.0
+ +-;mult;;7;7;100.0