Skip to content
Snippets Groups Projects
Commit a3450be0 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[tests] refine test to test new ptests' behavior

parent aa2e9289
No related branches found
No related tags found
No related merge requests found
/* run.config
STDOPT: #"-metrics-no-libc -metrics-eva-cover"
STDOPT: #"-metrics-libc -metrics-eva-cover"
STDOPT: #"-metrics-libc -metrics-output @PTEST_DIR@/result/libc.json"
LOG: libc.json
OPT:
STDOPT: #"-metrics-libc -metrics-output @PTEST_DIR@/result/libc.json"
*/
#include <ctype.h>
#include <stdio.h> // defines external variables
......@@ -24,6 +23,8 @@ int g() { // called via fp
return isalpha(42);
}
int h() { return 0; }
int (*fp)() = g;
int getopt(int argc, char * const argv[],
......@@ -34,5 +35,6 @@ int getopt(int argc, char * const argv[],
int main() {
fp();
getopt(0, 0, 0);
h();
return isblank(0);
}
[kernel] Parsing tests/metrics/libc.c (with preprocessing)
[metrics] Defined functions (5)
[metrics] Defined functions (6)
=====================
bar (0 call); f (0 call); foo (0 call); g (address taken) (0 call);
main (0 call);
h (1 call); main (0 call);
Specified-only functions (0)
============================
......@@ -22,18 +22,18 @@
Global metrics
==============
Sloc = 12
Sloc = 15
Decision point = 0
Global variables = 1
If = 0
Loop = 0
Goto = 0
Assignment = 5
Exit point = 5
Function = 5
Function call = 5
Assignment = 6
Exit point = 6
Function = 6
Function call = 6
Pointer dereferencing = 1
Cyclomatic complexity = 5
Cyclomatic complexity = 6
[eva] Analyzing a complete application starting at main
[eva] Computing initial state
[eva] Initial state computed
......@@ -44,8 +44,8 @@
[eva] done for function main
[eva:summary] ====== ANALYSIS SUMMARY ======
----------------------------------------------------------------------------
4 functions analyzed (out of 5): 80% coverage.
In these functions, 10 statements reached (out of 10): 100% coverage.
5 functions analyzed (out of 6): 83% coverage.
In these functions, 13 statements reached (out of 13): 100% coverage.
----------------------------------------------------------------------------
No errors or warnings raised during the analysis.
----------------------------------------------------------------------------
......@@ -58,15 +58,16 @@
----------------------------------------------------------------------------
[metrics] Eva coverage statistics
=======================
Syntactically reachable functions = 4 (out of 5)
Semantically reached functions = 4
Syntactically reachable functions = 5 (out of 6)
Semantically reached functions = 5
Coverage estimation = 100.0%
[metrics] References to non-analyzed functions
------------------------------------
[metrics] Statements analyzed by Eva
--------------------------
10 stmts in analyzed functions, 10 stmts analyzed (100.0%)
13 stmts in analyzed functions, 13 stmts analyzed (100.0%)
bar: 2 stmts out of 2 (100.0%)
foo: 2 stmts out of 2 (100.0%)
g: 2 stmts out of 2 (100.0%)
main: 4 stmts out of 4 (100.0%)
h: 2 stmts out of 2 (100.0%)
main: 5 stmts out of 5 (100.0%)
[kernel] Parsing tests/metrics/libc.c (with preprocessing)
[metrics] Defined functions (6)
[metrics] Defined functions (7)
=====================
bar (1 call); f (0 call); foo (1 call); g (address taken) (0 call);
getopt (1 call); main (0 call);
getopt (1 call); h (1 call); main (0 call);
Specified-only functions (122)
==============================
......@@ -55,18 +55,18 @@
Global metrics
==============
Sloc = 17
Sloc = 20
Decision point = 0
Global variables = 17
If = 0
Loop = 0
Goto = 0
Assignment = 8
Exit point = 6
Function = 128
Function call = 7
Assignment = 9
Exit point = 7
Function = 129
Function call = 8
Pointer dereferencing = 1
Cyclomatic complexity = 6
Cyclomatic complexity = 7
[eva] Analyzing a complete application starting at main
[eva] Computing initial state
[eva] Initial state computed
......@@ -77,8 +77,8 @@
[eva] done for function main
[eva:summary] ====== ANALYSIS SUMMARY ======
----------------------------------------------------------------------------
4 functions analyzed (out of 5): 80% coverage.
In these functions, 10 statements reached (out of 10): 100% coverage.
5 functions analyzed (out of 6): 83% coverage.
In these functions, 13 statements reached (out of 13): 100% coverage.
----------------------------------------------------------------------------
No errors or warnings raised during the analysis.
----------------------------------------------------------------------------
......@@ -91,16 +91,17 @@
----------------------------------------------------------------------------
[metrics] Eva coverage statistics
=======================
Syntactically reachable functions = 7 (out of 128)
Semantically reached functions = 7
Syntactically reachable functions = 8 (out of 129)
Semantically reached functions = 8
Coverage estimation = 100.0%
[metrics] References to non-analyzed functions
------------------------------------
[metrics] Statements analyzed by Eva
--------------------------
15 stmts in analyzed functions, 15 stmts analyzed (100.0%)
18 stmts in analyzed functions, 18 stmts analyzed (100.0%)
bar: 2 stmts out of 2 (100.0%)
foo: 2 stmts out of 2 (100.0%)
g: 2 stmts out of 2 (100.0%)
getopt: 5 stmts out of 5 (100.0%)
main: 4 stmts out of 4 (100.0%)
h: 2 stmts out of 2 (100.0%)
main: 5 stmts out of 5 (100.0%)
......@@ -5,6 +5,7 @@
{ "foo": { "calls": 1, "address_taken": false } },
{ "g": { "calls": 0, "address_taken": true } },
{ "getopt": { "calls": 1, "address_taken": false } },
{ "h": { "calls": 1, "address_taken": false } },
{ "main": { "calls": 0, "address_taken": false } }
],
"specified-only-functions": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment