googletest/xcode/Scripts/runtests.sh

37 lines
1.0 KiB
Bash
Raw Normal View History

2008-10-08 20:24:37 +00:00
#!/bin/bash
# Executes the samples and tests for the Google Test Framework.
2008-10-08 20:24:37 +00:00
# Help the dynamic linker find the path to the libraries.
2008-10-08 20:24:37 +00:00
export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR
export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR
2008-10-08 20:24:37 +00:00
# Create some executables.
test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework"
"$BUILT_PRODUCTS_DIR/gtest_unittest"
"$BUILT_PRODUCTS_DIR/sample1_unittest-framework"
"$BUILT_PRODUCTS_DIR/sample1_unittest-static")
2008-10-08 20:24:37 +00:00
# Now execute each one in turn keeping track of how many succeeded and failed.
succeeded=0
failed=0
failed_list=()
2008-10-08 20:24:37 +00:00
for test in ${test_executables[*]}; do
"$test"
result=$?
if [ $result -eq 0 ]; then
succeeded=$(( $succeeded + 1 ))
else
failed=$(( failed + 1 ))
failed_list="$failed_list $test"
2008-10-08 20:24:37 +00:00
fi
done
# Report the successes and failures to the console.
2008-10-08 20:24:37 +00:00
echo "Tests complete with $succeeded successes and $failed failures."
if [ $failed -ne 0 ]; then
echo "The following tests failed:"
echo $failed_list
fi
2008-10-08 20:24:37 +00:00
exit $failed