@@ -56,6 +56,7 @@ https://starchart.cc/LeaYeh/minishell
56
56
* [ Signal Handling] ( #signal-handling )
57
57
* [ Exception Handling] ( #exception-handling )
58
58
* [ Known Issue] ( #known-issue )
59
+ * [ How to test with Valgrind] ( #how-to-test-with-valgrind )
59
60
60
61
# Support Features
61
62
@@ -602,6 +603,31 @@ Reference:
602
603
- Our question in Stackoverflow
603
604
- https://stackoverflow.com/questions/78140706/exception-handling-through-signal-communication-in-multiprocess-programs-in-c
604
605
606
+ # How to test with Valgrind
607
+
608
+ To test your minishell extensively with Valgrind, but without any reports from external commands, you can follow these steps:
609
+
610
+ 1 . Start bash
611
+ ``` bash
612
+ bash
613
+ ```
614
+ 2 . If you have one, input the name of your suppression file to suppress leaks coming from readline
615
+ ``` bash
616
+ export SUPPRESSION_FILE=/path/to/your/suppression_file
617
+ ```
618
+ 3 . Set up environment variables
619
+ ``` bash
620
+ export VALGRIND=$( which valgrind)
621
+ export VALGRINDFLAGS=" --errors-for-leak-kinds=all --leak-check=full --read-var-info=yes --show-error-list=yes --show-leak-kinds=all --suppressions=$SUPPRESSION_FILE --trace-children=yes --track-origins=yes"
622
+ export VALGRINDFDFLAGS=" --track-fds=all"
623
+ export IGNORED_PATHS=" /bin/* /usr/bin/* /usr/sbin/* $( which -a norminette) "
624
+ export VALGRINDFLAGS+=" --trace-children-skip=$( echo $IGNORED_PATHS | sed ' s/ /,/g' ) "
625
+ ```
626
+ 4 . Run your minishell with valgrind
627
+ ``` bash
628
+ $VALGRIND $VALGRINDFLAGS $VALGRINDFDFLAGS ./minishell
629
+ ```
630
+
605
631
# Liked it?
606
632
607
633
Hope you liked this project, don't forget to give it a star ⭐.
0 commit comments