Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid looping over single, constant value (codefactor.io/ShellCheck).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 8 Dec 2019 20:32:34 +0000 (21:32 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 8 Dec 2019 21:31:09 +0000 (22:31 +0100)
tools/jenkins/Coverage.sh
tools/jenkins/DynamicAnalysis.sh
tools/jenkins/Flags.sh
tools/jenkins/Sanitizers.sh

index d2f54c1..a69bc5f 100755 (executable)
@@ -9,39 +9,39 @@ die() {
     exit 1
 }
 
     exit 1
 }
 
-do_cleanup() {
-  for d in "$BUILDFOLDER"
+### Check the node installation
+
+pkg_check() {
+  for pkg
   do
   do
-    if [ -d "$d" ]
+    if command -v $pkg
     then
     then
-      rm -rf "$d" || die "Could not remote $d"
+       echo "$pkg is installed. Good."
+    else
+       die "please install $pkg before proceeding"
     fi
   done
 }
 
     fi
   done
 }
 
-### Check the node installation
-
-for pkg in xsltproc gcovr ant cover2cover.py
-do
-   if command -v $pkg
-   then
-      echo "$pkg is installed. Good."
-   else
-      die "please install $pkg before proceeding"
-   fi
-done
+pkg_check xsltproc gcovr ant cover2cover.py
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
-do_cleanup
+do_cleanup() {
+  for d
+  do
+    if [ -d "$d" ]
+    then
+      rm -rf "$d" || die "Could not remove $d"
+    fi
+    mkdir "$d" || die "Could not create $d"
+  done
+}
 
 
-for d in "$BUILDFOLDER"
-do
-  mkdir "$d" || die "Could not create $d"
-done
+do_cleanup "$BUILDFOLDER"
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
index 04fe409..e28143c 100755 (executable)
@@ -7,40 +7,40 @@ die() {
     exit 1
 }
 
     exit 1
 }
 
-do_cleanup() {
-  for d in "$WORKSPACE/build" "$WORKSPACE/memcheck"
+### Check the node installation
+
+pkg_check() {
+  for pkg
   do
   do
-    if [ -d "$d" ]
+    if command -v $pkg
     then
     then
-      rm -rf "$d" || die "Could not remote $d"
+       echo "$pkg is installed. Good."
+    else
+       die "please install $pkg before proceeding"
     fi
   done
     fi
   done
-  find $WORKSPACE -name "memcheck_test_*.memcheck" -exec rm {} \;
 }
 
 }
 
-### Check the node installation
-
-for pkg in valgrind pcregrep
-do
-   if command -v $pkg
-   then
-      echo "$pkg is installed. Good."
-   else
-      die "please install $pkg before proceeding"
-   fi
-done
+pkg_check valgrind pcregrep
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
-do_cleanup
+do_cleanup() {
+  for d
+  do
+    if [ -d "$d" ]
+    then
+      rm -rf "$d" || die "Could not remove $d"
+    fi
+    mkdir "$d" || die "Could not create $d"
+  done
+  find $WORKSPACE -name "memcheck_test_*.memcheck" -exec rm {} \;
+}
 
 
-for d in "$WORKSPACE/build" "$WORKSPACE/memcheck"
-do
-  mkdir "$d" || die "Could not create $d"
-done
+do_cleanup "$WORKSPACE/build" "$WORKSPACE/memcheck"
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
index 35f5bc4..44ffae8 100755 (executable)
@@ -7,16 +7,6 @@ die() {
     exit 1
 }
 
     exit 1
 }
 
-do_cleanup() {
-  for d in "$WORKSPACE/build"
-  do
-    if [ -d "$d" ]
-    then
-      rm -rf "$d" || die "Could not remote $d"
-    fi
-  done
-}
-
 # Get an ON/OFF string from a command:
 onoff() {
   if "$@" > /dev/null ; then
 # Get an ON/OFF string from a command:
 onoff() {
   if "$@" > /dev/null ; then
@@ -33,12 +23,18 @@ onoff() {
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
-do_cleanup
+do_cleanup() {
+  for d
+  do
+    if [ -d "$d" ]
+    then
+      rm -rf "$d" || die "Could not remove $d"
+    fi
+    mkdir "$d" || die "Could not create $d"
+  done
+}
 
 
-for d in "$WORKSPACE/build"
-do
-  mkdir "$d" || die "Could not create $d"
-done
+do_cleanup "$WORKSPACE/build"
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
index b41839a..2a7719f 100755 (executable)
@@ -7,16 +7,6 @@ die() {
     exit 1
 }
 
     exit 1
 }
 
-do_cleanup() {
-  for d in "$WORKSPACE/build"
-  do
-    if [ -d "$d" ]
-    then
-      rm -rf "$d" || die "Could not remote $d"
-    fi
-  done
-}
-
 if [ -z "$1" ]
   then
     echo "No Sanitizer type selected - run Address"
 if [ -z "$1" ]
   then
     echo "No Sanitizer type selected - run Address"
@@ -46,27 +36,37 @@ fi
 
 ### Check the node installation
 
 
 ### Check the node installation
 
-for pkg in xsltproc
-do
-   if command -v $pkg
-   then
-      echo "$pkg is installed. Good."
-   else
-      die "please install $pkg before proceeding"
-   fi
-done
+pkg_check() {
+  for pkg
+  do
+    if command -v $pkg
+    then
+       echo "$pkg is installed. Good."
+    else
+       die "please install $pkg before proceeding"
+    fi
+  done
+}
+
+pkg_check xsltproc
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
 
 ### Cleanup previous runs
 
 ! [ -z "$WORKSPACE" ] || die "No WORKSPACE"
 [ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
 
-do_cleanup
+do_cleanup() {
+  for d
+  do
+    if [ -d "$d" ]
+    then
+      rm -rf "$d" || die "Could not remove $d"
+    fi
+    mkdir "$d" || die "Could not create $d"
+  done
+}
 
 
-for d in "$WORKSPACE/build"
-do
-  mkdir "$d" || die "Could not create $d"
-done
+do_cleanup "$WORKSPACE/build"
 
 NUMPROC="$(nproc)" || NUMPROC=1
 
 
 NUMPROC="$(nproc)" || NUMPROC=1