Update code coverage test to run headless for a full minute, correct some warning and bugs
This commit is contained in:
parent
b0ed951235
commit
b6c4793f44
18
.travis.yml
18
.travis.yml
@ -4,9 +4,21 @@ git:
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
script: mkdir build && cd build && cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=ON -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . && cmake --build . --target coveralls
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=OFF -DCOVERALLS=OFF -DCMAKE_BUILD_TYPE=Release ..
|
||||
- cmake --build .
|
||||
- cd ..
|
||||
- mkdir coverage
|
||||
- cd coverage
|
||||
- cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=OFF -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- cmake --build .
|
||||
- cmake --build . --target coveralls
|
||||
install: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- CODECOV_TOKEN=$COVERALLS_REPO_TOKEN
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@ -14,3 +26,5 @@ addons:
|
||||
packages:
|
||||
- cmake
|
||||
- cmake-data
|
||||
- lcov
|
||||
- curl
|
||||
|
||||
BIN
data/bad_apple_2.nes
Normal file
BIN
data/bad_apple_2.nes
Normal file
Binary file not shown.
@ -64,8 +64,9 @@ if (USE_PROFILING)
|
||||
endif (USE_PROFILING)
|
||||
|
||||
if (COVERALLS)
|
||||
include(Coveralls)
|
||||
coveralls_turn_on_coverage()
|
||||
add_definitions (-DRUN_COVERAGE)
|
||||
include(Coveralls)
|
||||
coveralls_turn_on_coverage()
|
||||
endif()
|
||||
|
||||
include_directories(include)
|
||||
@ -101,3 +102,4 @@ endif()
|
||||
|
||||
add_executable(tines main.c paddle.c NESCarts.c)
|
||||
target_link_libraries(tines apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${PTHREADLIB})
|
||||
add_test(tines_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/tines ${PROJECT_SOURCE_DIR}/data/bad_apple_2.nes)
|
||||
|
||||
@ -57,7 +57,7 @@ int LoadCart(const char *filename, NesCart * cart)
|
||||
cart->File = (byte *)LoadFilePtr((char *)filename);
|
||||
|
||||
|
||||
if ((cart->File == NULL) || ((int)cart->File == -1))
|
||||
if (cart->File == NULL)
|
||||
return -1;
|
||||
|
||||
sprintf(buffer, "%c%c%c%c", 0x4E, 0x45, 0x53, 0x1A);
|
||||
|
||||
35
src/main.c
35
src/main.c
@ -150,7 +150,7 @@ void SaveSaveRam(char *name)
|
||||
FILE *fp;
|
||||
int i;
|
||||
char fname[512];
|
||||
int ret;
|
||||
|
||||
strcpy(fname, name);
|
||||
strcat(fname, ".svt");
|
||||
if ((fp = fopen(fname, "wb")))
|
||||
@ -158,7 +158,7 @@ void SaveSaveRam(char *name)
|
||||
console_printf(Console_Default, "Saving savestate '%s'\n", fname);
|
||||
for( i = 0x60; i < 0x80; i++)
|
||||
{
|
||||
ret = fwrite(get_page_ptr(i), 1, 0x100, fp);
|
||||
fwrite(get_page_ptr(i), 1, 0x100, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@ -170,7 +170,7 @@ void LoadSaveRam(char *name)
|
||||
FILE *fp;
|
||||
int i;
|
||||
char fname[512];
|
||||
int ret;
|
||||
|
||||
strcpy(fname, name);
|
||||
strcat(fname, ".svt");
|
||||
if ((fp = fopen(fname, "rb")))
|
||||
@ -178,7 +178,7 @@ void LoadSaveRam(char *name)
|
||||
console_printf(Console_Default, "Loading savestate '%s'\n", fname);
|
||||
for( i = 0x60; i < 0x80; i++)
|
||||
{
|
||||
ret = fread(get_page_ptr(i), 1, 0x0100, fp);
|
||||
fread(get_page_ptr(i), 1, 0x0100, fp);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
@ -189,7 +189,6 @@ void LoadSaveRam(char *name)
|
||||
void LoadPalette(char *filename, Palette *pal)
|
||||
{
|
||||
FILE *fp;
|
||||
int ret;
|
||||
unsigned char r, v, b, i;
|
||||
console_printf(Console_Default, "%s: try to load pallette file '%s'", __func__, filename);
|
||||
if ((fp = fopen(filename, "rb")) != NULL)
|
||||
@ -198,9 +197,9 @@ void LoadPalette(char *filename, Palette *pal)
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
|
||||
ret = fread(&r, 1, 1, fp);
|
||||
ret = fread(&v, 1, 1, fp);
|
||||
ret = fread(&b, 1, 1, fp);
|
||||
fread(&r, 1, 1, fp);
|
||||
fread(&v, 1, 1, fp);
|
||||
fread(&b, 1, 1, fp);
|
||||
|
||||
/* r = (r * 64) / 255;
|
||||
v = (v * 64) / 255;
|
||||
@ -258,12 +257,20 @@ void LoadPalette(char *filename, Palette *pal)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RUN_COVERAGE
|
||||
void alarmHandler(int sig)
|
||||
{
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
WantClosing = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void signalhandler(int sig)
|
||||
{
|
||||
static int state=0;
|
||||
|
||||
char name[512];
|
||||
|
||||
|
||||
static FILE *fp = NULL;
|
||||
sprintf(name, "crashdump-%d.txt", (int)time(NULL));
|
||||
if (state != 0)
|
||||
@ -643,7 +650,11 @@ int main(int argc, char *argv[])
|
||||
console_printf(Console_Default, "S");
|
||||
signal(SIGTERM, signalhandler);
|
||||
console_printf(Console_Default, "T]\n");
|
||||
|
||||
|
||||
#ifdef RUN_COVERAGE
|
||||
signal(SIGALRM, alarmHandler);
|
||||
#endif
|
||||
|
||||
/* */
|
||||
console_printf(Console_Default, "Initialize memory...\t\t");
|
||||
InitMemory();
|
||||
@ -957,6 +968,10 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
|
||||
gettimeofday(&timeStart, NULL);
|
||||
|
||||
#ifdef RUN_COVERAGE
|
||||
alarm(1 * 60); /* Run for 1 minutes */
|
||||
#endif
|
||||
|
||||
while(!WantClosing)
|
||||
{
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
# $Revision$
|
||||
|
||||
if (COVERALLS)
|
||||
set(COVERAGE_SRCS src/os/unix/loadfile.c src/os/unix/graphics.c src/os/unix/sound.c src/os/unix/io.c ${COVERAGE_SRCS} PARENT_SCOPE)
|
||||
set(COVERAGE_SRCS src/os/unix/loadfile.c src/os/unix/graphics_dummy.c src/os/unix/sound.c src/os/unix/io.c ${COVERAGE_SRCS} PARENT_SCOPE)
|
||||
add_library(oslib loadfile.c graphics_dummy.c sound.c io.c)
|
||||
else()
|
||||
add_library(oslib loadfile.c graphics.c sound.c io.c)
|
||||
endif()
|
||||
|
||||
|
||||
add_library(oslib loadfile.c graphics.c sound.c io.c)
|
||||
|
||||
target_link_libraries(oslib glfw ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
|
||||
|
||||
138
src/os/unix/graphics_dummy.c
Normal file
138
src/os/unix/graphics_dummy.c
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Graphic Manager - The TI-NESulator Project
|
||||
* os/macos/graphics.c
|
||||
*
|
||||
* Created by Manoel TRAPIER on 08/05/08.
|
||||
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
|
||||
*
|
||||
* $LastChangedDate$
|
||||
* $Author$
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
*
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <os_dependent.h>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
//#include <OpenGL/glext.h>
|
||||
|
||||
#include <palette.h>
|
||||
|
||||
typedef struct GLWindow_t GLWindow;
|
||||
|
||||
struct KeyArray
|
||||
{
|
||||
unsigned char lastState;
|
||||
unsigned char curState;
|
||||
unsigned char debounced;
|
||||
GLFWwindow* window;
|
||||
};
|
||||
|
||||
struct GLWindow_t
|
||||
{
|
||||
struct KeyArray keyArray[512];
|
||||
GLFWwindow* windows;
|
||||
unsigned char *videoMemory;
|
||||
GLint videoTexture;
|
||||
int WIDTH;
|
||||
int HEIGHT;
|
||||
};
|
||||
|
||||
#ifndef GL_TEXTURE_RECTANGLE_EXT
|
||||
#define GL_TEXTURE_RECTANGLE_EXT GL_TEXTURE_RECTANGLE_NV
|
||||
#endif
|
||||
|
||||
void GLWindowInitEx(GLWindow *g, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
void GLWindowInit(GLWindow *g)
|
||||
{
|
||||
}
|
||||
|
||||
void ShowScreen(GLWindow *g, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
void setupGL(GLWindow *g, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
void restoreGL(GLWindow *g, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
void kbHandler(GLFWwindow* window, int key, int scan, int action, int mod )
|
||||
{
|
||||
}
|
||||
|
||||
void sizeHandler(GLFWwindow* window,int xs,int ys)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void initDisplay(GLWindow *g)
|
||||
{
|
||||
}
|
||||
|
||||
void drawPixel(GLWindow *gw, int x, int y, uint32_t colour)
|
||||
{
|
||||
}
|
||||
|
||||
void drawLine(GLWindow *g, int x0, int y0, int x1, int y1, uint32_t colour)
|
||||
{
|
||||
}
|
||||
|
||||
void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
|
||||
{
|
||||
}
|
||||
|
||||
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
|
||||
{
|
||||
}
|
||||
|
||||
void drawFillrect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
|
||||
{
|
||||
}
|
||||
|
||||
void clearScreen(GLWindow *g)
|
||||
{
|
||||
}
|
||||
|
||||
void updateScreen(GLWindow *g)
|
||||
{
|
||||
}
|
||||
|
||||
void updateScreenAndWait(GLWindow *g)
|
||||
{
|
||||
}
|
||||
|
||||
int graphics_init()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int graphics_drawpixel(long x, long y, long color)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int graphics_drawline(long x, long y, long x1, long y1, long color)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int graphics_blit(long x, long y, long w, long h)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getKeyStatus(int key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -40,11 +40,10 @@ int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
|
||||
|
||||
int console_printf(const ConsoleLevel level, const char *format, ...)
|
||||
{
|
||||
int ret = 0;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
ret = console_vprintf(level, format, ap);
|
||||
console_vprintf(level, format, ap);
|
||||
|
||||
va_end(ap);
|
||||
return 0;
|
||||
@ -58,4 +57,4 @@ int console_printf_d(const char *format, ...)
|
||||
console_vprintf (Console_Debug, format, ap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,5 +30,10 @@ void *LoadFilePtr(char * filename)
|
||||
|
||||
close(fd);
|
||||
|
||||
if ( RetPtr == MAP_FAILED )
|
||||
{
|
||||
RetPtr = NULL;
|
||||
}
|
||||
|
||||
return RetPtr;
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
|
||||
extern int VBLANK_TIME;
|
||||
|
||||
volatile extern int frame;
|
||||
volatile extern unsigned long IPS, FPS;
|
||||
extern volatile int frame;
|
||||
extern volatile unsigned long IPS, FPS;
|
||||
|
||||
extern unsigned long ColorPalette[9 * 63];
|
||||
extern short IRQScanHit;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user