#! /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