runtests.sh revision d0332953cda33fb4f8e24ebff9c49159b69c43d6
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.
6export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR
7export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR
8
9# Create some executables.
10test_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. 
16succeeded=0
17failed=0
18failed_list=()
19for 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
28done
29
30# Report the successes and failures to the console.
31echo "Tests complete with $succeeded successes and $failed failures."
32if [ $failed -ne 0 ]; then
33  echo "The following tests failed:"
34  echo $failed_list
35fi
36exit $failed
37