mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-04-11 21:37:18 +00:00
Lightly refactor testing codepaths for desktop Linux and Android
This commit is contained in:
parent
e4c06c67a7
commit
a1c497bfa0
@ -741,16 +741,20 @@ static long opensles_systemResume(AudioContext_s *audio_context) {
|
||||
break;
|
||||
}
|
||||
|
||||
#if !TESTING
|
||||
assert(state != SL_PLAYSTATE_PLAYING && "mismatch between systemPause/systemResume");
|
||||
#endif
|
||||
|
||||
if (state == SL_PLAYSTATE_PAUSED) {
|
||||
// Balanced resume OK here
|
||||
SLresult result = (*(ctx->bqPlayerPlay))->SetPlayState(ctx->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
|
||||
#if !TESTING
|
||||
} else {
|
||||
// Do not resume for stopped state, let this get forced from CPU/speaker thread otherwise we starve. (The
|
||||
// stopped state happens if user dynamically changed buffer parameters in menu settings which triggered an
|
||||
// OpenSLES destroy/re-initialization ... e.g. audio_setLatency() was invoked)
|
||||
assert(state == SL_PLAYSTATE_STOPPED);
|
||||
#endif
|
||||
}
|
||||
} while (0);
|
||||
|
||||
|
@ -23,6 +23,9 @@ static unsigned int input_counter = 0;
|
||||
static struct timespec t0 = { 0 };
|
||||
static struct timespec ti = { 0 };
|
||||
|
||||
#if defined(ANDROID)
|
||||
// We basically compile everything including audio into the Android build, even for testing =)
|
||||
#else
|
||||
// ----------------------------------------------------------------------------
|
||||
// Stub functions because I've reached diminishing returns with the build system ...
|
||||
//
|
||||
@ -46,6 +49,7 @@ void c_speaker_toggle(void) {
|
||||
|
||||
void c_interface_print(int x, int y, const int cs, const char *s) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -102,46 +106,24 @@ void test_breakpoint(void *arg) {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void test_common_init(bool do_cputhread) {
|
||||
void test_common_init() {
|
||||
GREATEST_SET_BREAKPOINT_CB(test_breakpoint, NULL);
|
||||
|
||||
do_logging = false;// silence regular emulator logging
|
||||
setenv("APPLE2IXCFG", "nosuchconfigfile", 1);
|
||||
|
||||
c_initialize_firsttime();
|
||||
//do_logging = false;// silence regular emulator logging
|
||||
caps_lock = true;
|
||||
|
||||
// kludgey set max CPU speed...
|
||||
cpu_scale_factor = CPU_SCALE_FASTEST;
|
||||
cpu_altscale_factor = CPU_SCALE_FASTEST;
|
||||
is_fullspeed = true;
|
||||
timing_initialize();
|
||||
|
||||
caps_lock = true;
|
||||
|
||||
if (do_cputhread) {
|
||||
// spin off cpu thread
|
||||
pthread_create(&cpu_thread_id, NULL, (void *) &cpu_thread, (void *)NULL);
|
||||
c_debugger_set_watchpoint(WATCHPOINT_ADDR);
|
||||
if (is_headless) {
|
||||
c_debugger_set_timeout(15);
|
||||
} else {
|
||||
fprintf(stderr, "NOTE : RUNNING WITH DISPLAY\n");
|
||||
fprintf(stderr, "Will spinloop on failed tests for debugger intervention\n");
|
||||
fprintf(stderr, "Pass HEADLESS=1 to environment to run nonstop\n");
|
||||
c_debugger_set_timeout(0);
|
||||
}
|
||||
c_debugger_set_watchpoint(WATCHPOINT_ADDR);
|
||||
if (0) {
|
||||
c_debugger_set_timeout(15);
|
||||
} else {
|
||||
#ifdef AUDIO_ENABLED
|
||||
audio_init();
|
||||
speaker_init();
|
||||
MB_Initialize();
|
||||
#endif
|
||||
|
||||
cpu_pause();
|
||||
reinitialize();
|
||||
cpu_resume();
|
||||
|
||||
extern volatile uint8_t emul_reinitialize;
|
||||
emul_reinitialize = 0;
|
||||
fprintf(stderr, "NOTE : RUNNING WITH DISPLAY\n");
|
||||
fprintf(stderr, "Will spinloop on failed tests for debugger intervention\n");
|
||||
c_debugger_set_timeout(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +149,7 @@ int test_setup_boot_disk(const char *fileName, int readonly) {
|
||||
#endif
|
||||
if (c_new_diskette_6(0, disk, readonly)) {
|
||||
int len = strlen(disk);
|
||||
disk[len-3] = '\0';
|
||||
disk[len-3] = '\0'; // try again without '.gz' extension
|
||||
err = (c_new_diskette_6(0, disk, readonly) != NULL);
|
||||
}
|
||||
FREE(disk);
|
||||
|
@ -35,8 +35,8 @@ extern char mdstr[(SHA_DIGEST_LENGTH*2)+1];
|
||||
|
||||
extern bool test_do_reboot;
|
||||
void test_breakpoint(void *arg);
|
||||
void test_common_init(bool do_cputhread);
|
||||
void test_common_setup();
|
||||
void test_common_init(void);
|
||||
void test_common_setup(void);
|
||||
void test_type_input(const char *input);
|
||||
int test_setup_boot_disk(const char *fileName, int readonly);
|
||||
void sha1_to_str(const uint8_t * const md, char *buf);
|
||||
@ -61,4 +61,11 @@ static inline int BOOT_TO_DOS(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void REBOOT_TO_DOS(void) {
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x00;
|
||||
joy_button0 = 0xff;
|
||||
cpu65_interrupt(ResetSig);
|
||||
}
|
||||
|
||||
#endif // whole file
|
||||
|
@ -51,7 +51,6 @@
|
||||
|
||||
static void testcpu_setup(void *arg) {
|
||||
|
||||
//reinitialize();
|
||||
cpu65_uninterrupt(0xff);
|
||||
extern int32_t cpu65_cycles_to_execute;
|
||||
extern int32_t cpu65_cycle_count;
|
||||
@ -7310,7 +7309,14 @@ GREATEST_SUITE(test_suite_cpu) {
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
test_common_init(/*cputhread*/false);
|
||||
video_init();
|
||||
test_common_init();
|
||||
assert(cpu_thread_id == 0 && "This test is not designed to run with alternate CPU thread");
|
||||
extern void reinitialize(void);
|
||||
reinitialize();
|
||||
|
||||
extern volatile uint8_t emul_reinitialize;
|
||||
emul_reinitialize = 0;
|
||||
|
||||
test_func_t *func=NULL, *tmp=NULL;
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
#define RESET_INPUT() test_common_setup()
|
||||
|
||||
#ifdef ANDROID
|
||||
# define HOMEDIR data_dir
|
||||
#else
|
||||
@ -26,21 +24,13 @@
|
||||
#define BLANK_DSK "blank.dsk.gz"
|
||||
#define BLANK_NIB "blank.nib.gz"
|
||||
#define BLANK_PO "blank.po.gz"
|
||||
#define REBOOT_TO_DOS() \
|
||||
do { \
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00; \
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x00; \
|
||||
joy_button0 = 0xff; \
|
||||
cpu65_interrupt(ResetSig); \
|
||||
} while (0)
|
||||
|
||||
#define TYPE_TRIGGER_WATCHPT() \
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r")
|
||||
static bool test_thread_running = false;
|
||||
|
||||
extern pthread_mutex_t interface_mutex; // TODO FIXME : raw access to CPU mutex because stepping debugger ...
|
||||
|
||||
static void testdisk_setup(void *arg) {
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
apple_ii_64k[0][MIXSWITCH_ADDR] = 0x00;
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x00;
|
||||
@ -602,7 +592,7 @@ TEST test_savehello_dsk() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -628,7 +618,7 @@ TEST test_savehello_nib() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -654,7 +644,7 @@ TEST test_savehello_po() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -691,7 +681,7 @@ TEST test_disk_bytes_savehello_dsk() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -756,7 +746,7 @@ TEST test_disk_bytes_savehello_nib() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -821,7 +811,7 @@ TEST test_disk_bytes_savehello_po() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
test_type_input("SAVE HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -889,7 +879,7 @@ TEST test_outofspace_dsk() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
EAT_UP_DISK_SPACE();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -915,7 +905,7 @@ TEST test_outofspace_nib() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
EAT_UP_DISK_SPACE();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -941,7 +931,7 @@ TEST test_outofspace_po() {
|
||||
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x0;
|
||||
EAT_UP_DISK_SPACE();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -968,7 +958,7 @@ TEST test_inithello_dsk() {
|
||||
ASSERT(apple_ii_64k[0][TESTOUT_ADDR] == 0x00);
|
||||
|
||||
test_type_input("INIT HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -993,7 +983,7 @@ TEST test_inithello_nib() {
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
test_type_input("INIT HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -1018,7 +1008,7 @@ TEST test_inithello_po() {
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
test_type_input("INIT HELLO\r");
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -1038,15 +1028,13 @@ TEST test_inithello_po() {
|
||||
// ----------------------------------------------------------------------------
|
||||
// Test Suite
|
||||
|
||||
static int begin_video = -1;
|
||||
|
||||
GREATEST_SUITE(test_suite_disk) {
|
||||
GREATEST_SET_SETUP_CB(testdisk_setup, NULL);
|
||||
GREATEST_SET_TEARDOWN_CB(testdisk_teardown, NULL);
|
||||
GREATEST_SET_BREAKPOINT_CB(test_breakpoint, NULL);
|
||||
|
||||
// TESTS --------------------------
|
||||
begin_video=!is_headless;
|
||||
test_thread_running = true;
|
||||
|
||||
RUN_TESTp(test_boot_disk_bytes);
|
||||
RUN_TESTp(test_boot_disk_bytes_nib);
|
||||
@ -1098,16 +1086,12 @@ GREATEST_MAIN_DEFS();
|
||||
static char **test_argv = NULL;
|
||||
static int test_argc = 0;
|
||||
|
||||
static int _test_disk(void) {
|
||||
static void *test_thread(void *dummyptr) {
|
||||
int argc = test_argc;
|
||||
char **argv = test_argv;
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_SUITE(test_suite_disk);
|
||||
GREATEST_MAIN_END();
|
||||
}
|
||||
|
||||
static void *test_thread(void *dummyptr) {
|
||||
_test_disk();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1117,18 +1101,17 @@ void test_disk(int argc, char **argv) {
|
||||
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
|
||||
test_common_init(/*cputhread*/true);
|
||||
test_common_init();
|
||||
|
||||
pthread_t p;
|
||||
pthread_create(&p, NULL, (void *)&test_thread, (void *)NULL);
|
||||
|
||||
while (begin_video < 0) {
|
||||
while (!test_thread_running) {
|
||||
struct timespec ts = { .tv_sec=0, .tv_nsec=33333333 };
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
if (begin_video) {
|
||||
video_main_loop();
|
||||
}
|
||||
timing_startCPU();
|
||||
video_main_loop();
|
||||
//pthread_join(p, NULL);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ static void testdisplay_setup(void *arg) {
|
||||
static void testdisplay_teardown(void *arg) {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Various Display Tests ...
|
||||
|
||||
TEST test_boot_disk() {
|
||||
test_setup_boot_disk("testdisplay1.nib.gz", 1);
|
||||
|
||||
@ -318,6 +321,8 @@ TEST test_80col_hires() {
|
||||
// Test Suite
|
||||
|
||||
GREATEST_SUITE(test_suite_display) {
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
|
||||
GREATEST_SET_SETUP_CB(testdisplay_setup, NULL);
|
||||
GREATEST_SET_TEARDOWN_CB(testdisplay_teardown, NULL);
|
||||
GREATEST_SET_BREAKPOINT_CB(test_breakpoint, NULL);
|
||||
@ -438,16 +443,12 @@ GREATEST_MAIN_DEFS();
|
||||
static char **test_argv = NULL;
|
||||
static int test_argc = 0;
|
||||
|
||||
static int _test_display(void) {
|
||||
static void *test_thread(void *dummyptr) {
|
||||
int argc = test_argc;
|
||||
char **argv = test_argv;
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_SUITE(test_suite_display);
|
||||
GREATEST_MAIN_END();
|
||||
}
|
||||
|
||||
static void *test_thread(void *dummyptr) {
|
||||
_test_display();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -457,9 +458,7 @@ void test_display(int argc, char **argv) {
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
|
||||
test_common_init(/*cputhread*/true);
|
||||
test_common_init();
|
||||
|
||||
pthread_t p;
|
||||
pthread_create(&p, NULL, (void *)&test_thread, (void *)NULL);
|
||||
@ -468,6 +467,7 @@ void test_display(int argc, char **argv) {
|
||||
struct timespec ts = { .tv_sec=0, .tv_nsec=33333333 };
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
timing_startCPU();
|
||||
video_main_loop();
|
||||
//pthread_join(p, NULL);
|
||||
}
|
||||
|
@ -11,24 +11,16 @@
|
||||
|
||||
#include "testcommon.h"
|
||||
|
||||
#define RESET_INPUT() test_common_setup()
|
||||
|
||||
#define TESTING_DISK "testvm1.nib.gz"
|
||||
|
||||
static bool test_thread_running = false;
|
||||
|
||||
#define TYPE_TRIGGER_WATCHPT() \
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r")
|
||||
|
||||
extern pthread_mutex_t interface_mutex; // TODO FIXME : raw access to CPU mutex because stepping debugger ...
|
||||
|
||||
static void testvm_setup(void *arg) {
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
apple_ii_64k[0][MIXSWITCH_ADDR] = 0x00;
|
||||
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x00;
|
||||
joy_button0 = 0xff; // OpenApple
|
||||
test_setup_boot_disk(TESTING_DISK, 1);
|
||||
if (test_do_reboot) {
|
||||
cpu65_interrupt(ResetSig);
|
||||
}
|
||||
@ -40,6 +32,14 @@ static void testvm_teardown(void *arg) {
|
||||
// ----------------------------------------------------------------------------
|
||||
// VM TESTS ...
|
||||
|
||||
TEST test_boot_disk() {
|
||||
test_setup_boot_disk("testvm1.nib.gz", 1);
|
||||
|
||||
BOOT_TO_DOS();
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
||||
TEST test_read_keyboard() {
|
||||
BOOT_TO_DOS();
|
||||
|
||||
@ -513,7 +513,7 @@ TEST test_PAGE2_on(bool flag_80store, bool flag_hires) {
|
||||
TYPE_HIRES_OFF();
|
||||
}
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -526,9 +526,9 @@ TEST test_PAGE2_on(bool flag_80store, bool flag_hires) {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_PAGE2_ON();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -596,7 +596,7 @@ TEST test_PAGE2_off(bool flag_80store, bool flag_hires) {
|
||||
TYPE_HIRES_OFF();
|
||||
}
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -609,9 +609,9 @@ TEST test_PAGE2_off(bool flag_80store, bool flag_hires) {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_PAGE2_OFF();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -658,7 +658,7 @@ TEST test_check_PAGE2(bool flag_page2) {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
|
||||
if (flag_page2) {
|
||||
TYPE_PAGE2_ON();
|
||||
@ -667,7 +667,7 @@ TEST test_check_PAGE2(bool flag_page2) {
|
||||
}
|
||||
|
||||
TYPE_CHECK_PAGE2();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
|
||||
c_debugger_go();
|
||||
@ -694,7 +694,7 @@ TEST test_TEXT_on() {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -705,9 +705,9 @@ TEST test_TEXT_on() {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_TEXT_ON();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -744,7 +744,7 @@ TEST test_TEXT_off() {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -755,9 +755,9 @@ TEST test_TEXT_off() {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_TEXT_OFF();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -790,7 +790,7 @@ TEST test_check_TEXT(bool flag_text) {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
|
||||
if (flag_text) {
|
||||
TYPE_TEXT_ON();
|
||||
@ -799,7 +799,7 @@ TEST test_check_TEXT(bool flag_text) {
|
||||
}
|
||||
|
||||
TYPE_CHECK_TEXT();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
|
||||
c_debugger_go();
|
||||
@ -826,7 +826,7 @@ TEST test_MIXED_on() {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -837,9 +837,9 @@ TEST test_MIXED_on() {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_MIXED_ON();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -876,7 +876,7 @@ TEST test_MIXED_off() {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -887,9 +887,9 @@ TEST test_MIXED_off() {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_MIXED_OFF();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -922,7 +922,7 @@ TEST test_check_MIXED(bool flag_mixed) {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
|
||||
if (flag_mixed) {
|
||||
TYPE_MIXED_ON();
|
||||
@ -931,7 +931,7 @@ TEST test_check_MIXED(bool flag_mixed) {
|
||||
}
|
||||
|
||||
TYPE_CHECK_MIXED();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
|
||||
c_debugger_go();
|
||||
@ -970,7 +970,7 @@ TEST test_HIRES_on(bool flag_80store, bool flag_page2) {
|
||||
TYPE_PAGE2_OFF();
|
||||
}
|
||||
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
c_debugger_go();
|
||||
|
||||
@ -983,9 +983,9 @@ TEST test_HIRES_on(bool flag_80store, bool flag_page2) {
|
||||
|
||||
// run actual test ...
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
TYPE_HIRES_ON();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
uint8_t *save_base_textrd = base_textrd;
|
||||
uint8_t *save_base_textwrt = base_textwrt;
|
||||
@ -1117,7 +1117,7 @@ TEST test_check_HIRES(bool flag_hires) {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
|
||||
if (flag_hires) {
|
||||
TYPE_HIRES_ON();
|
||||
@ -1126,7 +1126,7 @@ TEST test_check_HIRES(bool flag_hires) {
|
||||
}
|
||||
|
||||
TYPE_CHECK_HIRES();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
|
||||
c_debugger_go();
|
||||
@ -1657,7 +1657,7 @@ TEST test_check_BANK2(bool flag_bank2) {
|
||||
|
||||
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
|
||||
|
||||
RESET_INPUT();
|
||||
test_common_setup();
|
||||
|
||||
if (flag_bank2) {
|
||||
TYPE_BANK2_ON();
|
||||
@ -1666,7 +1666,7 @@ TEST test_check_BANK2(bool flag_bank2) {
|
||||
}
|
||||
|
||||
TYPE_CHECK_BANK2();
|
||||
TYPE_TRIGGER_WATCHPT();
|
||||
test_type_input("POKE7987,255:REM TRIGGER DEBUGGER\r");
|
||||
|
||||
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
|
||||
c_debugger_go();
|
||||
@ -3262,6 +3262,8 @@ TEST test_check_cxrom(bool flag_cxrom) {
|
||||
// Test Suite
|
||||
|
||||
GREATEST_SUITE(test_suite_vm) {
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
|
||||
GREATEST_SET_SETUP_CB(testvm_setup, NULL);
|
||||
GREATEST_SET_TEARDOWN_CB(testvm_teardown, NULL);
|
||||
GREATEST_SET_BREAKPOINT_CB(test_breakpoint, NULL);
|
||||
@ -3269,6 +3271,11 @@ GREATEST_SUITE(test_suite_vm) {
|
||||
// TESTS --------------------------
|
||||
test_thread_running=true;
|
||||
|
||||
RUN_TESTp(test_boot_disk);
|
||||
|
||||
#if defined(ANDROID)
|
||||
#warning FIXME TODO ... why are these test broken on Android?!
|
||||
#else
|
||||
RUN_TESTp(test_read_keyboard);
|
||||
|
||||
RUN_TESTp(test_clear_keyboard);
|
||||
@ -3277,6 +3284,8 @@ GREATEST_SUITE(test_suite_vm) {
|
||||
#if 0
|
||||
#error this is an unstable test due to VBL refactoring ...
|
||||
RUN_TESTp(test_read_random2);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
RUN_TESTp(test_PAGE2_on, /*80STORE*/0, /*HIRES*/0);
|
||||
@ -3453,16 +3462,12 @@ GREATEST_MAIN_DEFS();
|
||||
static char **test_argv = NULL;
|
||||
static int test_argc = 0;
|
||||
|
||||
static int _test_vm(void) {
|
||||
static void *test_thread(void *dummyptr) {
|
||||
int argc = test_argc;
|
||||
char **argv = test_argv;
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_SUITE(test_suite_vm);
|
||||
GREATEST_MAIN_END();
|
||||
}
|
||||
|
||||
static void *test_thread(void *dummyptr) {
|
||||
_test_vm();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -3470,9 +3475,7 @@ void test_vm(int argc, char **argv) {
|
||||
test_argc = argc;
|
||||
test_argv = argv;
|
||||
|
||||
pthread_mutex_lock(&interface_mutex);
|
||||
|
||||
test_common_init(/*cputhread*/true);
|
||||
test_common_init();
|
||||
|
||||
pthread_t p;
|
||||
pthread_create(&p, NULL, (void *)&test_thread, (void *)NULL);
|
||||
@ -3481,6 +3484,7 @@ void test_vm(int argc, char **argv) {
|
||||
struct timespec ts = { .tv_sec=0, .tv_nsec=33333333 };
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
timing_startCPU();
|
||||
video_main_loop();
|
||||
//pthread_join(p, NULL);
|
||||
}
|
||||
|
@ -190,7 +190,9 @@ void reinitialize(void) {
|
||||
}
|
||||
|
||||
void timing_initialize(void) {
|
||||
#if !TESTING
|
||||
assert(cpu_isPaused() || (pthread_self() == cpu_thread_id));
|
||||
#endif
|
||||
_timing_initialize(alt_speed_enabled ? cpu_altscale_factor : cpu_scale_factor);
|
||||
}
|
||||
|
||||
@ -292,7 +294,10 @@ static void *cpu_thread(void *dummyptr) {
|
||||
|
||||
do
|
||||
{
|
||||
#if MOBILE_DEVICE && !TESTING
|
||||
#if MOBILE_DEVICE
|
||||
#if TESTING
|
||||
emul_reinitialize_background = false;
|
||||
#else
|
||||
if (emul_reinitialize_background) {
|
||||
|
||||
speaker_destroy();
|
||||
@ -325,6 +330,7 @@ static void *cpu_thread(void *dummyptr) {
|
||||
emul_reinitialize_audio = true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_ENABLED
|
||||
if (emul_reinitialize_audio) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user