From 5202f4ff9d6c09ccf7568602342c103c563f701f Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Wed, 16 Feb 2022 22:22:31 +0100
Subject: [PATCH] [tests] dune: fix test directory 'metrics'

---
 tests/metrics/func_ptr.c                           | 1 +
 tests/metrics/libc.c                               | 3 ++-
 tests/metrics/oracle/func_ptr.0.res.oracle         | 6 +++---
 tests/metrics/oracle/func_ptr.1.res.oracle         | 2 +-
 tests/metrics/oracle/reach.res.oracle              | 4 ++--
 tests/metrics/oracle/referenced-by-acsl.res.oracle | 2 +-
 tests/metrics/reach.c                              | 1 +
 tests/metrics/referenced-by-acsl.c                 | 1 +
 tests/metrics/unreachable.c                        | 2 +-
 tests/metrics/used-files.i                         | 6 ++++--
 10 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/tests/metrics/func_ptr.c b/tests/metrics/func_ptr.c
index 7752cc707be..a0df67179d8 100644
--- a/tests/metrics/func_ptr.c
+++ b/tests/metrics/func_ptr.c
@@ -1,4 +1,5 @@
 /* run.config
+   PLUGIN: @PTEST_PLUGIN@ inout
    STDOPT: +"-metrics-eva-cover -metrics-cover main"
    STDOPT: +"-metrics-eva-cover -main foobar -metrics-cover foobar"
 **/
diff --git a/tests/metrics/libc.c b/tests/metrics/libc.c
index 80ddfacff98..24a6f727878 100644
--- a/tests/metrics/libc.c
+++ b/tests/metrics/libc.c
@@ -1,5 +1,6 @@
 /* run.config
- EXECNOW: LOG @PTEST_NAME@_metrics.res LOG @PTEST_NAME@_metrics.err @frama-c@ @PTEST_FILE@ -metrics -metrics-libc -then -metrics-no-libc | @PTEST_SUITE_DIR@/../libc/check_some_metrics.sh "> 5" "> 100" "= 0" "> 10" "= 2"  "= 6" "= 0" "= 0" "= 0" "= 4" >@PTEST_NAME@_metrics.res 2>@PTEST_NAME@_metrics.err
+ PLUGIN: @PTEST_PLUGIN@ inout
+ EXECNOW: LOG @PTEST_NAME@_metrics.res LOG @PTEST_NAME@_metrics.err @frama-c@ @PTEST_FILE@ -metrics -metrics-libc -then -metrics-no-libc | %{dep:@PTEST_SUITE_DIR@/../libc/check_some_metrics.sh} "> 5" "> 100" "= 0" "> 10" "= 2"  "= 6" "= 0" "= 0" "= 0" "= 4" >@PTEST_NAME@_metrics.res 2>@PTEST_NAME@_metrics.err
    STDOPT: #"-metrics-eva-cover"
    LOG: libc.json
    STDOPT: #"-metrics-libc -metrics-output @PTEST_RESULT@/libc.json"
diff --git a/tests/metrics/oracle/func_ptr.0.res.oracle b/tests/metrics/oracle/func_ptr.0.res.oracle
index 1ecd0860369..828890b6d95 100644
--- a/tests/metrics/oracle/func_ptr.0.res.oracle
+++ b/tests/metrics/oracle/func_ptr.0.res.oracle
@@ -1,5 +1,5 @@
 [kernel] Parsing func_ptr.c (with preprocessing)
-[kernel:typing:implicit-function-declaration] func_ptr.c:28: Warning: 
+[kernel:typing:implicit-function-declaration] func_ptr.c:29: Warning: 
   Calling undeclared function exit. Old style K&R code?
 [metrics] Defined functions (4)
   =====================
@@ -73,8 +73,8 @@
     <func_ptr.c>: exit; foo;
 [metrics] References to non-analyzed functions
   ------------------------------------
-  Function main calls exit (at func_ptr.c:28)
-  Function main references foo (at func_ptr.c:29)
+  Function main calls exit (at func_ptr.c:29)
+  Function main references foo (at func_ptr.c:30)
 [metrics] Statements analyzed by Eva
   --------------------------
   13 stmts in analyzed functions, 6 stmts analyzed (46.2%)
diff --git a/tests/metrics/oracle/func_ptr.1.res.oracle b/tests/metrics/oracle/func_ptr.1.res.oracle
index 6fc64c87adc..06495304903 100644
--- a/tests/metrics/oracle/func_ptr.1.res.oracle
+++ b/tests/metrics/oracle/func_ptr.1.res.oracle
@@ -1,5 +1,5 @@
 [kernel] Parsing func_ptr.c (with preprocessing)
-[kernel:typing:implicit-function-declaration] func_ptr.c:28: Warning: 
+[kernel:typing:implicit-function-declaration] func_ptr.c:29: Warning: 
   Calling undeclared function exit. Old style K&R code?
 [metrics] Defined functions (4)
   =====================
diff --git a/tests/metrics/oracle/reach.res.oracle b/tests/metrics/oracle/reach.res.oracle
index 0356ff2a0ed..672174fdaaa 100644
--- a/tests/metrics/oracle/reach.res.oracle
+++ b/tests/metrics/oracle/reach.res.oracle
@@ -108,8 +108,8 @@
     <reach.c>: baz; foo;
 [metrics] References to non-analyzed functions
   ------------------------------------
-  Function main references foo (at reach.c:26)
-  Initializer of t references baz (at reach.c:10)
+  Function main references foo (at reach.c:27)
+  Initializer of t references baz (at reach.c:11)
 [metrics] Statements analyzed by Eva
   --------------------------
   12 stmts in analyzed functions, 7 stmts analyzed (58.3%)
diff --git a/tests/metrics/oracle/referenced-by-acsl.res.oracle b/tests/metrics/oracle/referenced-by-acsl.res.oracle
index c7110eb0416..6f3730a9713 100644
--- a/tests/metrics/oracle/referenced-by-acsl.res.oracle
+++ b/tests/metrics/oracle/referenced-by-acsl.res.oracle
@@ -60,7 +60,7 @@
     <referenced-by-acsl.c>: f;
 [metrics] References to non-analyzed functions
   ------------------------------------
-  f referenced by an ACSL specification (at referenced-by-acsl.c:7)
+  f referenced by an ACSL specification (at referenced-by-acsl.c:8)
 [metrics] Statements analyzed by Eva
   --------------------------
   2 stmts in analyzed functions, 2 stmts analyzed (100.0%)
diff --git a/tests/metrics/reach.c b/tests/metrics/reach.c
index 1fdcc0eb745..7092caac558 100644
--- a/tests/metrics/reach.c
+++ b/tests/metrics/reach.c
@@ -1,4 +1,5 @@
 /* run.config
+   PLUGIN: @PTEST_PLUGIN@ inout
    STDOPT: +"-metrics-by-function -metrics-eva-cover"
 **/
 
diff --git a/tests/metrics/referenced-by-acsl.c b/tests/metrics/referenced-by-acsl.c
index 2fd056aa60b..b867b784224 100644
--- a/tests/metrics/referenced-by-acsl.c
+++ b/tests/metrics/referenced-by-acsl.c
@@ -1,4 +1,5 @@
 /* run.config
+   PLUGIN: @PTEST_PLUGIN@ inout
    STDOPT: +"-metrics-eva-cover"
 **/
 
diff --git a/tests/metrics/unreachable.c b/tests/metrics/unreachable.c
index 8d46f2b5918..17314feb539 100644
--- a/tests/metrics/unreachable.c
+++ b/tests/metrics/unreachable.c
@@ -1,5 +1,5 @@
 /* run.config
- PLUGIN: @PTEST_PLUGIN@ scope
+   PLUGIN: @PTEST_PLUGIN@ inout,scope
    STDOPT: +"-metrics-eva-cover -then -main foo"
 */
 void foo () {
diff --git a/tests/metrics/used-files.i b/tests/metrics/used-files.i
index bebb54173e8..1e26ff05add 100644
--- a/tests/metrics/used-files.i
+++ b/tests/metrics/used-files.i
@@ -1,6 +1,8 @@
 /* run.config
-   OPT: -metrics-used-files %{dep:@PTEST_DIR@/@PTEST_NAME@1.i} %{dep:@PTEST_DIR@/@PTEST_NAME@2.i} %{dep:@PTEST_DIR@/@PTEST_NAME@3.i} %{dep:@PTEST_DIR@/@PTEST_NAME@4.i} %{dep:@PTEST_DIR@/@PTEST_NAME@5.i} %{dep:@PTEST_DIR@/@PTEST_NAME@6.i} %{dep:@PTEST_DIR@/@PTEST_NAME@7.i} %{dep:@PTEST_DIR@/@PTEST_NAME@8.i} %{dep:@PTEST_DIR@/@PTEST_NAME@9.c} @PTEST_DIR@/@PTEST_NAME@1.h @PTEST_DIR@/@PTEST_NAME@2.h
-   OPT: -metrics-used-files -main g %{dep:@PTEST_DIR@/@PTEST_NAME@1.i} %{dep:@PTEST_DIR@/@PTEST_NAME@2.i} %{dep:@PTEST_DIR@/@PTEST_NAME@3.i} %{dep:@PTEST_DIR@/@PTEST_NAME@4.i} %{dep:@PTEST_DIR@/@PTEST_NAME@5.i} %{dep:@PTEST_DIR@/@PTEST_NAME@6.i} %{dep:@PTEST_DIR@/@PTEST_NAME@7.i} %{dep:@PTEST_DIR@/@PTEST_NAME@8.i} %{dep:@PTEST_DIR@/@PTEST_NAME@9.c} @PTEST_DIR@/@PTEST_NAME@1.h @PTEST_DIR@/@PTEST_NAME@2.h
+   MACRO: SOURCES %{dep:@PTEST_DIR@/@PTEST_NAME@1.i} %{dep:@PTEST_DIR@/@PTEST_NAME@2.i} %{dep:@PTEST_DIR@/@PTEST_NAME@3.i} %{dep:@PTEST_DIR@/@PTEST_NAME@4.i} %{dep:@PTEST_DIR@/@PTEST_NAME@5.i} %{dep:@PTEST_DIR@/@PTEST_NAME@6.i} %{dep:@PTEST_DIR@/@PTEST_NAME@7.i} %{dep:@PTEST_DIR@/@PTEST_NAME@8.i} %{dep:@PTEST_DIR@/@PTEST_NAME@9.c} %{dep:@PTEST_DIR@/@PTEST_NAME@1.h} %{dep:@PTEST_DIR@/@PTEST_NAME@2.h}
+   DEPS: @PTEST_DIR@/@PTEST_NAME@10.c
+   OPT: -metrics-used-files @SOURCES@
+   OPT: -metrics-used-files -main g @SOURCES@
 */
 
 int h(void);
-- 
GitLab