-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscript_v.sh
executable file
·63 lines (53 loc) · 1.14 KB
/
script_v.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
RED="\x1B[1;31m"
GREEN="\x1B[1;32m"
EOC="\x1B[0m"
DIR=log_v
DIR_C=resources/champions
NBC=$1
champ=$2
if ! test -d $DIR;
then
mkdir $DIR
fi
if [[ $# == 0 ]]
then
echo "Usage: $0 [number of champ 1-4] <champ name> <...>"
echo " -champ name are given without the .cor"
echo " -champ have to be placed in the folder resources/champions"
exit 1
fi
if ! [[ ${NBC} -gt 0 && ${NBC} -lt 5 ]]
then
echo "Usage: $0 [number of champ 1-4] <champ name> <...>"
echo "Illegal number of champions"
exit 1
fi
((NBC++))
if ! [[ $NBC == $# ]]
then
echo "Usage: $0 [number of champ 1-4] <champ name> <...>"
echo "Illegal number of parameters"
exit 1
fi
for i in ${@:2}
do
./Corewar/asm ${DIR_C}/$i.s
string+="${DIR_C}/$i.cor "
file+="${i}_"
done
string=${string%?}
file=${file%?}
make -C Corewar/
if ! [ -s ${DIR}/${NBC}.${champ}.log42 ]
then
./resources/corewar -v 31 $string > ${DIR}/${file}.log42
fi
./Corewar/corewar -v 31 $string > ${DIR}/${file}.log
diff ${DIR}/${file}.log42 ${DIR}/${file}.log > ${DIR}/${file}.diff
if [ -s ${DIR}/${file}.diff ]
then
echo -e "${RED}${file} is NOK !${EOC}"
else
echo -e "${GREEN}${file} is OK !${EOC}"
fi