run_c_binding_test.sh 972 B

1234567891011121314151617181920212223242526
  1. python3 preprocess.py
  2. if [ ! -f "pocketpy_c.o" ]
  3. then
  4. echo "compiling c++ lib"
  5. clang++ -c -o pocketpy_c.o c_bindings/pocketpy_c.cpp -Wfatal-errors --std=c++17 -O2 -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti -stdlib=libc++ -I src/ -fsanitize=address -g
  6. else
  7. echo "DETECTED PREVIOUS COMPILATION USING IT"
  8. fi
  9. echo "compiling c executable"
  10. clang -c -o test.o c_bindings/test.c -Wfatal-errors -O2 -Wall -Wno-sign-compare -Wno-unused-variable -I src/ -fsanitize=address -g
  11. echo "linking"
  12. clang++ -o c_binding_test test.o pocketpy_c.o -stdlib=libc++ -fsanitize=address -g
  13. echo "running, leaksanitizer is finding a false postive leak in the CVM constructor"
  14. echo "ignore that but pay attention to anything else"
  15. ./c_binding_test > binding_test_scratch
  16. echo "checking results (they should be identical)"
  17. diff -q -s binding_test_scratch c_bindings/test_answers.txt
  18. echo "cleaning up"
  19. rm pocketpy_c.o
  20. rm test.o
  21. rm binding_test_scratch
  22. rm c_binding_test