mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 01:16:18 +00:00
tests: install test programs to libexec
Install the test programs by default so that they can be packaged. Tested with the testdisplay test so that it still runs after the modifications as it depends on a data file to be present. Need to pass -r option to enable QR code display on success (PNG data file). Packaging is useful when building a complete software stack for a DUT from scratch. This should bring us closer to achieving a built-from-scratch testing workflow. Package maintainers can always decide to ignore the installed files. v2: - Install more tests including scripts and their data v3: - Add clarification to commit message about why we do this. (Chris Wilson & Thomas Wood) - Change libexec into pkglibexec to comply to standard (Thomas Wood) - Do not install $(common_files). (Thomas Wood) - Make it really obvious the installed files are tests by using tests directory name to avoid any confusion with packagers. v4: - Fixed commit message. v5: - Add file locator helper to retain backwards compatibility. (Thomas Wood) - Test with testdisplay -r option that draws the .png file. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
590e47c94f
commit
a95033fdbc
@ -54,6 +54,7 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "drmtest.h"
|
||||
#include "intel_chipset.h"
|
||||
@ -1735,3 +1736,18 @@ void igt_set_timeout(unsigned int seconds)
|
||||
|
||||
alarm(seconds);
|
||||
}
|
||||
|
||||
FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
|
||||
const char* filename)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
FILE *fp;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", igt_datadir, filename);
|
||||
fp = fopen(path, "r");
|
||||
if (!fp) {
|
||||
snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
|
||||
fp = fopen(path, "r");
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <setjmp.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
@ -650,4 +651,16 @@ extern enum igt_log_level igt_log_level;
|
||||
|
||||
void igt_set_timeout(unsigned int seconds);
|
||||
|
||||
FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
|
||||
const char* filename);
|
||||
/**
|
||||
* igt_fopen_data:
|
||||
* @filename: filename to open.
|
||||
*
|
||||
* Open a datafile for test, first try from installation directory
|
||||
* then from build directory.
|
||||
*/
|
||||
#define igt_fopen_data(filename) \
|
||||
__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
|
||||
|
||||
#endif /* IGT_CORE_H */
|
||||
|
@ -27,8 +27,23 @@ multi-tests.txt: Makefile.sources
|
||||
@echo ${multi_kernel_tests} >> $@
|
||||
@echo END TESTLIST >> $@
|
||||
|
||||
EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG)
|
||||
EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_files)
|
||||
igt_tests_bin_PROGRAMS += \
|
||||
$(TESTS_progs) \
|
||||
$(TESTS_progs_M) \
|
||||
$(NULL)
|
||||
|
||||
igt_tests_bin_SCRIPTS += \
|
||||
$(TESTS_scripts) \
|
||||
$(TESTS_scripts_M) \
|
||||
$(scripts) \
|
||||
$(NULL)
|
||||
|
||||
igt_tests_data_DATA += \
|
||||
$(IMAGES) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_PROGRAMS = $(HANG)
|
||||
EXTRA_DIST = $(common_files)
|
||||
|
||||
CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
|
||||
|
||||
@ -36,7 +51,8 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
|
||||
-I$(srcdir)/.. \
|
||||
-I$(srcdir)/../lib \
|
||||
-include "$(srcdir)/../lib/check-ndebug.h" \
|
||||
-DIGT_DATADIR=\""$(abs_srcdir)"\" \
|
||||
-DIGT_SRCDIR=\""$(abs_srcdir)"\" \
|
||||
-DIGT_DATADIR=\""$(igt_tests_datadir)"\" \
|
||||
$(LIBUNWIND_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -1,10 +1,22 @@
|
||||
igt_tests_bindir = $(pkglibexecdir)/tests
|
||||
igt_tests_datadir = $(pkgdatadir)/tests
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
$(HANG) \
|
||||
$(TESTS_testsuite) \
|
||||
$(NULL)
|
||||
|
||||
igt_tests_bin_PROGRAMS = \
|
||||
gem_alive \
|
||||
gem_stress \
|
||||
$(TESTS_progs) \
|
||||
$(TESTS_progs_M) \
|
||||
$(HANG) \
|
||||
$(TESTS_testsuite) \
|
||||
$(NULL)
|
||||
|
||||
igt_tests_bin_SCRIPTS = \
|
||||
$(NULL)
|
||||
|
||||
igt_tests_data_DATA = \
|
||||
$(NULL)
|
||||
|
||||
NOUVEAU_TESTS_M = \
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include "drmtest.h"
|
||||
#include "testdisplay.h"
|
||||
#include "igt_kms.h"
|
||||
#include "igt_core.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
@ -238,12 +239,21 @@ paint_color_key(struct igt_fb *fb_info)
|
||||
munmap(fb_ptr, fb_info->size);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
stdio_read_func(void* closure, unsigned char* data, unsigned int size)
|
||||
{
|
||||
if (fread (data, 1, size, (FILE*)closure) != size)
|
||||
return CAIRO_STATUS_READ_ERROR;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void paint_image(cairo_t *cr, const char *file)
|
||||
{
|
||||
int img_x, img_y, img_w, img_h, img_w_o, img_h_o;
|
||||
double img_w_scale, img_h_scale;
|
||||
|
||||
cairo_surface_t *image;
|
||||
FILE* fp;
|
||||
|
||||
img_y = height * (0.10 );
|
||||
img_h = height * 0.08 * 4;
|
||||
@ -251,7 +261,14 @@ static void paint_image(cairo_t *cr, const char *file)
|
||||
|
||||
img_x = (width / 2) - (img_w / 2);
|
||||
|
||||
image = cairo_image_surface_create_from_png(file);
|
||||
fp = igt_fopen_data(file);
|
||||
if (!fp) {
|
||||
igt_warn("data file \'%s\' missing: %s\n",
|
||||
file, strerror(errno));
|
||||
return;
|
||||
}
|
||||
image = cairo_image_surface_create_from_png_stream(&stdio_read_func,
|
||||
(void*)fp);
|
||||
|
||||
img_w_o = cairo_image_surface_get_width(image);
|
||||
img_h_o = cairo_image_surface_get_height(image);
|
||||
@ -318,7 +335,7 @@ static void paint_output_info(struct connector *c, struct igt_fb *fb)
|
||||
}
|
||||
|
||||
if (qr_code)
|
||||
paint_image(cr, IGT_DATADIR"/pass.png");
|
||||
paint_image(cr, "pass.png");
|
||||
|
||||
igt_assert(!cairo_status(cr));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user