aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting/RunMacOSUnitTests.sh
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-20 23:35:12 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-20 23:35:12 +0000
commitd8db7440acd54abce429f06ed0600081eac53b28 (patch)
tree0e8a28120682d7cb7f97031983b728abfe37dc26 /UnitTesting/RunMacOSUnitTests.sh
parentfe8a34f1515ffad41dac45e90a3b2096cc5699df (diff)
[Author: thomasvl]
Make the target for all tests directly depend on the tests instead of shelling out to xcode build (make things nicer in 3.2.x tool chain). Add an action to the GTM Framework to nuke any *.gcda files to help make coverage tracking easier. Mac OS test runner script: Not be verbose (for the 3.2.x tool chain). Add a var to cause it only to remove target *.gcda files. Add a var to force tests to only run one at a time (via some pyton that emulates linux's flock). Make the UnitTesting and AppKit tests use the flock support so they don't fight over the colorsync profile. R=dmaclach DELTA=141 (102 added, 28 deleted, 11 changed)
Diffstat (limited to 'UnitTesting/RunMacOSUnitTests.sh')
-rwxr-xr-xUnitTesting/RunMacOSUnitTests.sh45
1 files changed, 37 insertions, 8 deletions
diff --git a/UnitTesting/RunMacOSUnitTests.sh b/UnitTesting/RunMacOSUnitTests.sh
index f2e12e9..34fd23a 100755
--- a/UnitTesting/RunMacOSUnitTests.sh
+++ b/UnitTesting/RunMacOSUnitTests.sh
@@ -22,7 +22,6 @@
set -o errexit
set -o nounset
-set -o verbose
# Controlling environment variables:
#
@@ -56,6 +55,19 @@ GTM_LEAKS_SYMBOLS_TO_IGNORE=${GTM_LEAKS_SYMBOLS_TO_IGNORE:=""}
# non-zero value.
GTM_DO_NOT_REMOVE_GCOV_DATA=${GTM_DO_NOT_REMOVE_GCOV_DATA:=0}
+# GTM_REMOVE_TARGET_GCOV_ONLY
+# By default all *.gcda files are removed form the project. Setting this to
+# 1 causes only the *.gcda files for the target to be removed.
+# If GTM_DO_NOT_REMOVE_GCOV_DATA is set, this has no effect.
+GTM_REMOVE_TARGET_GCOV_ONLY=${GTM_REMOVE_TARGET_GCOV_ONLY:=0}
+
+# GTM_ONE_TEST_AT_A_TIME
+# By default your tests run how ever parallel your projects/targets are
+# setup. Setting this to 1 will cause only one to run at a time, this is
+# useful if you are doing UI tests with the helper that controls the
+# colorsync profile, or any other machine wide state.
+GTM_ONE_TEST_AT_A_TIME=${GTM_ONE_TEST_AT_A_TIME:=0}
+
ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
ScriptName=$(basename "$0")
ThisScript="${ScriptDir}/${ScriptName}"
@@ -64,6 +76,19 @@ GTMXcodeNote() {
echo ${ThisScript}:${1}: note: GTM ${2}
}
+# Helper that works like the linux flock util, so you can run something, but
+# have only one run at a time.
+MaybeFlock() {
+ if [ $GTM_ONE_TEST_AT_A_TIME ]; then
+ python -c "import fcntl, subprocess, sys
+file = open('$TMPDIR/GTM_one_test_at_a_time', 'a')
+fcntl.flock(file.fileno(), fcntl.LOCK_EX)
+sys.exit(subprocess.call(sys.argv[1:]))" "${@}"
+ else
+ "${@}"
+ fi
+}
+
# The workaround below is due to
# Radar 6248062 otest won't run with MallocHistory enabled under rosetta
# Basically we go through and check what architecture we are running on
@@ -177,14 +202,14 @@ RunTests() {
ARCHS="${LEAK_TEST_ARCHS}"
VALID_ARCHS="${LEAK_TEST_ARCHS}"
GTMXcodeNote ${LINENO} "Leak checking enabled for $ARCHS. Ignoring leaks from $GTM_LEAKS_SYMBOLS_TO_IGNORE."
- "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
+ MaybeFlock "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
# Running leaks on architectures that don't support leaks.
unset MallocStackLogging
GTM_ENABLE_LEAKS=0
ARCHS="${NO_LEAK_TEST_ARCHS}"
VALID_ARCHS="${NO_LEAK_TEST_ARCHS}"
- "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
+ MaybeFlock "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
}
# Jack up some memory stress so we can catch more bugs.
@@ -209,10 +234,14 @@ if [ $GTM_DISABLE_ZOMBIES -eq 0 ]; then
fi
if [ ! $GTM_DO_NOT_REMOVE_GCOV_DATA ]; then
- if [ "${CONFIGURATION_TEMP_DIR}" != "-" ]; then
- if [ -d "${CONFIGURATION_TEMP_DIR}" ]; then
- GTMXcodeNote ${LINENO} "Removing gcov data files from ${CONFIGURATION_TEMP_DIR}"
- (cd "${CONFIGURATION_TEMP_DIR}" && \
+ GTM_GCOV_CLEANUP_DIR="${CONFIGURATION_TEMP_DIR}"
+ if [ $GTM_REMOVE_TARGET_GCOV_ONLY ]; then
+ GTM_GCOV_CLEANUP_DIR="${OBJECT_FILE_DIR}-${CURRENT_VARIANT}"
+ fi
+ if [ "${GTM_GCOV_CLEANUP_DIR}" != "-" ]; then
+ if [ -d "${GTM_GCOV_CLEANUP_DIR}" ]; then
+ GTMXcodeNote ${LINENO} "Removing gcov data files from ${GTM_GCOV_CLEANUP_DIR}"
+ (cd "${GTM_GCOV_CLEANUP_DIR}" && \
find . -type f -name "*.gcda" -print0 | xargs -0 rm -f )
fi
fi
@@ -224,5 +253,5 @@ if [ $GTM_ENABLE_LEAKS -ne 0 ]; then
RunTests
else
GTMXcodeNote ${LINENO} "Leak checking disabled."
- "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
+ MaybeFlock "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
fi