Working on a testing framework for bochs.
Added an option to do a BX_PANIC when the display matches a previously recorded text snapshot.
This commit is contained in:
parent
32340d66cc
commit
44e58663bc
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bochs.h,v 1.110 2002-12-02 21:26:03 cbothamy Exp $
|
||||
// $Id: bochs.h,v 1.111 2002-12-12 06:21:43 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -647,6 +647,7 @@ typedef struct BOCHSAPI {
|
||||
bx_param_num_c *Ofloppy_command_delay;
|
||||
bx_param_num_c *Oips;
|
||||
bx_param_bool_c *Orealtime_pit;
|
||||
bx_param_bool_c *Otext_snapshot_check;
|
||||
bx_param_bool_c *Omouse_enabled;
|
||||
bx_param_bool_c *Oprivate_colormap;
|
||||
#if BX_WITH_AMIGAOS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.cc,v 1.58 2002-12-12 03:41:51 yakovlev Exp $
|
||||
// $Id: gui.cc,v 1.59 2002-12-12 06:21:43 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -161,6 +161,10 @@ bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
|
||||
BX_GUI_THIS user_hbar_id = headerbar_bitmap(BX_GUI_THIS user_bmap_id,
|
||||
BX_GRAVITY_RIGHT, userbutton_handler);
|
||||
|
||||
if(bx_options.Otext_snapshot_check) {
|
||||
bx_pc_system.register_timer(this, bx_gui_c::snapshot_checker, (unsigned) 10000000, 1, 1, "snap_chk");
|
||||
}
|
||||
|
||||
show_headerbar();
|
||||
}
|
||||
|
||||
@ -351,6 +355,31 @@ bx_gui_c::copy_handler(void)
|
||||
free(text_snapshot);
|
||||
}
|
||||
|
||||
// Check the current text snapshot against file snapchk.txt.
|
||||
void
|
||||
bx_gui_c::snapshot_checker(void * this_ptr)
|
||||
{
|
||||
char *text_snapshot;
|
||||
Bit32u len;
|
||||
if (make_text_snapshot (&text_snapshot, &len) < 0) {
|
||||
return;
|
||||
}
|
||||
char filename[BX_PATHNAME_LEN];
|
||||
strcpy(filename,"snapchk.txt");
|
||||
char *compare_snapshot = (char *) malloc((len+1) * sizeof(char));
|
||||
FILE *fp = fopen(filename, "rb");
|
||||
if(fp) {
|
||||
fread(compare_snapshot, 1, len, fp);
|
||||
fclose(fp);
|
||||
if(!memcmp(text_snapshot,compare_snapshot,len)) {
|
||||
BX_PANIC(("Test Passed."));
|
||||
}
|
||||
}
|
||||
free(compare_snapshot);
|
||||
free(text_snapshot);
|
||||
|
||||
}
|
||||
|
||||
// create a text snapshot and dump it to a file
|
||||
void
|
||||
bx_gui_c::snapshot_handler(void)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.h,v 1.35 2002-12-06 19:34:30 bdenney Exp $
|
||||
// $Id: gui.h,v 1.36 2002-12-12 06:21:43 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -96,6 +96,7 @@ protected:
|
||||
static void copy_handler(void);
|
||||
static void paste_handler(void);
|
||||
static void snapshot_handler(void);
|
||||
static void snapshot_checker(void *);
|
||||
static void config_handler(void);
|
||||
static void toggle_mouse_enable(void);
|
||||
static void userbutton_handler(void);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.92 2002-12-07 19:43:52 bdenney Exp $
|
||||
// $Id: siminterface.h,v 1.93 2002-12-12 06:21:43 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Before I can describe what this file is for, I have to make the
|
||||
@ -122,6 +122,7 @@ typedef enum {
|
||||
BXP_NULL = 301,
|
||||
BXP_IPS,
|
||||
BXP_REALTIME_PIT,
|
||||
BXP_TEXT_SNAPSHOT_CHECK,
|
||||
BXP_VGA_UPDATE_INTERVAL,
|
||||
BXP_MOUSE_ENABLED,
|
||||
BXP_MEM_SIZE,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.203 2002-12-06 19:34:28 bdenney Exp $
|
||||
// $Id: main.cc,v 1.204 2002-12-12 06:21:43 yakovlev Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -908,6 +908,10 @@ void bx_init_options ()
|
||||
"Enable the realtime PIT",
|
||||
"Keeps bochs in sync with real time, but sacrifices reproducibility",
|
||||
0);
|
||||
bx_options.Otext_snapshot_check = new bx_param_bool_c (BXP_TEXT_SNAPSHOT_CHECK,
|
||||
"Enable panic for use in bochs testing",
|
||||
"Enable panic when text on screen matches snapchk.txt.\nUseful for regression testing.",
|
||||
0);
|
||||
bx_options.Oprivate_colormap = new bx_param_bool_c (BXP_PRIVATE_COLORMAP,
|
||||
"Use a private colormap",
|
||||
"Request that the GUI create and use it's own non-shared colormap. This colormap will be used when in the bochs window. If not enabled, a shared colormap scheme may be used. Not implemented on all GUI's.",
|
||||
@ -1378,6 +1382,7 @@ void bx_reset_options ()
|
||||
bx_options.cmos.OcmosImage->reset();
|
||||
bx_options.cmos.Opath->reset();
|
||||
bx_options.cmos.Otime0->reset();
|
||||
bx_options.Otext_snapshot_check->reset();
|
||||
}
|
||||
|
||||
void bx_print_header ()
|
||||
@ -3181,6 +3186,18 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
else
|
||||
PARSE_ERR(("%s: system_clock_sync directive malformed.", context));
|
||||
}
|
||||
else if (!strcmp(params[0], "text_snapshot_check")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: text_snapshot_check directive: wrong # args.", context));
|
||||
}
|
||||
if (!strncmp(params[1], "enable", 6)) {
|
||||
bx_options.Otext_snapshot_check->set (1);
|
||||
}
|
||||
else if (!strncmp(params[1], "disable", 7)) {
|
||||
bx_options.Otext_snapshot_check->set (0);
|
||||
}
|
||||
else bx_options.Otext_snapshot_check->set (!!(atol(params[1])));
|
||||
}
|
||||
else if (!strcmp(params[0], "mouse")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
@ -3737,6 +3754,7 @@ bx_write_configuration (char *rc, int overwrite)
|
||||
fprintf (fp, "floppy_command_delay: %u\n", bx_options.Ofloppy_command_delay->get ());
|
||||
fprintf (fp, "ips: %u\n", bx_options.Oips->get ());
|
||||
fprintf (fp, "realtime_pit: %d\n", bx_options.Orealtime_pit->get ());
|
||||
fprintf (fp, "text_snapshot_check: %d\n", bx_options.Otext_snapshot_check->get ());
|
||||
fprintf (fp, "mouse: enabled=%d\n", bx_options.Omouse_enabled->get ());
|
||||
fprintf (fp, "private_colormap: enabled=%d\n", bx_options.Oprivate_colormap->get ());
|
||||
#if BX_WITH_AMIGAOS
|
||||
|
Loading…
Reference in New Issue
Block a user