/Unittests/googletest/xcode/Scripts/runtests.sh

http://unladen-swallow.googlecode.com/ · Shell · 36 lines · 25 code · 5 blank · 6 comment · 3 complexity · e02385e82866241b9d49d603e1a87072 MD5 · raw file

  1. #!/bin/bash
  2. # Executes the samples and tests for the Google Test Framework.
  3. # Help the dynamic linker find the path to the libraries.
  4. export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR
  5. export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR
  6. # Create some executables.
  7. test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework"
  8. "$BUILT_PRODUCTS_DIR/gtest_unittest"
  9. "$BUILT_PRODUCTS_DIR/sample1_unittest-framework"
  10. "$BUILT_PRODUCTS_DIR/sample1_unittest-static")
  11. # Now execute each one in turn keeping track of how many succeeded and failed.
  12. succeeded=0
  13. failed=0
  14. failed_list=()
  15. for test in ${test_executables[*]}; do
  16. "$test"
  17. result=$?
  18. if [ $result -eq 0 ]; then
  19. succeeded=$(( $succeeded + 1 ))
  20. else
  21. failed=$(( failed + 1 ))
  22. failed_list="$failed_list $test"
  23. fi
  24. done
  25. # Report the successes and failures to the console.
  26. echo "Tests complete with $succeeded successes and $failed failures."
  27. if [ $failed -ne 0 ]; then
  28. echo "The following tests failed:"
  29. echo $failed_list
  30. fi
  31. exit $failed