From 576f540a769ce08bc4a103a1baa179e0541526cd Mon Sep 17 00:00:00 2001
From: Julien Girard <julien.girard2@cea.fr>
Date: Fri, 12 Jul 2024 14:51:35 +0200
Subject: [PATCH] [test][ci] simplify test structure

---
 Makefile           |  5 +---
 caisar.opam        |  2 +-
 dune-project       |  2 +-
 flake.nix          |  2 +-
 tests/comparison.t |  1 +
 tests/dune         | 57 +++++++++-------------------------------------
 tests/sequencing.t |  1 +
 7 files changed, 17 insertions(+), 53 deletions(-)

diff --git a/Makefile b/Makefile
index b5e8c7b..578e218 100644
--- a/Makefile
+++ b/Makefile
@@ -11,14 +11,11 @@ uninstall:
 	dune uninstall
 
 test:
-	dune build @tests/local
+	dune runtest
 
 test-ci:
 	dune build -j2 @tests/ci
 
-test-lib:
-	dune runtest -j2 lib
-
 promote:
 	dune promote --root=.
 
diff --git a/caisar.opam b/caisar.opam
index 63b528d..393bada 100644
--- a/caisar.opam
+++ b/caisar.opam
@@ -10,7 +10,7 @@ homepage: "https://git.frama-c.com/pub/caisar"
 doc: "https://git.frama-c.com/pub/caisar"
 bug-reports: "https://git.frama-c.com/pub/caisar/issues"
 depends: [
-  "dune" {>= "3.8"}
+  "dune" {>= "3.12"}
   "ocaml" {>= "4.13"}
   "dune-site" {>= "2.9.0"}
   "zarith" {>= "1.7"}
diff --git a/dune-project b/dune-project
index 5b1c3df..41e3656 100644
--- a/dune-project
+++ b/dune-project
@@ -1,4 +1,4 @@
-(lang dune 3.8)
+(lang dune 3.12)
 (name caisar)
 (version 2.0)
 
diff --git a/flake.nix b/flake.nix
index 6c2d79d..4709453 100644
--- a/flake.nix
+++ b/flake.nix
@@ -95,8 +95,8 @@
               dontInstall = true;
               doCheck = true;
               checkPhase = ''
+                make test
                 make test-ci
-                make test-lib
               '';
               buildInputs = oldAttrs.buildInputs ++
                 [ pkgs.python3Packages.onnx ];
diff --git a/tests/comparison.t b/tests/comparison.t
index a901ae8..6887f27 100644
--- a/tests/comparison.t
+++ b/tests/comparison.t
@@ -2,6 +2,7 @@
 
   $ ls ../examples/
   acasxu
+  arithmetic
   mnist
   onnx_rewrite
 
diff --git a/tests/dune b/tests/dune
index 1700ee9..48dee0c 100644
--- a/tests/dune
+++ b/tests/dune
@@ -1,76 +1,41 @@
 (cram
- (alias local)
- (applies_to * \ nir_to_onnx acasxu_ci arithmetic comparison sequencing)
+ (applies_to * \ nir_to_onnx acasxu_ci)
  (deps
   (package caisar)
   setup_env.sh
+  (glob_files bin/*)
+  filter_tmpdir.sh
   TestNetwork.nnet
   TestNetworkONNX.onnx
   TestSVM.ovo
-  (glob_files bin/*)
-  filter_tmpdir.sh
-  ../lib/xgboost/example/california.csv
-  ../lib/xgboost/example/california.json
-  )
- (package caisar))
-
- (cram
- (alias local)
- (applies_to arithmetic)
- (deps
-  (package caisar)
-  setup_env.sh
-  (glob_files bin/*)
-  filter_tmpdir.sh
   ../examples/arithmetic/arithmetic.why
-  ../examples/arithmetic/FNN_s42.onnx
-  )
- (package caisar))
-
- (cram
- (alias local)
- (applies_to comparison)
- (deps
-  (package caisar)
-  setup_env.sh
-  (glob_files bin/*)
-  filter_tmpdir.sh
   ../examples/onnx_rewrite/comparison.mlw
+  ../examples/onnx_rewrite/sequencing.mlw
+  ../examples/arithmetic/FNN_s42.onnx
   ../examples/mnist/nets/pruned/FNN_28x28_s42.onnx
   ../examples/mnist/nets/pruned/FNN_28x28_pruned_s42.onnx
-  ../examples/mnist/csv/single_image.csv
-  )
- (package caisar))
-
- (cram
- (alias local)
- (applies_to sequencing)
- (deps
-  (package caisar)
-  setup_env.sh
-  (glob_files bin/*)
-  filter_tmpdir.sh
-  ../examples/onnx_rewrite/sequencing.mlw
   ../examples/mnist/nets/splitted/FNN_28x28_pre_s42.onnx
   ../examples/mnist/nets/splitted/FNN_28x28_post_s42.onnx
   ../examples/mnist/csv/single_image.csv
+  ../lib/xgboost/example/california.csv
+  ../lib/xgboost/example/california.json
   )
  (package caisar))
 
-
 (cram
  (alias ci)
  (enabled_if %{bin-available:python3})
+ (runtest_alias false)
  (deps
   (package caisar)
   setup_env.sh
+  (glob_files bin/*)
+  filter_tmpdir.sh
   TestNetwork.nnet
   TestNetworkONNX.onnx
+  TestSVM.ovo
   ../examples/acasxu/nets/onnx/ACASXU_1_1.onnx
   ../examples/acasxu/nets/onnx/ACASXU_1_9.onnx
-  TestSVM.ovo
-  (glob_files bin/*)
-  filter_tmpdir.sh
   ../lib/xgboost/example/california.csv
   ../lib/xgboost/example/california.json)
  (package caisar))
diff --git a/tests/sequencing.t b/tests/sequencing.t
index 90676de..fff4808 100644
--- a/tests/sequencing.t
+++ b/tests/sequencing.t
@@ -2,6 +2,7 @@
 
   $ ls ../examples/
   acasxu
+  arithmetic
   mnist
   onnx_rewrite
 
-- 
GitLab