{"id":13460255,"url":"https://github.com/zstenger93/42_minishell_tester","last_synced_at":"2025-03-24T18:33:22.802Z","repository":{"id":154629886,"uuid":"621680507","full_name":"zstenger93/42_minishell_tester","owner":"zstenger93","description":"It's like cutting an onion. Will make you cry. 1000+ tests to dance on your nerves.","archived":false,"fork":false,"pushed_at":"2024-06-11T15:37:52.000Z","size":379,"stargazers_count":61,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T06:33:24.124Z","etag":null,"topics":["42","42born2code","42heilbronn","42minishell","42school","42tester","bash","minishell","minishell-test","minishell-tester","prompt","shell","terminal","tester","valgrind"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zstenger93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-31T06:53:22.000Z","updated_at":"2024-10-22T06:57:02.000Z","dependencies_parsed_at":"2024-02-28T09:35:50.298Z","dependency_job_id":"a7d48d48-ee3d-47ef-ab80-ab605395d054","html_url":"https://github.com/zstenger93/42_minishell_tester","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstenger93%2F42_minishell_tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstenger93%2F42_minishell_tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstenger93%2F42_minishell_tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstenger93%2F42_minishell_tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zstenger93","download_url":"https://codeload.github.com/zstenger93/42_minishell_tester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245328520,"owners_count":20597440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42","42born2code","42heilbronn","42minishell","42school","42tester","bash","minishell","minishell-test","minishell-tester","prompt","shell","terminal","tester","valgrind"],"created_at":"2024-07-31T10:00:38.146Z","updated_at":"2025-03-24T18:33:22.503Z","avatar_url":"https://github.com/zstenger93.png","language":"Shell","funding_links":[],"categories":["WELCOME"],"sub_categories":["**Minishell**"],"readme":"\n\u003ch1 align=center\u003e📖 42_minishell_tester\u003c/h1\u003e\n\u003cimg align=center src=\"https://github.com/zstenger93/42_minishell_tester/blob/master/tester.png\"\u003e\n\n# Menu\n\n[Setup](#setup)\n\n[Usage](#how-to-launch-the-tester)\n\n[Options](#options)\n\n[Install \u0026 Run](#how-to-install-and-run)\n\n[Updates](#updates)\n\n[Disclaimer](#disclaimer)\n\n[Contributors](#the-people-made-this-tester-possible)\n\n---\n\n# Setup\nFirst you should comment out everything what prints to terminal eg \"exit\" at exit, printf's for debugging etc\nThen modify your main loop:\nYou should only read with readline and use your own prompt when you launch the program by yourself typing ./minihsell into the terminal, you can check it this way:\n\n\n```c\n\tif (isatty(fileno(stdin)))\n\t\tshell-\u003eprompt = readline(shell-\u003eterminal_prompt);\n```\n\nElse if it is opened by another program/tester for example then use gnl as follows\n\n```c\n\tchar *line;\n\tline = get_next_line(fileno(stdin));\n\tshell-\u003eprompt = ft_strtrim(line, \"\\n\");\n\tfree(line);\n```\n\nSo it should look like something like this:\n\n```c\n\tif (isatty(fileno(stdin)))\n\t\tshell-\u003eprompt = readline(shell-\u003eterminal_prompt);\n\telse\n\t{\n\t\tchar *line;\n\t\tline = get_next_line(fileno(stdin));\n\t\tshell-\u003eprompt = ft_strtrim(line, \"\\n\");\n\t\tfree(line);\n\t}\n```\n\nI think from this you pretty much can figure it out, it isn't a big change :)\n\n---\n\n# How To Launch The Tester\nClone it to the root of your minishell\n\ncd to the testers folder\n## Options\n\n```bash\nbash tester.sh [m vm ne d b a] {b, builtins, pa, parsing, r, redirections, pi, pipelines, c, cmds, v, variables, co, corrections, path, s, syntax}\n\tm\t\t\t\t# Mandatory tests\n\tvm\t\t\t\t# Mandatory tests with valgrind\n\tne\t\t\t\t# Mandatory tests without environment\n\td\t\t\t\t# Mandatory pipe segfault test (BRUTAL)\n\tb\t\t\t\t# Bonus tests\n\ta\t\t\t\t# All the tests\n\n\tFor the mandatory and valgrind mandatory tests, additionnal flags can be specified :\n\n\tb, builtins\t\t\t# builtins-specific tests\n\tpa, parsing\t\t\t# parsing-specific tests\n\tr, redirections\t\t\t# redirections-specific tests\n\tpi, pipelines\t\t\t# pipelines-specific tests\n\tc, cmds\t\t\t\t# full-commands tests\n\tv, variables\t\t\t# environment variables tests\n\tco, corrections\t\t\t# corrections' subject tests\n\tpath\t\t\t\t# path resolving tests\n\ts, syntax\t\t\t# syntax errors tests\n```\n\n\n---\n\n# How To Install and Run\n\nTo install the script, copy and run following command:\n\n```\nbash -c \"$(curl -fsSL https://raw.githubusercontent.com/zstenger93/42_minishell_tester/master/install.sh)\" \n```\n\nThe tester will be installed in the `$HOME/42_minishell_tester` directory.\n\nAfter installation an alias `mstest` will be automaticly added in `.zshrc` or `.bashrc`\n\nSo that you can run the program in any directory (where your minishell is) by calling\n\n```\nmstest\n```\n\n---\n\n# Updates\nTests without environment now are updated, separated and can be run with:\n\n```bash\nbash tester.sh ne\n```\n\nNow they should be working better, still don't trust it 100% and do test yourself as well to understand.\nIt's a bit tricky to do test's well in this case because if you run `env -i bash` it disables only partially.\nIt will still have most things, but if you do `unset PATH` afterwards, will see the difference.\nAlso this part is pretty much what you aren't required to handle.\nThe main point is to not to crash/segfault when you launch without environment.\n\n---\n\n# Disclaimer\n\nDO NOT FAIL SOMEONE BECAUSE THEY AREN'T PASSING ALL TESTS!\n\nNEITHER LET THEM PASS JUST BECAUSE THEY DO, CHECK THE CODE WELL!\n\nDO YOUR OWN TESTING. TRY TO BREAK IT! ^^\n\nHAVE FUN WITH YOUR BEAUTIFUL MINISHELL\n\nDon't trust 100% the leak check, try it yourself as well and the linked tester below\nTry to write your own test first and don't just run a tester mindlessly\nYou don't have to pass all the cases in this tester\nIf you want to check leaks outside of your manual checking:\n\n[This is also a good one to check valgrind](https://github.com/thallard/minishell_tester)\nA bit more time to set it up, but worth it\nThe first time if you run the tester above and expect a lot of errors\nThen redirect each of the output from stdin and strerror to a file otherwise you won't be able see all of the errors\n\nEven though the required changes have been made to your proram, it might still going to throw you only KO STD_OUT.\nThis is because readline version. (then you probably have the older version where it isn't checking where does the input coming from(the tester or you))\n\nIf a test just hanging in infinite loop, you can use the link to go there and comment it out in the test file until you fix it.\n\n---\n\n# The People Made This Tester Possible\n\nBase made by: [Tim](https://github.com/tjensen42) \u0026 [Hepple](https://github.com/hepple42)\n\nUpgraded by: [Zsolt](https://github.com/zstenger93)\n\nParsing hell and mini_death by: [Kārlis](https://github.com/kvebers)\n\nExtra bonus tests by: [Mouad](https://github.com/moabid42)\n\nand\n\n```\nMy minishell pain\n```\n---\n\nLater on I might make changes so you can run test for each part like cd, echo, pipes, redirs etc.. as well\nOr if someone takes on the challenge, you are welcome to do so.\n\nFeel free to ask on slack if you have a question\nOr open a pull request if you would like to add more tests\nLooking for people who would like to add more tests to the bonus part, because we haven't done it\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstenger93%2F42_minishell_tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzstenger93%2F42_minishell_tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstenger93%2F42_minishell_tester/lists"}