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