mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-26 17:32:40 +00:00
Refactor test_setup_boot_disk
This commit is contained in:
parent
4ff57ab7dd
commit
31b87f67e4
@ -144,7 +144,7 @@ void test_common_init(bool do_cputhread) {
|
||||
}
|
||||
}
|
||||
|
||||
int setup_boot_disk(const char *fileName) {
|
||||
int test_setup_boot_disk(const char *fileName, int readonly) {
|
||||
char *disk = NULL;
|
||||
int err = 0;
|
||||
#ifdef __APPLE__
|
||||
@ -164,10 +164,10 @@ int setup_boot_disk(const char *fileName) {
|
||||
#else
|
||||
asprintf(&disk, "./disks/%s", fileName);
|
||||
#endif
|
||||
if (c_new_diskette_6(0, disk, 0)) {
|
||||
if (c_new_diskette_6(0, disk, readonly)) {
|
||||
int len = strlen(disk);
|
||||
disk[len-3] = '\0';
|
||||
err = (c_new_diskette_6(0, disk, 0) != NULL);
|
||||
err = (c_new_diskette_6(0, disk, readonly) != NULL);
|
||||
}
|
||||
FREE(disk);
|
||||
return err;
|
||||
|
@ -52,6 +52,6 @@ void test_breakpoint(void *arg);
|
||||
void test_common_init(bool do_cputhread);
|
||||
void test_common_setup();
|
||||
void test_type_input(const char *input);
|
||||
int setup_boot_disk(const char *fileName);
|
||||
int test_setup_boot_disk(const char *fileName, int readonly);
|
||||
|
||||
#endif // whole file
|
||||
|
@ -41,7 +41,7 @@ static void sha1_to_str(const uint8_t * const md, char *buf) {
|
||||
}
|
||||
|
||||
TEST test_boot_disk() {
|
||||
setup_boot_disk("testdisplay1.dsk.gz");
|
||||
test_setup_boot_disk("testdisplay1.dsk.gz", 1);
|
||||
|
||||
BOOT_TO_DOS();
|
||||
|
||||
|
@ -29,6 +29,7 @@ static void testvm_setup(void *arg) {
|
||||
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);
|
||||
}
|
||||
@ -51,8 +52,6 @@ static void sha1_to_str(const uint8_t * const md, char *buf) {
|
||||
#define EXPECTED_DISK_TRACE_FILE_SIZE 60961
|
||||
#define EXPECTED_DISK_TRACE_SHA "D21CC686571ADE868A909B5A7044A973DE70DFFB"
|
||||
TEST test_boot_disk_bytes() {
|
||||
setup_boot_disk(TESTING_DISK);
|
||||
|
||||
char *homedir = getenv("HOME");
|
||||
char *disk = NULL;
|
||||
asprintf(&disk, "%s/a2_read_disk_test.raw", homedir);
|
||||
@ -96,8 +95,6 @@ TEST test_boot_disk_bytes() {
|
||||
#define EXPECTED_CPU_TRACE_FILE_SIZE 87611579
|
||||
#define EXPECTED_CPU_TRACE_SHA "8DE74ED640E0CE4AB1AAC40E95BE9B8507A37434"
|
||||
TEST test_boot_disk_cputrace() {
|
||||
setup_boot_disk(TESTING_DISK);
|
||||
|
||||
char *homedir = getenv("HOME");
|
||||
char *output = NULL;
|
||||
asprintf(&output, "%s/a2_cputrace.raw", homedir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user