sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

check-patches.sh (743B)


      1 #!/bin/bash
      2 #
      3 # Usage: ./misc/test/check-patches.sh
      4 #
      5 # Bash script that checks for any of the patches failing to apply.
      6 # Read patches/README.md for more information.
      7 
      8 export PATCH_OPTS="--merge"
      9 patches=("O_COLEMAK" "O_GITSTATUS" "O_NAMEFIRST" "O_RESTOREPREVIEW")
     10 z=$(( 1 << ${#patches[@]} ))
     11 pid=$$
     12 ret=0
     13 trap 'ret=1' SIGUSR1
     14 
     15 for ((n=1; n < z; ++n)); do
     16     for ((i=0; i < ${#patches[@]}; ++i)); do
     17         printf "%s=%d " "${patches[$i]}" "$(( (n & (1 << i)) != 0 ))"
     18     done | tee "/dev/stderr" | (
     19         make clean -s
     20         if ! xargs make 2>&1; then
     21             echo "[FAILED]" >&2
     22             kill -SIGUSR1 "$pid"
     23         else
     24             echo "[SUCCESS]" >&2
     25         fi
     26         git restore src
     27     ) >/dev/null
     28 done
     29 exit "$ret"