-
Notifications
You must be signed in to change notification settings - Fork 4
/
tester.sh
executable file
·99 lines (87 loc) · 4.55 KB
/
tester.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# **************************************************************************** #
# #
# ::: :::::::: #
# tester.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ael-bekk <ael-bekk <ael-bekk@student.13 +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/02/15 14:44:38 by ael-bekk #+# #+# #
# Updated: 2022/02/17 16:10:43 by ael-bekk ### ########.fr #
# #
# **************************************************************************** #
#!/bin/bash
l1="======================================================================================="
l2="---------------------------------------------------------------------------------------\n"
GREEN="\033[38;2;57;181;74m"
RED="\033[38;2;222;56;43m"
BLUE="\033[38;2;34;183;235m"
YELLOW="\033[38;2;255;176;0m"
PURPLE="\033[38;2;255;105;180m"
WHITE="\033[1;37m"
RESET="\033[0m"
if [ $# -gt 1 ]
then
echo -e "${red}no args chould enter${reset}" >&2 ; exit
fi
chmod +x srcs/*
printf "$RED$l1\n\n"
printf "\t██████╗ ██╗██████╗ ███████╗██╗ ██╗ ████████╗███████╗███████╗████████╗███████╗██████╗\n"
printf "\t██╔══██╗██║██╔══██╗██╔════╝╚██╗██╔╝ ██╔══╝██╔════╝██╔════╝ ██╔══╝██╔════╝██╔══██╗\n"
printf "\t██████╔╝██║██████╔╝█████╗ ╚███╔╝ ██║ █████╗ ███████╗ ██║ █████╗ ██████╔╝\n"
printf "\t██╔═══╝ ██║██╔═══╝ ██╔══╝ ██╔██╗ ██║ ██╔══╝ ╚════██║ ██║ ██╔══╝ ██╔══██╗\n"
printf "\t██║ ██║██║ ███████╗██╔╝ ██╗ ██║ ███████╗███████║ ██║ ███████╗██║ ██╗\n"
printf "\t╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚╝ ╚══════╝╚══════╝ ╚╝ ╚══════╝╚═╝ ╚═╝\n"
printf "\n$l1$RESET\n"
sleep 1
printf " Tester is ready!"
printf "\n$RED$l1$RESET\n\n"
if [ $# -eq 1 ]
then
mines="$1"
firstCharacter=${mines::1}
all_clear=`echo $1 | sed "s/e//g" | sed "s/m//g" | sed "s/p//g" | sed "s/h//g" | sed "s/a//g"`
err=`echo $1 | grep e`
mult=`echo $1 | grep m`
pip=`echo $1 | grep p`
herd=`echo $1 | grep h`
all=`echo $1 | grep a`
if [ "$err" != "" ] || [ "$mult" != "" ] || [ "$pip" != "" ] || [ "$herd" != "" ] || [ "$all" != "" ]
then
all_clear=`echo $all_clear | sed "s/-//g"`
fi
if [ "$all_clear" != "" ] || [ "$firstCharacter" != "-" ]
then
echo $GREEN"usage: ./tester.sh [-aemph] [-a all_tests]"
echo " [-e error_handling_tests] [-m multi_pipe_tests] [-p one_pipe_tests] [-h here_doc_tests]$RESET\n" >&2 ; exit
fi
if [ "$err" != "" ] || [ "$all" != "" ]
then
./srcs/error_handling_m.sh "../pipex"
./srcs/error_handling_b.sh "../pipex"
./srcs/error_handling_h.sh "../pipex"
fi
if [ "$pip" != "" ] || [ "$all" != "" ]
then
./srcs/one_pipe.sh ../pipex
fi
if [ "$mult" != "" ] || [ "$all" != "" ]
then
./srcs/multi_pipe.sh ../pipex
fi
if [ "$herd" != "" ] || [ "$all" != "" ]
then
./srcs/here_doc.sh ../pipex
fi
else
./srcs/error_handling_m.sh "../pipex"
./srcs/error_handling_b.sh "../pipex"
./srcs/error_handling_h.sh "../pipex"
./srcs/one_pipe.sh "../pipex"
./srcs/multi_pipe.sh "../pipex"
./srcs/here_doc.sh "../pipex"
fi
for i in $(ps | grep -v zsh | grep -v TIME | grep -v tester.sh | cut -d" " -f 1)
do
kill -9 $i &> /dev/null
done
rm -fr afsasf in_file2 in_file1 in_file in_file3 my_error outfile outfile2 ssssssss vide