[infiniband] Retrieve GID flag from cached path entries
[ipxe.git] / src / tests / pixbuf_test.h
1 #ifndef _PIXBUF_TEST_H
2 #define _PIXBUF_TEST_H
3
4 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5
6 #include <stdint.h>
7 #include <ipxe/refcnt.h>
8 #include <ipxe/image.h>
9 #include <ipxe/test.h>
10
11 /** A pixel buffer test */
12 struct pixel_buffer_test {
13 /** Image type */
14 struct image_type *type;
15 /** Source image */
16 struct image *image;
17 /** Pixel data */
18 const uint32_t *data;
19 /** Length of pixel data */
20 size_t len;
21 /** Width */
22 unsigned int width;
23 /** Height */
24 unsigned int height;
25 };
26
27 /**
28 * Define a pixel buffer test
29 *
30 * @v _name Test name
31 * @v _type Test image file type
32 * @v _file Test image file data
33 * @v _width Expected pixel buffer width
34 * @v _height Expected pixel buffer height
35 * @v _data Expected pixel buffer data
36 * @ret test Pixel buffer test
37 */
38 #define PIX( _name, _type, _file, _width, _height, _data ) \
39 static const char _name ## __file[] = _file; \
40 static const uint32_t _name ## __data[] = _data; \
41 static struct image _name ## __image = { \
42 .refcnt = REF_INIT ( ref_no_free ), \
43 .name = #_name, \
44 .data = ( userptr_t ) ( _name ## __file ), \
45 .len = sizeof ( _name ## __file ), \
46 }; \
47 static struct pixel_buffer_test _name = { \
48 .type = _type, \
49 .image = & _name ## __image, \
50 .data = _name ## __data, \
51 .len = sizeof ( _name ## __data ), \
52 .width = _width, \
53 .height = _height, \
54 };
55
56 extern void pixbuf_okx ( struct pixel_buffer_test *test, const char *file,
57 unsigned int line );
58
59 /**
60 * Report pixel buffer test result
61 *
62 * @v test Pixel buffer test
63 */
64 #define pixbuf_ok( test ) pixbuf_okx ( test, __FILE__, __LINE__ )
65
66 #endif /* _PIXBUF_TEST_H */