1

当通过 Xcode 或命令行运行我的测试套件时,我注意到测试会无缘无故地挂起。我不知道为什么测试会突然挂起。测试基本上将永远挂起,或者直到我停止它。我有大约 19 个应该运行的冗长测试,但它到达第 3 或第 4 或第 5 次测试,然后它只是随机停止。

顺便说一句,当我单独运行每个测试时,它们都会在执行单独测试时完全运行。

我希望测试只是出错,或者整个套件会爆炸,但这不会发生,而是我得到了一个永远持续的测试运行。请帮忙!我非常愿意为您提供日志,但不幸的是,我所拥有的只是对调试无用的仪器日志。

**编辑* * 这是评论中要求的示例:

Analysis of sampling instruments (pid 49112) every 1 millisecond
Process:         instruments [49112]
Path:            /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
Load Address:    0x10ab3c000
Identifier:      instruments
Version:         $[MARKETING_VERSION] (51168)
Code Type:       X86-64 (Native)
Parent Process:  sh [47591]

Date/Time:       2013-12-03 15:24:05.120 -0800
OS Version:      Mac OS X 10.8.5 (12F45)
Report Version:  7

Call graph:
    9132 Thread_10178874   DispatchQueue_1: com.apple.main-thread  (serial)
    + 9132 start  (in libdyld.dylib) + 1  [0x7fff870e87e1]
    +   9132 ???  (in instruments)  load address 0x10ab3c000 + 0x4736  [0x10ab40736]
    +     9132 ???  (in instruments)  load address 0x10ab3c000 + 0x41a8  [0x10ab401a8]
    +       9132 -[NSRunLoop(NSRunLoop) runUntilDate:]  (in Foundation) + 78  [0x7fff8209a69b]
    +         9132 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]  (in Foundation) + 268  [0x7fff8209a7ee]
    +           9132 CFRunLoopRunSpecific  (in CoreFoundation) + 290  [0x7fff83a670e2]
    +             9125 __CFRunLoopRun  (in CoreFoundation) + 1078  [0x7fff83a67916]
    +             ! 9125 __CFRunLoopServiceMachPort  (in CoreFoundation) + 195  [0x7fff83a62233]
    +             !   9125 mach_msg  (in libsystem_kernel.dylib) + 70  [0x7fff8a51dc42]
    +             !     9125 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7fff8a51e686]
    +             4 __CFRunLoopRun  (in CoreFoundation) + 1529  [0x7fff83a67ad9]
    +             ! 3 __CFRunLoopDoTimer  (in CoreFoundation) + 557  [0x7fff83a8231d]
    +             ! : 3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__  (in CoreFoundation) + 20  [0x7fff83a82804]
    +             ! :   2 __NSFireTimer  (in Foundation) + 96  [0x7fff82073463]
    +             ! :   | 1 -[XRTrace _runTimerTickFireMethod:]  (in InstrumentsPlugIn) + 103  [0x10ab7829b]
    +             ! :   | + 1 -[__NSDictionaryM setObject:forKey:]  (in CoreFoundation) + 359  [0x7fff83b54697]
    +             ! :   | +   1 calloc  (in libsystem_c.dylib) + 0  [0x7fff8c083bf4]
    +             ! :   | 1 -[XRTrace _runTimerTickFireMethod:]  (in InstrumentsPlugIn) + 172  [0x10ab782e0]
    +             ! :   |   1 -[NSNotificationCenter postNotificationName:object:userInfo:]  (in Foundation) + 64  [0x7fff820487b6]
    +             ! :   |     1 _CFXNotificationPost  (in CoreFoundation) + 2554  [0x7fff83a77eda]
    +             ! :   |       1 -[XRInstrument _tick:]  (in InstrumentsPlugIn) + 26  [0x10ab7831e]
    +             ! :   |         1 -[XRInstrument requiresTickNotification]  (in InstrumentsPlugIn) + 1  [0x10ab9c823]
    +             ! :   1 __NSFireTimer  (in Foundation) + 135  [0x7fff8207348a]
    +             ! :     1 _CFAutoreleasePoolPop  (in CoreFoundation) + 34  [0x7fff83a62d72]
    +             ! :       1 (anonymous namespace)::AutoreleasePoolPage::pop(void*)  (in libobjc.A.dylib) + 464  [0x7fff858b0230]
    +             ! :         1 -[__NSDictionaryM dealloc]  (in CoreFoundation) + 286  [0x7fff83b554ee]
    +             ! :           1 object_dispose  (in libobjc.A.dylib) + 22  [0x7fff858affa0]
    +             ! :             1 objc_destructInstance  (in libobjc.A.dylib) + 121  [0x7fff858af940]
    +             ! :               1 objc_clear_deallocating  (in libobjc.A.dylib) + 151  [0x7fff858af9ee]
    +             ! :                 1 arr_clear_deallocating  (in libobjc.A.dylib) + 31  [0x7fff858c60c4]
    +             ! :                   1 weak_entry_for_referent(weak_table_t*, objc_object*)  (in libobjc.A.dylib) + 235  [0x7fff858c5f98]
    +             ! 1 __CFRunLoopDoTimer  (in CoreFoundation) + 501  [0x7fff83a822e5]
    +             !   1 mk_timer_arm  (in libsystem_kernel.dylib) + 10  [0x7fff8a51e7b2]
    +             1 __CFRunLoopRun  (in CoreFoundation) + 891  [0x7fff83a6785b]
    +             ! 1 __CFRunLoopServiceMachPort  (in CoreFoundation) + 195  [0x7fff83a62233]
    +             !   1 mach_msg  (in libsystem_kernel.dylib) + 70  [0x7fff8a51dc42]
    +             !     1 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7fff8a51e686]
    +             1 __CFRunLoopRun  (in CoreFoundation) + 1186  [0x7fff83a67982]
    +             ! 1 __CFRunLoopDoObservers  (in CoreFoundation) + 48  [0x7fff83a8c240]
    +             1 __CFRunLoopRun  (in CoreFoundation) + 1400  [0x7fff83a67a58]
    +               1 CFArrayAppendValue  (in CoreFoundation) + 91  [0x7fff83a40e6b]
    +                 1 -[__NSArrayM insertObject:atIndex:]  (in CoreFoundation) + 728  [0x7fff83a76438]
    +                   1 __bzero  (in libsystem_c.dylib) + 0  [0x7fff8c0571a3]
    9132 Thread_10178896   DispatchQueue_2: com.apple.libdispatch-manager  (serial)
    + 9132 _dispatch_mgr_thread  (in libdispatch.dylib) + 54  [0x7fff843019ee]
    +   9128 _dispatch_mgr_invoke  (in libdispatch.dylib) + 883  [0x7fff84301dea]
    +   ! 9128 kevent  (in libsystem_kernel.dylib) + 10  [0x7fff8a520d16]
    +   3 _dispatch_mgr_invoke  (in libdispatch.dylib) + 885  [0x7fff84301dec]
    +   1 _dispatch_mgr_invoke  (in libdispatch.dylib) + 144  [0x7fff84301b07]
    +     1 _dispatch_run_timers  (in libdispatch.dylib) + 306  [0x7fff84301f71]
    +       1 _dispatch_wakeup  (in libdispatch.dylib) + 106  [0x7fff842ffeb3]
    9132 Thread_10178898   DispatchQueue_184: parsing queue  (serial)
    + 9132 start_wqthread  (in libsystem_c.dylib) + 13  [0x7fff8c057191]
    +   9132 _pthread_wqthread  (in libsystem_c.dylib) + 404  [0x7fff8c06ccdb]
    +     9132 _dispatch_worker_thread2  (in libdispatch.dylib) + 249  [0x7fff843001c3]
    +       9132 _dispatch_queue_invoke  (in libdispatch.dylib) + 52  [0x7fff843002f1]
    +         9132 _dispatch_queue_drain  (in libdispatch.dylib) + 235  [0x7fff8430047f]
    +           9132 _dispatch_client_callout  (in libdispatch.dylib) + 8  [0x7fff842ff0b6]
    +             9132 _dispatch_call_block_and_release  (in libdispatch.dylib) + 15  [0x7fff84302f01]
    +               9132 __43-[DTXMessageParser initWithMessageHandler:]_block_invoke  (in DTXConnectionServices) + 35  [0x10b13fb36]
    +                 9132 -[DTXMessageParser parseMessage]  (in DTXConnectionServices) + 51  [0x10b13fd79]
    +                   9132 -[DTXMessageParser waitForMoreData:incrementalBuffer:]  (in DTXConnectionServices) + 87  [0x10b14012a]
    +                     9132 _dispatch_semaphore_wait_slow  (in libdispatch.dylib) + 241  [0x7fff84302486]
    +                       9132 semaphore_wait_trap  (in libsystem_kernel.dylib) + 10  [0x7fff8a51e6c2]
    9132 Thread_10178984: com.apple.CFSocket.private
    + 9132 thread_start  (in libsystem_c.dylib) + 13  [0x7fff8c0571a1]
    +   9132 _pthread_start  (in libsystem_c.dylib) + 327  [0x7fff8c06a772]
    +     9132 __CFSocketManager  (in CoreFoundation) + 1302  [0x7fff83aa6f46]
    +       9132 __select  (in libsystem_kernel.dylib) + 10  [0x7fff8a520322]
    9132 Thread_10179054
    + 9132 start_wqthread  (in libsystem_c.dylib) + 13  [0x7fff8c057191]
    +   9132 _pthread_wqthread  (in libsystem_c.dylib) + 412  [0x7fff8c06cce3]
    +     9132 _pthread_workq_return  (in libsystem_c.dylib) + 25  [0x7fff8c06cf1c]
    +       9132 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x7fff8a5206d6]
    9131 Thread_10184560
    + 9131 start_wqthread  (in libsystem_c.dylib) + 13  [0x7fff8c057191]
    +   9131 _pthread_wqthread  (in libsystem_c.dylib) + 412  [0x7fff8c06cce3]
    +     9131 _pthread_workq_return  (in libsystem_c.dylib) + 25  [0x7fff8c06cf1c]
    +       9131 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x7fff8a5206d6]
    1 Thread_10184560   DispatchQueue_9: com.apple.root.high-overcommit-priority  (concurrent)
      1 start_wqthread  (in libsystem_c.dylib) + 13  [0x7fff8c057191]
        1 _pthread_wqthread  (in libsystem_c.dylib) + 404  [0x7fff8c06ccdb]
          1 _dispatch_worker_thread2  (in libdispatch.dylib) + 249  [0x7fff843001c3]
            1 _dispatch_queue_invoke  (in libdispatch.dylib) + 72  [0x7fff84300305]
              1 _dispatch_source_invoke  (in libdispatch.dylib) + 460  [0x7fff843011b4]
                1 _dispatch_client_callout  (in libdispatch.dylib) + 8  [0x7fff842ff0b6]
                  1 __CFRunLoopTimeoutCancel  (in CoreFoundation) + 18  [0x7fff83ab4cf2]
                    1 CFRelease  (in CoreFoundation) + 175  [0x7fff83a3b28f]

Total number in stack (recursive counted multiple, when >=5):

Sort by top of stack, same collapsed (when >= 5):
        __workq_kernreturn  (in libsystem_kernel.dylib)        18263
        __select  (in libsystem_kernel.dylib)        9132
        semaphore_wait_trap  (in libsystem_kernel.dylib)        9132
        kevent  (in libsystem_kernel.dylib)        9128
        mach_msg_trap  (in libsystem_kernel.dylib)        9126
4

1 回答 1

0

在v1.1.0中,inkling/Subliminal@ab22c43修复了可能导致测试在某些环境中中途挂起的问题。

于 2014-08-13T01:57:06.757 回答