Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit365eb37

Browse files
author
Stewart Gleadow
committed
Added example of the bug running tests the old way
1 parentc8ded07 commit365eb37

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#!/bin/sh
2+
##
3+
# Copyright 2008 Apple Inc.
4+
# All rights reserved.
5+
#
6+
# iPhoneSimulator platform
7+
# This script runs all of the unit tests for the target test bundle specified by the passed-in environment.
8+
# This script is generally intended to be invoked by ${DEVELOPER_TOOLS_DIR}/RunUnitTests. The interface or location of this script may change in future releases.
9+
##
10+
#
11+
# Input:
12+
# See ${DEVELOPER_TOOLS_DIR}/RunUnitTests for input variables
13+
14+
Message() {
15+
# usage: Message line type message
16+
# Echo the message to stdout as the given type of message and continue
17+
echo"${PLATFORM_DEVELOPER_TOOLS_DIR}/Tools/RunPlatformUnitTests:${1}:${2}:${3}"
18+
}
19+
20+
Note() {
21+
# usage: Notify line message
22+
# Echo the message to stdout as a note and continue
23+
Message"${1}" note"${2}"
24+
}
25+
26+
Warning() {
27+
# usage: Warning line message
28+
# Echo the message to stdout as a note and continue
29+
Message"${1}" warning"${2}"
30+
}
31+
32+
Error() {
33+
# usage: Notify line message
34+
# Echo the message to stdout as an error and continue
35+
Message"${1}" error"${2}"
36+
}
37+
38+
Fail() {
39+
# usage: Fail line message
40+
# Echo the message to stdout and return 1, the universal error code
41+
Error"${1}""${2}"
42+
exit 1
43+
}
44+
45+
### Do not run tests on anything but a "build".
46+
47+
if ["${ACTION}"!="build" ];then
48+
exit 0
49+
fi
50+
51+
### Silently skip tests if TEST_AFTER_BUILD is NO
52+
53+
if ["${TEST_AFTER_BUILD}"="NO" ];then
54+
exit 0
55+
fi
56+
57+
### Source RunUnitTests.include functionality
58+
59+
if ["${DEVELOPER_TOOLS_DIR}"="" ];then
60+
Fail${LINENO}"DEVELOPER_TOOLS_DIR is not set."
61+
fi
62+
63+
if ["${PLATFORM_DEVELOPER_TOOLS_DIR}"="" ];then
64+
Fail${LINENO}"PLATFORM_DEVELOPER_TOOLS_DIR is not set."
65+
fi
66+
67+
includeFile="${DEVELOPER_TOOLS_DIR}/RunPlatformUnitTests.include"
68+
if [!-r"${includeFile}" ];then
69+
Fail${LINENO}"Cannot read include file${includeFile}"
70+
fi
71+
72+
source"${includeFile}"
73+
74+
if [ 0!=$? ];then
75+
Fail${LINENO}"Could not source include file${includeFile}"
76+
fi
77+
78+
### Define a sensible default for the path to the otest
79+
80+
if ["${OTEST}"="" ];then
81+
OTEST="${SDKROOT}/Developer/usr/bin/otest"
82+
fi
83+
84+
Main() {
85+
# usage: Main
86+
# Determine how tests need to be run and run them.
87+
88+
# GC not supported by the simulator
89+
TEST_GC_STATES="OFF"
90+
91+
Configure_TEST_ARCHS
92+
93+
if ["${TEST_HOST}"!="" ];then
94+
95+
# SG changed based on this post:
96+
# http://longweekendmobile.com/2011/04/17/xcode4-running-application-tests-from-the-command-line-in-ios/
97+
#Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."
98+
export OTHER_TEST_FLAGS="-RegisterForSystemEvents"
99+
RunTestsForApplication"${TEST_HOST}""${TEST_BUNDLE_PATH}"
100+
else
101+
# If no TEST_HOST is specified, assume we're running the test bundle.
102+
103+
RunTestsForBundle"${TEST_BUNDLE_PATH}"
104+
fi
105+
}
106+
107+
### Update the dyld environment to support running tests out of the build directory.
108+
109+
# Sets and exports the following environment variables:
110+
# DYLD_ROOT_PATH
111+
# DYLD_FRAMEWORK_PATH
112+
# DYLD_LIBRARY_PATH
113+
# DYLD_NEW_LOCAL_SHARED_REGIONS
114+
# DYLD_NO_FIX_PREBINDING
115+
116+
if ["${DYLD_FRAMEWORK_PATH}"!="" ];then
117+
DYLD_FRAMEWORK_PATH="${BUILT_PRODUCTS_DIR}:${SDKROOT}${DEVELOPER_LIBRARY_DIR}/Frameworks:${DYLD_FRAMEWORK_PATH}"
118+
else
119+
DYLD_FRAMEWORK_PATH="${BUILT_PRODUCTS_DIR}:${SDKROOT}${DEVELOPER_LIBRARY_DIR}/Frameworks"
120+
fi
121+
122+
if ["${DYLD_LIBRARY_PATH}"!="" ];then
123+
DYLD_LIBRARY_PATH="${BUILT_PRODUCTS_DIR}:${DYLD_LIBRARY_PATH}"
124+
else
125+
DYLD_LIBRARY_PATH="${BUILT_PRODUCTS_DIR}"
126+
fi
127+
128+
if ["${DYLD_ROOT_PATH}"!="" ];then
129+
DYLD_ROOT_PATH="${SDKROOT}:${DYLD_ROOT_PATH}"
130+
else
131+
DYLD_ROOT_PATH="${SDKROOT}"
132+
fi
133+
134+
DYLD_NEW_LOCAL_SHARED_REGIONS=YES
135+
DYLD_NO_FIX_PREBINDING=YES
136+
IPHONE_SIMULATOR_ROOT=$SDKROOT## rdar://6528939
137+
CFFIXED_USER_HOME="${HOME}/Library/Application Support/iPhone Simulator/$IPHONESIMULATOR_PLATFORM_VERSION"
138+
139+
EXPORT_VARS=(DYLD_FRAMEWORK_PATH DYLD_LIBRARY_PATH DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING DYLD_ROOT_PATH IPHONE_SIMULATOR_ROOT CFFIXED_USER_HOME )
140+
141+
### Run the tests
142+
143+
Main

‎XcodeTestSample/XcodeTestSample.xcodeproj/project.pbxproj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
C91E26AE15B7D2AF00CB0AF3 /* Sources */,
181181
C91E26B015B7D2AF00CB0AF3 /* Frameworks */,
182182
C91E26B415B7D2AF00CB0AF3 /* Resources */,
183+
C924254E16175C2700E5F418 /* ShellScript */,
183184
);
184185
buildRules = (
185186
);
@@ -215,6 +216,7 @@
215216
C99C65E915B432FE0092A9B4 /* Sources */,
216217
C99C65EA15B432FE0092A9B4 /* Frameworks */,
217218
C99C65EB15B432FE0092A9B4 /* Resources */,
219+
C924254816175BDC00E5F418 /* ShellScript */,
218220
);
219221
buildRules = (
220222
);
@@ -282,6 +284,35 @@
282284
};
283285
/* End PBXResourcesBuildPhase section */
284286

287+
/* Begin PBXShellScriptBuildPhase section */
288+
C924254816175BDC00E5F418 /* ShellScript */ = {
289+
isa = PBXShellScriptBuildPhase;
290+
buildActionMask = 2147483647;
291+
files = (
292+
);
293+
inputPaths = (
294+
);
295+
outputPaths = (
296+
);
297+
runOnlyForDeploymentPostprocessing = 0;
298+
shellPath = /bin/sh;
299+
shellScript = "\"${PROJECT_DIR}/RunPlatformUnitTests.sh\"";
300+
};
301+
C924254E16175C2700E5F418 /* ShellScript */ = {
302+
isa = PBXShellScriptBuildPhase;
303+
buildActionMask = 2147483647;
304+
files = (
305+
);
306+
inputPaths = (
307+
);
308+
outputPaths = (
309+
);
310+
runOnlyForDeploymentPostprocessing = 0;
311+
shellPath = /bin/sh;
312+
shellScript = "\"${PROJECT_DIR}/RunPlatformUnitTests.sh\"";
313+
};
314+
/* End PBXShellScriptBuildPhase section */
315+
285316
/* Begin PBXSourcesBuildPhase section */
286317
C91E26AE15B7D2AF00CB0AF3 /* Sources */ = {
287318
isa = PBXSourcesBuildPhase;

‎run_tests_the_old_way.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# This is how I used to run the unit tests. Worked pre-Xcode 4.5
3+
4+
xcodebuild -sdk iphonesimulator -scheme XcodeTestSamplePassingTests build TEST_AFTER_BUILD=YES

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp