All Projects → thallard → minishell_tester

thallard / minishell_tester

Licence: other
42 | Complex tester for minishell (42cursus)

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to minishell tester

printfTester
Tester for the ft_printf project of 42 school
Stars: ✭ 94 (+203.23%)
Mutual labels:  valgrind, tester, 42
gnlTester
Tester for the get_next_line project of 42 school
Stars: ✭ 87 (+180.65%)
Mutual labels:  valgrind, tester, 42
42header.vim
Add and update the 42 comment header at the top of your files
Stars: ✭ 15 (-51.61%)
Mutual labels:  42born2code, 42, 42school
ft get next line
42 São Paulo - get_next_line
Stars: ✭ 17 (-45.16%)
Mutual labels:  42born2code, 42, 42school
42 Projects
What is 42? How does curriculum look like? A manual reference for all 42 projects I've done so far (Zappy, Malloc, C++ Piscine... check out for more)! 💡📈
Stars: ✭ 111 (+258.06%)
Mutual labels:  42born2code, 42, 42school
42ShellTester
Integration test suite for Shell implementation
Stars: ✭ 35 (+12.9%)
Mutual labels:  42born2code, 42, 42school
42MapGenerator
Generate FdF maps of the real world, the Earth's moon and the planet Venus for the project Fil de Fer
Stars: ✭ 58 (+87.1%)
Mutual labels:  42born2code, 42, 42school
passport-42
Passport strategy for authenticating with 42 using the OAuth 2.0 API
Stars: ✭ 26 (-16.13%)
Mutual labels:  42born2code, 42, 42school
libftTester
Tester for the libft project of 42 school
Stars: ✭ 141 (+354.84%)
Mutual labels:  valgrind, tester, 42
1337
This repository contains a collection of 42School cursus projects in addition to the pool/piscine days (with a detailed step by step explanation). Enjoy!
Stars: ✭ 35 (+12.9%)
Mutual labels:  42born2code, 42, 42school
ftprintfdestructor
A script that destroys the school 42 project ft_printf
Stars: ✭ 20 (-35.48%)
Mutual labels:  tester, 42born2code, 42
init
School 42 project // DevOps project
Stars: ✭ 13 (-58.06%)
Mutual labels:  42, 42school
examrank-02-03-04-05-06
exam project 2020
Stars: ✭ 195 (+529.03%)
Mutual labels:  42born2code, 42school
42-piscine-exam
This repo has all exercises of "C Exam Alone In The Dark - Beginner" sorted from level_00 to Level_05
Stars: ✭ 218 (+603.23%)
Mutual labels:  42born2code, 42
IRC-Server
IRC server based on TCP/IP protocol to rfc1459 standard
Stars: ✭ 27 (-12.9%)
Mutual labels:  42born2code, 42school
42tools
Making 42 life better
Stars: ✭ 43 (+38.71%)
Mutual labels:  42born2code, 42
ValgrindHelperForAndroid
A easy way to use valgrind on Android device.
Stars: ✭ 53 (+70.97%)
Mutual labels:  valgrind
ghaction-cmake
cmake swiss army knife github docker action
Stars: ✭ 19 (-38.71%)
Mutual labels:  valgrind
valgrind
Enhanced Valgrind for Persistent Memory
Stars: ✭ 85 (+174.19%)
Mutual labels:  valgrind
QuickTraceiOSLogger
A real time iOS log trace tool, view iOS log with pc web browser under local area network, which will automatically scroll like xcode. 一个实时的iOS日志跟踪工具,在局域网中使用 PC Web 浏览器查看 iOS 日志,它将像xcode一样自动滚动。
Stars: ✭ 16 (-48.39%)
Mutual labels:  tester

Overview

The tester contains these features :

  • Built-in (echo, export, cd, unset, pwd & exit)
  • All separators (pipes and semicolons)
  • Redirection (<, >, >>) and redirection of STDERROR/STDOUT/FD (2>/dev/null 2>file 1>>file 1>/dev/null)
  • Environment variables (there are complex tests with these)
  • Quotes, escaping quotes and escaping characters
  • Leaks with Valgrind**
  • Print differences between your minishell results and bash ones with exit status ($?)
  • Check dynamic environment variables ($_, $PWD, $OLDPWD, $SHLVL, etc...)

** : For Valgrind check gurival's repository : https://github.com/grouville/valgrind_42, it's an useful tool to use Valgrind for MacOS.

Little peak of the tester :

animated

And with the short flag :

animated

Get started (VERY IMPORTANT)

Your minishell executable must work with -c flag.

First of all, you must have the below part in your main of your minishell, otherwise you won't be able to use the tester. If you don't understand this part or you're having some troubles, do not hesitate to contact me on Discord or Slack :

// argv[2] will contains the content of the line for example "echo something ; ls -la" 
int main(int argc, char **argv)
{
  // Your code...
  if (argc >= 3 && !ft_strncmp(argv[1], "-c", 3))
  {
    int exit_status = ft_launch_minishell(argv[2]);
    exit(exit_status);
  }
    // Above this is the function that normally launch your minishell, instead 
    // of reading line with a get_next_line or a read() on fd 0, you just have to get
    // the argv[2] (which contains the content) and execute it.
    // Your function should return the good exit status otherwise the tests may be considered as false.
  // Your code ...
}

And all of your return messages from exit, cd errors, echo errors should be print on STDERROR (on fd = 2).

When you have added this part in your main, your minishell's built-in echo must work for this test, let's try a :

bash test.sh compatibility

If you have this result then your minishell is working, you can use the tester !

Usage

To show all explained flags and global usage of the script :

bash test.sh help 

Global use of the tester (To see utility of each flags check the screenshot above) :

bash test.sh [--diff] [--fast] [--short] [--valgrind] <name_file> ...

Some examples on how to use it :

bash test.sh --diff all
bash test.sh --diff echo 
bash test.sh --fast echo cd
bash test.sh --diff --fast echo export unset
bash test.sh --diff --valgrind all
bash test.sh -f -s -d all

Contact

If you have any ideas on how to improve this tester or if you are a bug hunter, feel free to send a PM on Discord : hosrAAA#6964

https://profile.intra.42.fr/users/thallard

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].