Xcode & Snow Leopard – Logical unit tests hanging

I haven’t written unit tests before in Xcode.  I started to read Apple’s article on unit testing with iPhone development because I wanted to follow sound development principles with an agile approach.  Not long into the guide, I got stuck.  Literally.  Using Xcode 3.2 on Snow Leopard caused Xcode to lock/hang during the build of the logical unit test.  Same results after iPhone SDK 3.1 came out.  I couldn’t find anything online either except a few people experiencing the same issue.  In the system console (not Xcode console) I was seeing:

9/18/09 8:35:29 PM Xcode[669] -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620
9/18/09 8:35:29 PM Xcode[669] -runOperationInBackground raised an exception: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620

Xcode[669] -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620

Xcode[669] -runOperationInBackground raised an exception: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x2009b7620

Needless to say, I was losing my mind. Finally, a user in the Apple Developer forums, “cde”, posted the following gem:

We have recently discovered the root cause of this problem.

People who are affected can work around it by (I hope you’re ready for this)…

…changing the Time Zone on your Build machine away from Central Daylight Time.  (In six weeks you can change it back, and people in Mountain Standard TIme will be affected.)

No, seriously.  Give it a try.

The problem is a single-character typo in a regular expression that parses the date stamp of the unit test. It causes it to miss the beginning of unit tests that are executed at -0500 or +0500 relative to GMT, so the end of those unit tests is unexpected, and it causes the build log parsing logic to initially hang and eventually crash.

As has been said, “Then I decided to use regular expressions, and I had two problems…”

So until it’s fixed, change your timezone to Pacific time.

One thought on “Xcode & Snow Leopard – Logical unit tests hanging

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s