Overview
Comment: | PSP: Make tests terminable. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
54f020d1398cd1d7df06e887dd6d593e |
User & Date: | js on 2013-06-28 22:56:23 |
Other Links: | manifest | tags |
Context
2013-06-30
| ||
18:30 | Rename -[initWithBlock:]. check-in: a3639589d3 user: js tags: trunk | |
2013-06-28
| ||
22:56 | PSP: Make tests terminable. check-in: 54f020d139 user: js tags: trunk | |
19:55 | Fix FP endianess for universal builds. check-in: d9bd480b94 user: js tags: trunk | |
Changes
Modified src/OFApplication.m from [15015abb7a] to [4f87ab0c32].
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # include <windows.h> extern int _CRT_glob; extern void __wgetmainargs(int*, wchar_t***, wchar_t***, int, int*); #elif !defined(OF_IOS) extern char **environ; #endif static OFApplication *app = nil; static void atexit_handler(void) { id <OFApplicationDelegate> delegate = [app delegate]; | > > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # include <windows.h> extern int _CRT_glob; extern void __wgetmainargs(int*, wchar_t***, wchar_t***, int, int*); #elif !defined(OF_IOS) extern char **environ; #endif #ifdef _PSP # include <pspkerneltypes.h> # include <psploadexec.h> #endif static OFApplication *app = nil; static void atexit_handler(void) { id <OFApplicationDelegate> delegate = [app delegate]; |
︙ | ︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | + (void)terminate { exit(0); } + (void)terminateWithStatus: (int)status { exit(status); } - init { self = [super init]; @try { | > > > > | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | + (void)terminate { exit(0); } + (void)terminateWithStatus: (int)status { #ifdef _PSP sceKernelExitGame(); #else exit(status); #endif } - init { self = [super init]; @try { |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [9cd0e6ac62] to [6cf39dd232].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0); #endif #ifdef __wii__ # define BOOL OGC_BOOL # include <gccore.h> # include <wiiuse/wpad.h> # undef BOOL #endif enum { NO_COLOR, RED, GREEN, YELLOW }; int main(int argc, char *argv[]) { #if defined(OF_OBJFW_RUNTIME) && !defined(_WIN32) /* This does not work on Win32 if ObjFW is built as a DLL */ atexit(objc_exit); #endif /* We need deterministic hashes for tests */ of_hash_seed = 0; | > > > > > > > > > > > > > > > > > > > > > > > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> # include <pspctrl.h> PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0); #endif #ifdef __wii__ # define BOOL OGC_BOOL # include <gccore.h> # include <wiiuse/wpad.h> # undef BOOL #endif enum { NO_COLOR, RED, GREEN, YELLOW }; #ifdef _PSP static int exit_cb(int arg1, int arg2, void *arg) { sceKernelExitGame(); return 0; } static int callback_thread(SceSize args, void *argp) { sceKernelRegisterExitCallback( sceKernelCreateCallback("Exit Callback", exit_cb, NULL)); sceKernelSleepThreadCB(); return 0; } #endif int main(int argc, char *argv[]) { #ifdef _PSP int tid; #endif #if defined(OF_OBJFW_RUNTIME) && !defined(_WIN32) /* This does not work on Win32 if ObjFW is built as a DLL */ atexit(objc_exit); #endif /* We need deterministic hashes for tests */ of_hash_seed = 0; |
︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | CON_InitEx(rmode, 10, 20, rmode->fbWidth - 10, rmode->xfbHeight - 20); VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK); #endif #ifdef _PSP pspDebugScreenInit(); #endif #if defined(__wii__) || defined(_PSP) @try { return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @catch (id e) { TestsAppDelegate *delegate = [[OFApplication sharedApplication] delegate]; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", [[e backtrace] componentsJoinedByString: @"\n "]]; [delegate outputString: string inColor: RED]; [delegate outputString: backtrace inColor: RED]; [delegate outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { | > > > > > > > > < < > > > > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | CON_InitEx(rmode, 10, 20, rmode->fbWidth - 10, rmode->xfbHeight - 20); VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK); #endif #ifdef _PSP pspDebugScreenInit(); sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL); if ((tid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0)) >= 0) sceKernelStartThread(tid, 0, 0); #endif #if defined(__wii__) || defined(_PSP) @try { return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @catch (id e) { TestsAppDelegate *delegate = [[OFApplication sharedApplication] delegate]; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", [[e backtrace] componentsJoinedByString: @"\n "]]; [delegate outputString: string inColor: RED]; [delegate outputString: backtrace inColor: RED]; # if defined(__wii__) [delegate outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: 1]; VIDEO_WaitVSync(); } # elif defined(_PSP) sceKernelSleepThreadCB(); # else abort(); # endif } #else return of_application_main(&argc, &argv, [TestsAppDelegate class]); #endif } @implementation TestsAppDelegate |
︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 223 224 225 226 227 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) return; VIDEO_WaitVSync(); } #endif } - (void)applicationDidFinishLaunching { #ifdef __wii__ [OFFile changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif | > > > > > > > > > > > > > > > > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) return; VIDEO_WaitVSync(); } #endif #ifdef _PSP [self outputString: @"Press X to continue!\n" inColor: NO_COLOR]; for (;;) { SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS) { for (;;) { sceCtrlReadBufferPositive(&pad, 1); if (!(pad.Buttons & PSP_CTRL_CROSS)) return; } } } #endif } - (void)applicationDidFinishLaunching { #ifdef __wii__ [OFFile changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif |
︙ | ︙ | |||
260 261 262 263 264 265 266 | [self pluginTests]; #endif [self forwardingTests]; #ifdef OF_HAVE_PROPERTIES [self propertiesTests]; #endif | | > > > > > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | [self pluginTests]; #endif [self forwardingTests]; #ifdef OF_HAVE_PROPERTIES [self propertiesTests]; #endif #if defined(__wii__) [self outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: _fails]; VIDEO_WaitVSync(); } #elif defined(_PSP) [self outputString: [OFString stringWithFormat: @"%zd tests failed!", _fails] inColor: NO_COLOR]; sceKernelSleepThreadCB(); #else [OFApplication terminateWithStatus: _fails]; #endif } @end |