test_cocktail_02 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. echo "Test 02: 2 compilations dans le même dossier, projets différents."
  3. echo "Les deux compilations doivent réussir"
  4. RC1=99
  5. RC2=99
  6. handle_child() {
  7. local tmp=()
  8. for((i=0;i<${#pids[@]};++i));
  9. do
  10. if test ! -d /proc/${pids[i]};
  11. then
  12. wait ${pids[i]}
  13. RC0=$?
  14. echo "Stopped ${pids[i]}; exit code: $RC0"
  15. if test "$RC1" -eq 99;
  16. then
  17. RC1="$RC0"
  18. else
  19. if test "$RC2" -eq 99;
  20. then
  21. RC2="$RC0"
  22. fi
  23. fi
  24. else
  25. tmp+=(${pids[i]})
  26. fi
  27. done
  28. pids=(${tmp[@]})
  29. }
  30. set -o monitor
  31. trap "handle_child" CHLD
  32. # Start background processes
  33. ./cocktail -v -d MonDossier -p Abro2 -b 'https://pad.exegetes.eu.org/p/g.DSXI1kGFT1gjor66$Abro-REP-Tele2-Principal/export/txt' -g 'https://pad.exegetes.eu.org/p/g.DSXI1kGFT1gjor66$Abro-REP-Tele2-Garde/export/txt' &
  34. pids+=($!)
  35. ./cocktail -v -d MonDossier -p Abro3 -b 'https://pad.exegetes.eu.org/p/g.DSXI1kGFT1gjor66$Abro-REP-Tele2-Principal/export/txt' -g 'https://pad.exegetes.eu.org/p/g.DSXI1kGFT1gjor66$Abro-REP-Tele2-Garde/export/txt' &
  36. pids+=($!)
  37. # Wait until all background processes are stopped
  38. while [ ${#pids[@]} -gt 0 ];
  39. do
  40. echo "WAITING FOR: ${pids[@]}";
  41. sleep 2;
  42. done
  43. echo STOPPED
  44. echo "RC1=$RC1 RC2=$RC2"
  45. if test "$RC1" -eq 0 -a "$RC2" -eq 0;
  46. then
  47. echo "Test réussi"
  48. exit 0
  49. fi
  50. echo "Test échoué"
  51. exit 1