run_c_binding_test.sh 862 B

123456789101112131415161718192021222324
  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, no weird output should show up"
  14. ./c_binding_test > binding_test_scratch
  15. echo "checking results (they should be identical)"
  16. diff -q -s binding_test_scratch c_bindings/test_answers.txt
  17. echo "cleaning up"
  18. rm pocketpy_c.o
  19. rm test.o
  20. rm binding_test_scratch