Comprehensive testing framework for pipex 🔍
📋 Overview | 🛠️ Installation | ⚡ Usage | 🔍 Tests | 📊 Results
A comprehensive testing framework designed to thoroughly validate your pipex implementation:
- Error handling: Validates responses to invalid inputs, permissions and command errors
- Functionality: Tests core pipeline and redirection capabilities
- Memory management: Checks for leaks and file descriptor management
- Bonus features: Tests heredoc support and multiple command pipelines
- Special cases: Verifies handling of empty commands, special characters, and more
The tester systematically compares your pipex output with the expected bash behavior.
GNU bash is required to use the tester. Valgrind support is detected. Also some tests need gcc.
Clone the repository into your pipex directory:
git clone https://github.com/Jarnomer/pipex-error-tester.gitRun the tester with shell or optionally give execution permissions:
bash pipex-error-tester/tester.sh [OPTIONS]chmod +x pipex-error-tester/tester.shpipex-error-tester/tester.sh [OPTIONS]The tester provides several options to target specific test categories:
-t, --test ID Run specific error test by ID
-v, --valid Run tests with valid commands
-e, --extra Run extra checks and logical tests
-b, --bonus Run heredoc and multi pipeline tests
-s, --special Run tests with special characters
-a, --all Run all tests except special tests
-l, --list List all available tests
-h, --help Show this help message
Run default error handling tests:
./tester.shRun all tests, excluding quotes and backslahes:
./tester.sh -aRun a specific error test:
./tester.sh -t 5Run bonus tests:
./tester.sh -butils.sh.
Tests proper error handling for:
- Non-existent input files
- Permission issues (read/write/execute)
- Invalid commands (with and without path)
- Unsupported command arguments
- Directory as command or output file
- Path environment issues
- Null and empty commands
Tests operation with valid commands:
- Basic pipelines (
ls | wc) - Text processing (
grep,sort) - Standard utilities (
cut -d: -f1)
Advanced checks for:
- Norminette, Makefile and forbidden functions
- Parallel execution of commands
- Signal handling (interrupt, segfault)
- Execution logic with various inputs
- Output message consistency
- Zombie processes
- File descriptor management (bonus)
Tests for bonus features:
- Multiple pipes (
cmd1 | cmd2 | cmd3 | ...) - Heredoc functionality (
<<) - Proper appending with heredoc (
>>) - Proper truncation with regular input (
>)
Complex tests with meta characters and advanced commands:
- Quote handling (
cut -d' ') - Special characters (
sed -E 's/\t/ /g') - Advanced text processing (
awk '/^#/ {next} {print}')
Test results are displayed in a clean, color-coded format:
- 🟢 Green [OK]: Test passed
- 🔴 Red [KO]: Test failed
- 🟡 Yellow: Test skipped or warning
For failed tests, detailed error information is saved to pipex_error.log including:
- Exit codes comparison
- Output differences
- Valgrind memory leak reports
For my other 42 projects and general information, please refer to the Hive42 page.
I have also created error handling unit testers for other projects like so_long and cub3D.
