Testing Debugging - alteixeira20/42_minishell GitHub Wiki
Testing Suite โ Bash Comparison Framework
Scripts Involved:
-
run_bash.sh
โ Executes each test command in Bash, stores cleaned output
-
run_minishell.sh
โ Executes each command with./minishell
, formats output identically
-
generate_summary_diff.py
โ Compares both outputs and generates a readable diff report
Directory Structure:
results/
โโโ bash/ # Output from bash -c
โโโ minishell/ # Output from ./minishell
โโโ diff/ # Unified diff of the two
โโโ diff_summary.txt
Test Case Format:
- Defined in
test_cases.txt
- Ignores lines starting with
#
(comments)
- Each line is one command to test
Diff Output:
- Includes Bash vs Minishell side-by-side results
- Highlights mismatches
- Helps locate syntax errors, whitespace issues, or unexpected return codes
Sample Test Flow โ End-to-End for echo $HOME
# Line from test_cases.txt
echo $HOME
# Step 1: Bash Output
bash -c "echo \$HOME" > results/bash/test1.out
# Step 2: Minishell Output
./minishell <<< "echo \$HOME" > results/minishell/test1.out
# Step 3: Diff
diff results/bash/test1.out results/minishell/test1.out > results/diff/test1.diff
# Step 4: Summary Entry
===== Test 1 =====
Command: echo $HOME
--- Minishell Output ---
/Users/username
--- Bash Output ---
/Users/username
--- Diff ---
(no output means identical)
Usage: make on the tester directory.