From 53c0de4bcdd378a71735d1fbcd40145bf85016cc Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Tue, 7 Sep 2021 16:45:57 +0200
Subject: [PATCH] [analysis-scripts] prefer cvise (if available) to creduce

---
 share/analysis-scripts/creduce.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/share/analysis-scripts/creduce.sh b/share/analysis-scripts/creduce.sh
index d35a3fc6f4f..0c1a590ffb3 100755
--- a/share/analysis-scripts/creduce.sh
+++ b/share/analysis-scripts/creduce.sh
@@ -25,6 +25,9 @@ usage="
 Script to run C-Reduce (https://embed.cs.utah.edu/creduce) when debugging
 Frama-C, or when minimizing test cases resulting in a Frama-C error.
 
+NOTE: some distributions now use 'cvise' (a Python port of creduce)
+      instead of 'creduce', but it is backwards-compatible.
+
 # Requirements
 
 - C-Reduce installed in the PATH, or its path in environment variable CREDUCE;
@@ -102,11 +105,17 @@ dir_for_reduction="creducing"
 script_for_creduce="./script_for_creduce.sh"
 
 if [ -z "$CREDUCE" ]; then
-    CREDUCE="creduce"
+    # Now some distributions have 'cvise' instead of 'creduce', so try it
+    # if found in PATH
+    if command -v cvise 2>&1 >/dev/null; then
+        CREDUCE="cvise"
+    else
+        CREDUCE="creduce"
+    fi
 fi
 
 if ! command -v "$CREDUCE" 2>&1 >/dev/null; then
-    echo "creduce not found; install it in the PATH or"
+    echo "cvise/creduce not found; install it in the PATH or"
     echo "put it in environment variable CREDUCE."
     exit 1
 fi
-- 
GitLab