Commit 2f36c321 authored by Ian Romanick's avatar Ian Romanick

util: Simple framework for tests

This framework is a little experimental.  It just tires to encapsulate
a lot of boiler plate things that all tests do to start up.
parent dce1e457
...@@ -8,4 +8,5 @@ include_directories( ...@@ -8,4 +8,5 @@ include_directories(
add_library (piglitutil add_library (piglitutil
piglit-util.c piglit-util.c
shader-load.c shader-load.c
piglit-framework.c
) )
/*
* Copyright © 2009 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/**
* Simple test case framework.
*
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#if defined(__APPLE__)
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include "piglit-util.h"
#include "piglit-framework.h"
int piglit_Automatic = 0;
static void
display(void)
{
const int result = piglit_Display();
if (piglit_Automatic)
piglit_report_result(result);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
if (argc >= 2 && !strcmp(argv[1], "-auto"))
piglit_Automatic = 1;
glutInitWindowPosition(0, 0);
glutInitWindowSize(piglit_Width, piglit_Height);
glutInitDisplayMode(piglit_WindowMode);
glutCreateWindow(argv[0]);
glutDisplayFunc(display);
glutKeyboardFunc(piglit_escape_exit_key);
glewInit();
piglit_Init(argc, argv);
glutMainLoop();
return 0;
}
/*
* Copyright © 2009 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
extern int piglit_Automatic;
extern int piglit_WindowMode;
extern int piglit_Width;
extern int piglit_Height;
extern int piglit_Display(void);
extern void piglit_Init(int argc, char **argv);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment