|
@@ -1,84 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
-
|
|
|
-echo "Test 03: 2 compilations dans le même dossier, même projet."
|
|
|
-echo "Un des deux doit tomber en erreur"
|
|
|
-
|
|
|
-if test "$TRAVIS" = "true";
|
|
|
-then
|
|
|
- URL_FILE=url_test.pub.txt
|
|
|
-else
|
|
|
- URL_FILE=url_test.priv.txt
|
|
|
-fi
|
|
|
-
|
|
|
-if test -r "$URL_FILE";
|
|
|
-then
|
|
|
- URL_BASE=$(head -n1 "$URL_FILE")
|
|
|
- URL_GARDE=$(tail -n1 "$URL_FILE")
|
|
|
-else
|
|
|
- echo "'$URL_FILE' introuvable"
|
|
|
- exit 1
|
|
|
-fi
|
|
|
-
|
|
|
-# pids conserve la liste des pids
|
|
|
-# retcode conserve le code retour de chaque pid une fois terminé
|
|
|
-handle_child() {
|
|
|
- local tmp=()
|
|
|
- for((i=0;i<${#pids[@]};++i));
|
|
|
- do
|
|
|
- if test ! -d /proc/${pids[i]};
|
|
|
- then
|
|
|
- wait ${pids[i]}
|
|
|
- retcode[${pids[i]}]=$?
|
|
|
- else
|
|
|
- tmp+=(${pids[i]})
|
|
|
- fi
|
|
|
- done
|
|
|
- pids=(${tmp[@]})
|
|
|
-}
|
|
|
-
|
|
|
-set -o monitor
|
|
|
-trap "handle_child" CHLD
|
|
|
-
|
|
|
-
|
|
|
-# Start background processes
|
|
|
-./cocktail -v \
|
|
|
- -d MonDossier \
|
|
|
- -p Abro2 \
|
|
|
- -b "$URL_BASE" \
|
|
|
- -g "$URL_GARDE" &
|
|
|
-pids+=($!)
|
|
|
-
|
|
|
-./cocktail -v \
|
|
|
- -d MonDossier \
|
|
|
- -p Abro2 \
|
|
|
- -b "$URL_BASE" \
|
|
|
- -g "$URL_GARDE" &
|
|
|
-pids+=($!)
|
|
|
-
|
|
|
-# Wait until all background processes are stopped
|
|
|
-while [ ${#pids[@]} -gt 0 ];
|
|
|
-do
|
|
|
- echo "WAITING FOR: ${pids[@]}";
|
|
|
- sleep 2;
|
|
|
-done
|
|
|
-echo STOPPED
|
|
|
-
|
|
|
-# affichage des code retour et generation de la chaine de test
|
|
|
-for pid in "${!retcode[@]}"
|
|
|
-do
|
|
|
- statusstring="$statusstring $pid=${retcode[$pid]}"
|
|
|
- retcodestr="${retcodestr}${retcode[$pid]}"
|
|
|
-done
|
|
|
-echo $statusstring
|
|
|
-
|
|
|
-if test $retcodestr -eq "02" -o $retcodestr -eq "20";
|
|
|
-then
|
|
|
- echo "Test réussi"
|
|
|
- echo "Un des 2 processus s'est terminé en code 0 et l'autre en code 2"
|
|
|
- exit 0
|
|
|
-else
|
|
|
- echo "Test échoué."
|
|
|
- echo "Un des 2 processus doit se terminer en code 0 et l'autre en code 2"
|
|
|
- exit 1
|
|
|
-fi
|
|
|
-
|