minishell test script
This commit is contained in:
parent
0109620855
commit
ededbc98f4
6
Makefile
6
Makefile
@ -6,7 +6,7 @@
|
||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
||||
# Updated: 2025/03/01 12:18:10 by whaffman ######## odam.nl #
|
||||
# Updated: 2025/03/01 12:36:27 by whaffman ######## odam.nl #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -73,9 +73,9 @@ $$($(1)_OBJ_PATH):
|
||||
endef
|
||||
|
||||
# Copy the release build configuration to the root
|
||||
$(NAME): $(BUILD_PATH)/release/$(NAME)
|
||||
$(NAME): release
|
||||
$(info $(bold)$(green)Copying release build to root$(reset))
|
||||
cp $< $@
|
||||
cp ./build/release/minishell $@
|
||||
|
||||
$(foreach config,$(BUILD_CONFIGS),$(eval $(call BUILD_TARGETS,$(config))))
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: marvin <marvin@student.42.fr> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/02/04 16:13:13 by whaffman #+# #+# */
|
||||
/* Updated: 2025/03/01 11:22:11 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/03/01 12:51:53 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
# endif
|
||||
|
||||
# ifdef NOPROMPT
|
||||
# define PROMPT ">"
|
||||
# define PROMPT "$"
|
||||
# else
|
||||
# define PROMPT 0
|
||||
# endif
|
||||
|
||||
35
test_minishell.sh
Executable file
35
test_minishell.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a file argument is provided
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <text_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEXT_FILE=$1
|
||||
|
||||
# Step 2: make fclean
|
||||
make fclean
|
||||
|
||||
# Step 3: make with FLAGS
|
||||
make -j4 FLAGS="-DNOCOLORS -DNOBANNER -DNOPROMPT"
|
||||
|
||||
# Add 'export PS1=">"' to the start of the TEXT_FILE
|
||||
sed -i '1i export PS1="$"' "$TEXT_FILE"
|
||||
|
||||
# Step 4: Run ./minishell with the text file as input and redirect output to a temp file
|
||||
./minishell < "$TEXT_FILE" > minishell_output.txt 2>&1
|
||||
|
||||
# Step 5: Run bash with the text file as input and redirect output to a temp file
|
||||
export PS1=">"; bash -i < "$TEXT_FILE" > bash_output.txt 2>&1
|
||||
|
||||
# Remove the first line of minishell_output.txt and bash_output.txt
|
||||
sed -i '1d' "$TEXT_FILE"
|
||||
sed -i '1d' minishell_output.txt
|
||||
sed -i '1d' bash_output.txt
|
||||
|
||||
# Step 6: Compare the output files with diff and show the result
|
||||
diff -u --color minishell_output.txt bash_output.txt
|
||||
|
||||
# Remove the temp files
|
||||
rm minishell_output.txt bash_output.txt
|
||||
Loading…
Reference in New Issue
Block a user