Skip to content

Latest commit

 

History

History
85 lines (63 loc) · 1.28 KB

COMPILE.md

File metadata and controls

85 lines (63 loc) · 1.28 KB

ncsh Compilation, Debugging, Profiling, and Benchmarking Notes

Compile

Compile Debug Builds

make debug
make d # equivalent to make debug
make debug CC=clang
make d CC=clang # equivalent to make debug CC=clang

Compile Release Builds

make
make CC=clang

# cmake
cmake build -S ./ -B bin/
cd bin
make

Debug

GDB

gdb -tui ./bin/ncsh
# c - continue
# s - step
# n - step over

Valgrind

valgrind --leak-check=yes ./bin/ncsh
valgrind --leak-check=full ./bin/ncsh
valgrind --track-fds=yes ./bin/ncsh
valgrind --leak-check=yes --track-fds=yes ./bin/ncsh

Profiling

gprof

  1. compile with -pg, -O3 and -DNDEBUG
  2. run program
  3. generate report: gprof gmon.out > analysis.txt
  4. review analysis.txt

Testing

There are shorthands for all of the commands in the makefile.

Testing Local

# run CI tests (not all tests)
make check

# run all tests
make check_local

# run tests individually
make test_autocompletions
make test_history
make test_parser
make test_fzf
make test_z
make integration_tests

Fuzz Testing

make fuzz_autocompletions
make fuzz_history
make fuzz_parser
./src/z/z_fuzz.sh
./src/z/z_add_fuzz.sh