2016-01-20 49 views
0

我想在OSX上使用Nunit來運行一些基本的測試。單聲道(OSX)上的Nunit將不會運行測試 - mono_defaults.runtimetype_class!= 0

mono --version

單JIT編譯器版本4.2.1(顯式/ 6dd2d0d週二11月10日18時01分18秒美國東部時間2015年)

NUnit的:

which nunit-console

在/ usr /本地/ bin/nunit-console

也Nunit4:

which nunit-console4

在/ usr/local/bin目錄/ NUnit的-console4

我試圖使用運行的基本測試庫中的以下內容:

nunit-console Tests.dll

但我得到跟蹤:

* Assertion at domain.c:718, condition `mono_defaults.runtimetype_class != 0' not met 


Native stacktrace: 

    0 mono        0x000c91c6 mono_handle_native_sigsegv + 342 
    1 mono        0x001198d1 sigabrt_signal_handler + 129 
    2 libsystem_platform.dylib   0x95d9101b _sigtramp + 43 
    3 ???         0xffffffff 0x0 + 4294967295 
    4 libsystem_c.dylib     0x90304c34 abort + 156 
    5 mono        0x0026dd11 monoeg_log_default_handler + 129 
    6 mono        0x0026de0b monoeg_assertion_message + 107 
    7 mono        0x001d8f04 mono_init_internal + 5860 
    8 mono        0x001d92b8 mono_init_from_assembly + 24 
    9 mono        0x00017c6f mini_init + 2063 
    10 mono        0x000937e0 mono_main + 4912 
    11 mono        0x0000c690 main + 768 
    12 mono        0x0000c385 start + 53 
    13 ???         0x00000004 0x0 + 4 

Debug info from gdb: 

(lldb) command source -s 0 '/tmp/mono-gdb-commands.7rUr4M' 
Executing commands in '/tmp/mono-gdb-commands.7rUr4M'. 
(lldb) process attach --pid 6044 
Process 6044 stopped 
* thread #1: tid = 0x403d0, 0x993ced06 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP 
    frame #0: 0x993ced06 libsystem_kernel.dylib`__wait4 + 10 
libsystem_kernel.dylib`__wait4: 
-> 0x993ced06 <+10>: jae 0x993ced16    ; <+26> 
    0x993ced08 <+12>: calll 0x993ced0d    ; <+17> 
    0x993ced0d <+17>: popl %edx 
    0x993ced0e <+18>: movl 0xab94317(%edx), %edx 

Executable module set to "/Library/Frameworks/Mono.framework/Versions/4.2.1/bin/mono". 
Architecture set to: i386-apple-macosx. 
(lldb) thread list 
Process 6044 stopped 
* thread #1: tid = 0x403d0, 0x993ced06 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP 
    thread #2: tid = 0x403d8, 0x993ce402 libsystem_kernel.dylib`__psynch_cvwait + 10 
(lldb) thread backtrace all 
* thread #1: tid = 0x403d0, 0x993ced06 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP 
    * frame #0: 0x993ced06 libsystem_kernel.dylib`__wait4 + 10 
    frame #1: 0x903247dc libsystem_c.dylib`waitpid$UNIX2003 + 48 
    frame #2: 0x000c928d mono`mono_handle_native_sigsegv(signal=6, ctx=0xbfff62ac, info=0xbfff626c) + 541 at mini-exceptions.c:2193 [opt] 
    frame #3: 0x001198d1 mono`sigabrt_signal_handler(_dummy=<unavailable>, _info=<unavailable>, context=<unavailable>) + 129 at mini-posix.c:208 [opt] 
    frame #4: 0x95d9101b libsystem_platform.dylib`_sigtramp + 43 
    frame #5: 0x993ce58b libsystem_kernel.dylib`__pthread_kill + 11 
    frame #6: 0x91ef3448 libsystem_pthread.dylib`pthread_kill + 101 
    frame #7: 0x90304c34 libsystem_c.dylib`abort + 156 
    frame #8: 0x0026dd11 mono`monoeg_log_default_handler(log_domain=<unavailable>, log_level=<unavailable>, message=<unavailable>, unused_data=<unavailable>) + 129 at goutput.c:233 [opt] 
    frame #9: 0x0026de0b mono`monoeg_assertion_message [inlined] monoeg_g_logv(log_level=G_LOG_LEVEL_ERROR, format=<unavailable>) + 85 at goutput.c:113 [opt] 
    frame #10: 0x0026ddb6 mono`monoeg_assertion_message(format=<unavailable>) + 22 at goutput.c:133 [opt] 
    frame #11: 0x001d8f04 mono`mono_init_internal(filename=<unavailable>, exe_filename=<unavailable>, runtime_version=<unavailable>) + 5860 at domain.c:718 [opt] 
    frame #12: 0x001d92b8 mono`mono_init_from_assembly(domain_name="/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/nunit-console.exe", filename="/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/nunit-console.exe") + 24 at domain.c:893 [opt] 
    frame #13: 0x00017c6f mono`mini_init(filename=<unavailable>, runtime_version=<unavailable>) + 2063 at mini-runtime.c:3069 [opt] 
    frame #14: 0x000937e0 mono`mono_main(argc=4, argv=0xbfff6740) + 4912 at driver.c:1907 [opt] 
    frame #15: 0x0000c690 mono`main [inlined] mono_main_with_options(argc=<unavailable>, argv=<unavailable>) + 768 at main.c:94 [opt] 
    frame #16: 0x0000c3ad mono`main(argc=<unavailable>, argv=<unavailable>) + 29 at main.c:125 [opt] 
    frame #17: 0x0000c385 mono`start + 53 

    thread #2: tid = 0x403d8, 0x993ce402 libsystem_kernel.dylib`__psynch_cvwait + 10 
    frame #0: 0x993ce402 libsystem_kernel.dylib`__psynch_cvwait + 10 
    frame #1: 0x91ef1f6b libsystem_pthread.dylib`_pthread_cond_wait + 757 
    frame #2: 0x91ef5cc0 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71 
    frame #3: 0x0023c852 mono`thread_func(thread_data=0x00000000) + 466 at sgen-thread-pool.c:118 [opt] 
    frame #4: 0x91ef1a26 libsystem_pthread.dylib`_pthread_body + 138 
    frame #5: 0x91ef199c libsystem_pthread.dylib`_pthread_start + 155 
    frame #6: 0x91eeef96 libsystem_pthread.dylib`thread_start + 34 
(lldb) detach 

================================================================= 
Got a SIGABRT while executing native code. This usually indicates 
a fatal error in the mono runtime or one of the native libraries 
used by your application. 
================================================================= 

Process 6044 detached 
(lldb) quit 
[1] 6044 abort  nunit-console Tests.dll 

我不相信這是我的測試問題,因爲它拋出相同跟蹤時,只能嘗試打開NUnit控制檯的幫助說法:

nunit-console4 --help

我可以看到,它被扔在這裏的文件的718行:

https://github.com/mono/mono/blob/master/mono/metadata/domain.c

mono_defaults.runtimetype_class = mono_class_from_name (
      mono_defaults.corlib, "System", "RuntimeType"); 
g_assert (mono_defaults.runtimetype_class != 0); 

因爲錯誤不是很詳細,所以我有點失落 - 對我來說,感覺就像我的配置有問題,導致Nunit無法正常啓動。

感謝

回答

1

您可能需要重新安裝/升級單。我運行一個稍微更新的版本,我可以證實,

nunit-console --help 

運行我的系統上就好用下面的版本 -

mono --version 
Mono JIT compiler version 4.2.1 (Stable 4.2.1.102/6dd2d0d Wed Dec 2 14:02:16 PST 2015) 
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com 
    TLS:   normal 
    SIGSEGV:  altstack 
    Notification: kqueue 
    Architecture: amd64 
    Disabled:  none 
    Misc:   softdebug 
    LLVM:   supported, not enabled. 
    GC:   sgen 

和運行

dnvm list 

Active Version    Runtime Arch Location    Alias 
------ -------    ------- ---- --------    ----- 
     1.0.0-beta4   mono   ~/.dnx/runtimes 
    * 1.0.0-rc1-update1 mono   ~/.dnx/runtimes  default 

編輯: nunit-console腳本

#!/bin/sh 
exec /usr/local/Cellar/mono/4.2.1.102_1/bin/mono --debug $MONO_OPTIONS /usr/local/Cellar/mono/4.2.1.102_1/lib/mono/4.5/nunit-console.exe "[email protected]" 
+0

我已經升級到4.3.3最新,但不幸的是我仍然看到相同的。你用什麼系統和版本的OSX? –

+0

我在12月中旬運行10.10.5的MBP視網膜。我已經在上面添加了我的nunit-console4腳本的內容。也許這對你來說是斷開的? – richardsonmarkj

+0

感謝您 - 我仍然沒有運行直接與Mono運行,目前我下載Nunit並直接從包文件運行它 - 希望我可以很快修復它:( –