resolve logs affichent les commandes

This commit is contained in:
Hugo LAMY
2021-12-20 15:49:04 +01:00
parent 863e48a4fa
commit c2e0c0bdcb

View File

@@ -181,11 +181,12 @@ cd $(dirname $0)
}
# compare the execution output and mark and print the success or failure
# receive parameters : $1 bash execution output, $2 minishell execution output
# receive parameters : $1 bash execution output, $2 minishell execution output, $3 commands
function compare_output
{
bash_output="$1"
minishell_output="$2"
sent_commands="$3"
if [ "$bash_output" = "$minishell_output" ]
then
(( SUCCESS_TEST++ ))
@@ -195,12 +196,12 @@ cd $(dirname $0)
if [ $PRINT -eq 1 ]
then
failure_cmd="FAILURE line $(( $LINE_NUMBER - 1 )), command : "
print_command "$failure_cmd" "$@" "$MAGENTA"
print_command "$failure_cmd" "$3" "$MAGENTA"
fi
# print simple log
echo -e $B_WHITE"\n\n$@\n-----------"$ENDCO >>$BASH_LOG
echo -e $B_WHITE"\n\n$3\n-----------"$ENDCO >>$BASH_LOG
echo "$bash_output" >> $BASH_LOG
echo -e $B_WHITE"\n\n$@\n-----------"$ENDCO >>$MINISHELL_LOG
echo -e $B_WHITE"\n\n$3\n-----------"$ENDCO >>$MINISHELL_LOG
echo "$minishell_output" >> $MINISHELL_LOG
fi
}
@@ -288,7 +289,7 @@ cd $(dirname $0)
minishell_execution="$( echo "$minishell_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" )"
fi
compare_output "$bash_execution" "$minishell_execution"
compare_output "$bash_execution" "$minishell_execution" "$commands"
}
# function to print the results