From d13dca80b235fe2f0dd5de17390a6350fe34f324 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Tue, 17 Mar 2020 12:57:08 +0100
Subject: [PATCH] [wp] cache update manual

---
 src/plugins/wp/Makefile.in     |  1 +
 src/plugins/wp/tests/README.md | 25 ++++++++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/plugins/wp/Makefile.in b/src/plugins/wp/Makefile.in
index c6e1295c6e5..144f9f736ef 100644
--- a/src/plugins/wp/Makefile.in
+++ b/src/plugins/wp/Makefile.in
@@ -188,6 +188,7 @@ wp-qualif-push:
 	git -C $(WP_CACHE_DIR) push -f
 
 wp-qualif-cleanup: wp-qualif-update
+	find $(WP_CACHE_DIR) -atime 2h -delete
 
 $(WP_CACHE_DIR):
 	git clone "git@git.frama-c.com:frama-c/wp-cache.git" $(WP_CACHE_DIR)
diff --git a/src/plugins/wp/tests/README.md b/src/plugins/wp/tests/README.md
index c88b74cb66d..d6b9387209d 100644
--- a/src/plugins/wp/tests/README.md
+++ b/src/plugins/wp/tests/README.md
@@ -21,22 +21,29 @@ git add tests/wp_gallery/oracle/find.*
 
 ## Update oracle for 'qualif' configuration (if there is such)
 
-1. generate oracle files and updated cache files
+1. update the cache
+```
+git -C src/plugins/wp/cache pull --rebase --prune
+```
+
+2. generate oracle files and updated cache files
 ```
 FRAMAC_WP_CACHE=update ptests.opt -config qualif tests/wp_gallery/find.i -show
 ptests.opt -config qualif tests/wp_gallery/find.i -update
 ```
 
-Note: cleaning the cache is _not_ recommanded when updating or modifying an
-existing test; actually it might introduce git merge conflicts that are
-annoying to resolve. But the cleaning can be usefull when adding a new test.
-It can be done using the command (before those of the step 1):
+3. publish the new cache
 ```
-rm -rf tests/wp_gallery/oracle_qualif/find.[0-9]*.session/cache/
+git -C src/plugins/wp/cache add -A
+git -C src/plugins/wp/cache commit -m "[wp] cache updates"
+git -C src/plugins/wp/cache push -f
 ```
 
-2. check again (for a final validation) before adding the oracle and cache files
+## Using Makefile
+
 ```
-ptests.opt -config qualif tests/wp_gallery/find.i
-git add tests/wp_gallery/oracle_qualif/find.*
+make wp-qualif           # Run qualif tests (clone cache if necessary)
+make wp-qualif-update    # Run with cache updates (git access)
+make wp-qualif-push      # Push cache updates (git access)
+make wp-qualif-cleanup   # Remove old cache entries (no access since 2h)
 ```
-- 
GitLab