-
Notifications
You must be signed in to change notification settings - Fork 0
/
do.sh
executable file
·65 lines (56 loc) · 2.12 KB
/
do.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
64
65
#!/usr/bin/env bash
libasm_path='../'
libasm=$libasm_path'libasm.a'
incl_path=$libasm_path
mlibasm_srcs='./srcs'
mli_cc="clang"
mli_cflags="-Wall -Wextra -Werror"
if [ "$OSTYPE" = "linux-gnu" ]; then
mli_cflags+=" -fsanitize=address -g3"
sed s/"CHECKLEAKS 1"/"CHECKLEAKS 0"/g ./mlibasm.h -i
fi
do_test () {
for i in "$@"; do
if $mli_cc $mli_cflags -I./ $mlibasm_srcs/$i $libasm mlibasm.a \
2>/dev/null 1>&2 ; then
./a.out
fi
done
}
recompile () {
do_bonus=0
if ! make bonus -C $libasm_path 1>/dev/null 2>/dev/null ; then
do_bonus=1
printf "\e[0;91m\t\tCOULD'T COMPILE BONUS !!\e[0m\n" >&2
if ! make -C $libasm_path 1>/dev/null ; then
printf "\e[0;91m\t\tCOULD'T COMPILE !!\e[0m\n" >&2 && return 1
fi
fi
if ! make ; then
echo "Oopsi"
return 1
fi
do_test write.c read.c strlen.c strcmp.c strcpy.c strdup.c
if [ $do_bonus -eq 0 ]; then
do_test atoi_base.c list_push_front.c list_size.c list_sort.c list_remove_if.c
fi
rm -f a.out
make fclean
}
printf "\e[0;1;94m"
printf "# ****************************************************************************** #\n"
printf "# #\n"
printf "# ::: ::: ::: ::: #\n"
printf "# :+:+: :+:+: :+: :+: :+: #\n"
printf "# +:+ +:+:+ +:+ +:+ +:+ #\n"
printf "# +#+ +:+ +#+ +#+ +#+ +#+#+#+ +#+#+#+ +#+#+#+ +#+#+#+#+ #\n"
printf "# +#+ +#+ +#+ #+# #+# #+# +#+# #+#+ #+# + #+# #\n"
printf "# #+# #+# #+# #+# #+# #+# #+# #+# +#+# +#+ + #+# #\n"
printf "# ### ### ### ### ####### ####### ####### ### # ### #\n"
printf "# #\n"
printf "# ****************************************************************************** #\n\n"
printf "\e[0m"
make fclean -C $libasm_path > /dev/null
recompile
make fclean -C $libasm_path > /dev/null
rm -f ./output