runtests.sh 1.03 KB
Newer Older
1
2
#!/bin/bash

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
10
# Create some executables.
test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework"
11
                  "$BUILT_PRODUCTS_DIR/gtest_unittest"
12
13
                  "$BUILT_PRODUCTS_DIR/sample1_unittest-framework"
                  "$BUILT_PRODUCTS_DIR/sample1_unittest-static")
14
15
16
17

# Now execute each one in turn keeping track of how many succeeded and failed. 
succeeded=0
failed=0
shiqian's avatar
shiqian committed
18
failed_list=()
19
20
21
22
23
24
25
for test in ${test_executables[*]}; do
  "$test"
  result=$?
  if [ $result -eq 0 ]; then
    succeeded=$(( $succeeded + 1 ))
  else
    failed=$(( failed + 1 ))
shiqian's avatar
shiqian committed
26
    failed_list="$failed_list $test"
27
28
29
  fi
done

30
# Report the successes and failures to the console.
31
echo "Tests complete with $succeeded successes and $failed failures."
shiqian's avatar
shiqian committed
32
33
34
35
if [ $failed -ne 0 ]; then
  echo "The following tests failed:"
  echo $failed_list
fi
36
exit $failed