1 /* Copyright 2013 Theo Berkau 2 3 This file is part of YabauseUT 4 5 YabauseUT is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 YabauseUT is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with YabauseUT; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #ifndef TESTSH 21 #define TESTSH 22 23 #include <iapetus.h> 24 25 #define AUTO_TEST_SELECT_ADDRESS 0x7F000 26 #define AUTO_TEST_STATUS_ADDRESS 0x7F004 27 #define AUTO_TEST_MESSAGE_ADDRESS 0x7F008 28 #define AUTO_TEST_MESSAGE_SENT 1 29 #define AUTO_TEST_MESSAGE_RECEIVED 2 30 31 #define TEST_LOG_ADDRESS 0x00200000 32 #define TEST_LOG_SIZE 0x000C0000 33 34 enum STAGESTAT 35 { 36 STAGESTAT_USERCUSTOM=-8, 37 STAGESTAT_NOTEST=-7, 38 STAGESTAT_BADSIZE=-6, 39 STAGESTAT_BADGRAPHICS=-5, 40 STAGESTAT_BADMIRROR=-4, 41 STAGESTAT_BADINTERRUPT=-3, 42 STAGESTAT_BADDATA=-2, 43 STAGESTAT_BADTIMING=-1, 44 STAGESTAT_WAITINGFORINT=0, 45 STAGESTAT_BUSY=1, 46 STAGESTAT_START=2, 47 STAGESTAT_DONE=3 48 }; 49 50 extern volatile int stage_status; 51 extern u32 errordata; 52 53 void init_test(void); 54 void tests_wait_press(); 55 void do_tests(const char *testname, int x, int y); 56 void register_test(void (*func)(void), const char *name); 57 void unregister_all_tests(); 58 void tests_log_text(char *text); 59 void tests_log_textf(char *format, ...); 60 void tests_disp_iapetus_error(enum IAPETUS_ERR err, char *file, int line, char *format, ...); 61 62 void auto_test_all_finished(); 63 void auto_test_take_screenshot(); 64 void auto_test_section_start(char* test_section_name); 65 void auto_test_sub_test_start(char* sub_test_name); 66 void auto_test_section_end(); 67 void auto_test_get_framebuffer(); 68 69 extern screen_settings_struct test_disp_settings; 70 extern font_struct test_disp_font; 71 72 #define wait_test(testarg, maxtime, failstatus) \ 73 { \ 74 int time; \ 75 \ 76 for (time = 0; time < (maxtime); time++) \ 77 { \ 78 if (testarg) \ 79 { \ 80 stage_status = STAGESTAT_DONE; \ 81 break; \ 82 } \ 83 if (time == ((maxtime) - 1)) \ 84 stage_status = (failstatus); \ 85 } \ 86 } 87 88 #define do_tests_error(r, ...) \ 89 tests_disp_iapetus_error(r, __FILE__, __LINE__, __VA_ARGS__); \ 90 stage_status = STAGESTAT_BADDATA; 91 92 #define do_tests_error_noarg(ret) \ 93 do_tests_error(ret, ""); 94 95 #define do_tests_unexp_data_error(...) \ 96 do_tests_error(IAPETUS_ERR_UNEXPECTDATA, __VA_ARGS__); 97 98 #endif 99