still working on telnet tester

This commit is contained in:
Eric LAZO
2022-08-15 01:47:37 +02:00
parent 21efbef86a
commit aa03880601
12 changed files with 228 additions and 50 deletions

51
main_test.sh Executable file
View File

@@ -0,0 +1,51 @@
#! /bin/bash
# import and run all tests
#test_files=("test_template.sh" "test_header.sh" "test_body.sh")
#test_files=("test_template.sh" "test_header.sh" "test_path.sh")
test_files=("test_path.sh")
test_all()
{
rm -rf telnet.out
rm -rf webserv.log
rm -rf compare.txt
rm -rf expected.txt
for i in "${test_files[@]}"
do
source $i
source telnet_test.sh
# echo $host $i
./webserv $config_file &>> webserv.log &
echo -e "${_GREEN}Running Telnet Test on '$test_name'${_END}"
sleep 1
# echo "$connect_to_telnet"
# run | telnet >> telnet.out
run | telnet > compare.txt
pkill webserv
echo -e "\n\n------\n" &>> webserv.log
# cat compare.txt
# cat $expected_result_file
DIFF=$(diff -q compare.txt $expected_result_file)
if [ "$DIFF" == "" ];
then
echo "Good diff"
else
diff compare.txt $expected_result_file
fi
cat compare.txt >> telnet.out
done
}
test_all