Build and fix testui on Desktop Linux

This commit is contained in:
Aaron Culliney 2016-09-17 13:05:26 -07:00
parent 6daa1aa010
commit fe63695f81
3 changed files with 31 additions and 29 deletions

View File

@ -86,8 +86,8 @@ src/x86/glue.S: src/cpu-supp.c src/disk.c src/display.c src/vm.c @AUDIO_GLUE_C@
A2_TEST_SOURCES = $(apple2ix_SOURCES) src/test/testcommon.c
A2_TEST_CFLAGS = $(apple2ix_CFLAGS) -DTESTING=1 -Isrc/test
TESTS = testcpu testdisplay testvm testdisk testprefs testtrace
check_PROGRAMS = testcpu testdisplay testvm testdisk testprefs testtrace
TESTS = testcpu testdisk testdisplay testprefs testtrace testui testvm
check_PROGRAMS = testcpu testdisk testdisplay testprefs testtrace testui testvm
#######################################
@ -141,6 +141,16 @@ EXTRA_testtrace_SOURCES = $(ASM_SRC_x86) $(VIDEO_SRC) $(AUDIO_SRC) $(META_SRC)
#######################################
testui_SOURCES = src/test/testui.c $(A2_TEST_SOURCES)
testui_CFLAGS = $(A2_TEST_CFLAGS) -DTEST_UI=1
testui_CCASFLAGS = $(testui_CFLAGS)
testui_LDFLAGS = $(apple2ix_LDFLAGS)
testui_LDADD = @testui_ASM_O@ @testui_VIDEO_O@ @testui_AUDIO_O@ @testui_META_O@ @X_LIBS@
testui_DEPENDENCIES = @testui_ASM_O@ @testui_VIDEO_O@ @testui_AUDIO_O@ @testui_META_O@
EXTRA_testui_SOURCES = $(ASM_SRC_x86) $(VIDEO_SRC) $(AUDIO_SRC) $(META_SRC)
#######################################
testvm_SOURCES = src/test/testvm.c $(A2_TEST_SOURCES)
testvm_CFLAGS = $(A2_TEST_CFLAGS) -DTEST_VM=1
testvm_CCASFLAGS = $(testvm_CFLAGS)

View File

@ -26,6 +26,7 @@ testdisk_ASM_O="src/x86/testdisk-glue.o src/x86/testdisk-cpu.o"
testdisplay_ASM_O="src/x86/testdisplay-glue.o src/x86/testdisplay-cpu.o"
testprefs_ASM_O="src/x86/testprefs-glue.o src/x86/testprefs-cpu.o"
testtrace_ASM_O="src/x86/testtrace-glue.o src/x86/testtrace-cpu.o"
testui_ASM_O="src/x86/testui-glue.o src/x86/testui-cpu.o"
testvm_ASM_O="src/x86/testvm-glue.o src/x86/testvm-cpu.o"
arch=''
case $target in
@ -85,6 +86,7 @@ AC_SUBST(testdisk_ASM_O)
AC_SUBST(testdisplay_ASM_O)
AC_SUBST(testprefs_ASM_O)
AC_SUBST(testtrace_ASM_O)
AC_SUBST(testui_ASM_O)
AC_SUBST(testvm_ASM_O)
AC_SUBST([AM_CFLAGS])
@ -186,6 +188,7 @@ AC_ARG_ENABLE([opengl], AS_HELP_STRING([--disable-opengl], [Disable OpenGL video
testdisplay_VIDEO_O="src/video/testdisplay-glvideo.o src/video/testdisplay-glnode.o src/video/testdisplay-glalert.o src/video/testdisplay-glhudmodel.o src/video/testdisplay-glutinput.o src/video_util/testdisplay-matrixUtil.o src/video_util/testdisplay-modelUtil.o src/video_util/testdisplay-sourceUtil.o src/video_util/testdisplay-vectorUtil.o"
testprefs_VIDEO_O="src/video/testprefs-glvideo.o src/video/testprefs-glnode.o src/video/testprefs-glalert.o src/video/testprefs-glhudmodel.o src/video/testprefs-glutinput.o src/video_util/testprefs-matrixUtil.o src/video_util/testprefs-modelUtil.o src/video_util/testprefs-sourceUtil.o src/video_util/testprefs-vectorUtil.o"
testtrace_VIDEO_O="src/video/testtrace-glvideo.o src/video/testtrace-glnode.o src/video/testtrace-glalert.o src/video/testtrace-glhudmodel.o src/video/testtrace-glutinput.o src/video_util/testtrace-matrixUtil.o src/video_util/testtrace-modelUtil.o src/video_util/testtrace-sourceUtil.o src/video_util/testtrace-vectorUtil.o"
testui_VIDEO_O="src/video/testui-glvideo.o src/video/testui-glnode.o src/video/testui-glalert.o src/video/testui-glhudmodel.o src/video/testui-glutinput.o src/video_util/testui-matrixUtil.o src/video_util/testui-modelUtil.o src/video_util/testui-sourceUtil.o src/video_util/testui-vectorUtil.o"
testvm_VIDEO_O="src/video/testvm-glvideo.o src/video/testvm-glnode.o src/video/testvm-glalert.o src/video/testvm-glhudmodel.o src/video/testvm-glutinput.o src/video_util/testvm-matrixUtil.o src/video_util/testvm-modelUtil.o src/video_util/testvm-sourceUtil.o src/video_util/testvm-vectorUtil.o"
AC_MSG_RESULT([Building emulator with OpenGL support, w00t!])
], [
@ -226,6 +229,7 @@ AS_IF([test "x$opengl_supported" = "xyes"], [
testdisplay_VIDEO_O="src/video/testdisplay-xvideo.o"
testprefs_VIDEO_O="src/video/testprefs-xvideo.o"
testtrace_VIDEO_O="src/video/testtrace-xvideo.o"
testui_VIDEO_O="src/video/testui-xvideo.o"
testvm_VIDEO_O="src/video/testvm-xvideo.o"
], [
AC_MSG_ERROR([Did not find OpenGL nor X11 libraries...])
@ -241,6 +245,7 @@ AC_SUBST(testdisk_VIDEO_O)
AC_SUBST(testdisplay_VIDEO_O)
AC_SUBST(testprefs_VIDEO_O)
AC_SUBST(testtrace_VIDEO_O)
AC_SUBST(testui_VIDEO_O)
AC_SUBST(testvm_VIDEO_O)
dnl ---------------------------------------------------------------------------
@ -264,6 +269,7 @@ AC_ARG_ENABLE([audio], AS_HELP_STRING([--disable-audio], [Disable emulator audio
testdisplay_AUDIO_O="src/audio/testdisplay-soundcore.o src/audio/testdisplay-soundcore-openal.o src/audio/testdisplay-speaker.o src/audio/testdisplay-playqueue.o src/audio/testdisplay-alhelpers.o src/audio/testdisplay-mockingboard.o src/audio/testdisplay-AY8910.o"
testprefs_AUDIO_O="src/audio/testprefs-soundcore.o src/audio/testprefs-soundcore-openal.o src/audio/testprefs-speaker.o src/audio/testprefs-playqueue.o src/audio/testprefs-alhelpers.o src/audio/testprefs-mockingboard.o src/audio/testprefs-AY8910.o"
testtrace_AUDIO_O="src/audio/testtrace-soundcore.o src/audio/testtrace-soundcore-openal.o src/audio/testtrace-speaker.o src/audio/testtrace-playqueue.o src/audio/testtrace-alhelpers.o src/audio/testtrace-mockingboard.o src/audio/testtrace-AY8910.o"
testui_AUDIO_O="src/audio/testui-soundcore.o src/audio/testui-soundcore-openal.o src/audio/testui-speaker.o src/audio/testui-playqueue.o src/audio/testui-alhelpers.o src/audio/testui-mockingboard.o src/audio/testui-AY8910.o"
testvm_AUDIO_O="src/audio/testvm-soundcore.o src/audio/testvm-soundcore-openal.o src/audio/testvm-speaker.o src/audio/testvm-playqueue.o src/audio/testvm-alhelpers.o src/audio/testvm-mockingboard.o src/audio/testvm-AY8910.o"
], [
AC_MSG_ERROR([Could not find OpenAL libraries ... todo fixme ... implement a null sound backend])
@ -288,6 +294,7 @@ AC_SUBST(testdisk_AUDIO_O)
AC_SUBST(testdisplay_AUDIO_O)
AC_SUBST(testprefs_AUDIO_O)
AC_SUBST(testtrace_AUDIO_O)
AC_SUBST(testui_AUDIO_O)
AC_SUBST(testvm_AUDIO_O)
AS_IF([test "x$openal_supported" = "xyes"], [
@ -309,6 +316,7 @@ AC_ARG_ENABLE([debugger], AS_HELP_STRING([--disable-debugger], [Disable 6502 deb
testdisplay_META_O="src/meta/testdisplay-debug.o src/meta/testdisplay-debugger.o src/meta/testdisplay-opcodes.o src/test/testdisplay-sha1.o"
testprefs_META_O="src/meta/testprefs-debug.o src/meta/testprefs-debugger.o src/meta/testprefs-opcodes.o src/test/testprefs-sha1.o"
testtrace_META_O="src/meta/testtrace-debug.o src/meta/testtrace-debugger.o src/meta/testtrace-opcodes.o src/test/testtrace-sha1.o"
testui_META_O="src/meta/testui-debug.o src/meta/testui-debugger.o src/meta/testui-opcodes.o src/test/testui-sha1.o"
testvm_META_O="src/meta/testvm-debug.o src/meta/testvm-debugger.o src/meta/testvm-opcodes.o src/test/testvm-sha1.o"
])
AC_SUBST(META_O)
@ -317,6 +325,7 @@ AC_SUBST(testdisk_META_O)
AC_SUBST(testdisplay_META_O)
AC_SUBST(testprefs_META_O)
AC_SUBST(testtrace_META_O)
AC_SUBST(testui_META_O)
AC_SUBST(testvm_META_O)
AC_DEFINE(INTERFACE_CLASSIC, 1, [Use the classic menu interface])

View File

@ -34,6 +34,14 @@ static void testui_teardown(void *arg) {
// ----------------------------------------------------------------------------
// Various Tests ...
#if CONFORMANT_TRACKS
# define BLANK_RUN_BYTE 1208
# define BLANK_TRACK_WIDTH 6384
#else
# define BLANK_RUN_BYTE 1130
# define BLANK_TRACK_WIDTH 6040
#endif
static int _assert_blank_boot(void) {
// Disk6 ...
ASSERT(disk6.motor_off == 1);
@ -46,13 +54,13 @@ static int _assert_blank_boot(void) {
const char *file_name = strrchr(disk6.disk[0].file_name, '/');
ASSERT(strcmp(file_name, "/blank.dsk") == 0);
ASSERT(disk6.disk[0].phase == 36);
ASSERT(disk6.disk[0].run_byte == 1130);
ASSERT(disk6.disk[0].run_byte == BLANK_RUN_BYTE);
ASSERT(disk6.disk[0].fd > 0);
ASSERT(disk6.disk[0].mmap_image != 0);
ASSERT(disk6.disk[0].mmap_image != MAP_FAILED);
ASSERT(disk6.disk[0].whole_len == 143360);
ASSERT(disk6.disk[0].whole_image != NULL);
ASSERT(disk6.disk[0].track_width == 6040);
ASSERT(disk6.disk[0].track_width == BLANK_TRACK_WIDTH);
ASSERT(!disk6.disk[0].nibblized);
ASSERT(!disk6.disk[0].track_dirty);
extern int skew_table_6_do[16];
@ -89,8 +97,6 @@ static int _assert_blank_boot(void) {
PASS();
}
#define EXPECTED_A2VM_FILE_SIZE 164064
TEST test_save_state_1() {
test_setup_boot_disk(BLANK_DSK, 1);
@ -104,29 +110,6 @@ TEST test_save_state_1() {
bool ret = emulator_saveState(savFile);
ASSERT(ret);
do {
uint8_t md[SHA_DIGEST_LENGTH];
char mdstr0[(SHA_DIGEST_LENGTH*2)+1];
FILE *fp = fopen(savFile, "r");
fseek(fp, 0, SEEK_END);
long expectedSize = ftell(fp);
ASSERT(expectedSize == EXPECTED_A2VM_FILE_SIZE);
fseek(fp, 0, SEEK_SET);
unsigned char *buf = MALLOC(EXPECTED_A2VM_FILE_SIZE);
if (fread(buf, 1, EXPECTED_A2VM_FILE_SIZE, fp) != EXPECTED_A2VM_FILE_SIZE) {
ASSERT(false);
}
fclose(fp); fp = NULL;
SHA1(buf, EXPECTED_A2VM_FILE_SIZE, md);
FREE(buf);
sha1_to_str(md, mdstr0);
ASSERT(strcasecmp(mdstr0, "0f70ed3ed7e018025ca51dcf5ca063553ee4403f") == 0);
} while(0);
FREE(savFile);
PASS();
}