diff --git a/Assignment-06/starter/dsh b/Assignment-06/starter/dsh index b3a2814877cc42b4174b34f709611e542d28b8ae..3daae752e2220246e95bbf3530c95503a27df392 100755 Binary files a/Assignment-06/starter/dsh and b/Assignment-06/starter/dsh differ diff --git a/Assignment-06/starter/rsh_cli.c b/Assignment-06/starter/rsh_cli.c index 57ebce8ed2d46b6c11484631dd176099544dfbfc..d783e23398729619c69f3049c711a8bbcad54a45 100644 --- a/Assignment-06/starter/rsh_cli.c +++ b/Assignment-06/starter/rsh_cli.c @@ -276,4 +276,4 @@ int client_cleanup(int cli_socket, char *cmd_buff, char *rsp_buff, int rc){ //Echo the return value that was passed as a parameter return rc; -} \ No newline at end of file +} diff --git a/Assignment-06/starter/student_tests.sh b/Assignment-06/starter/student_tests.sh index 673110a4ad94ccf5e56a141c5d3a21a10f371082..b8f507936244c76adcf7bc8b5ca3e88949cdb36a 100644 --- a/Assignment-06/starter/student_tests.sh +++ b/Assignment-06/starter/student_tests.sh @@ -84,6 +84,50 @@ EOF [ "$status" -ne 0 ] } +@test "Server handles quotes" { + start_server + + run ./dsh -c -i 127.0.0.1 -p 5678 <<EOF +echo "Hello, World!" +exit +EOF + + # Assertions + [ "$status" -eq 0 ] + [[ "$output" == *"Hello, World!"* ]] + + # Stop the server + stop_server +} + +@test "Server handles misspelled commands" { + start_server + + run ./dsh -c -i 127.0.0.1 -p 5678 <<EOF +ehco Hello, World! +exit +EOF + + [ "$status" -eq 0 ] + [[ "$output" == *"not found"* || "$output" == *"error"* ]] + + stop_server +} + +@test "Server handles complex commands with pipes and quotes" { + start_server + + run ./dsh -c -i 127.0.0.1 -p 5678 <<EOF +echo "Hello, World!" | wc -c +exit +EOF + + [ "$status" -eq 0 ] + [[ "$output" == *"14"* ]] + + stop_server +} +