Skip to content

build: make tests optional

Simon Zeni requested to merge bl4ckb0ne/drm:tests-optional into main

Building the project as a meson subproject, meson inherits the warning level from the parent project. Making the tests optional bypasses that issue and reduces build time.

The second commit fixes the two errors encountered when compiling as a subproject with warning_level=2 and werror=true. I don't mind dropping it if its deemed not relevant.

Here's the compilation log

ninja: job failed: cc -Isubprojects/libdrm/tests/util/libutil.a.p -Isubprojects/libdrm/tests/util -I../subprojects/libdrm/tests/util -Isubprojects/libdrm -I../subprojects/libdrm -I../subprojects/libdrm/include/drm -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O0 -g -include subprojects/libdrm/config.h -fPIC -MD -MQ subprojects/libdrm/tests/util/libutil.a.p/format.c.o -MF subprojects/libdrm/tests/util/libutil.a.p/format.c.o.d -o subprojects/libdrm/tests/util/libutil.a.p/format.c.o -c ../subprojects/libdrm/tests/util/format.c
../subprojects/libdrm/tests/util/format.c:43:9: error: missing initializer for field 'rgb' of 'const struct util_format_info' [-Werror=missing-field-initializers]
   43 |         { DRM_FORMAT_C8, "C8" },
      |         ^
In file included from ../subprojects/libdrm/tests/util/format.c:33:
../subprojects/libdrm/tests/util/format.h:58:36: note: 'rgb' declared here
   58 |         const struct util_rgb_info rgb;
      |                                    ^~~
cc1: all warnings being treated as errors
ninja: job failed: cc -Isubprojects/libdrm/tests/util/libutil.a.p -Isubprojects/libdrm/tests/util -I../subprojects/libdrm/tests/util -Isubprojects/libdrm -I../subprojects/libdrm -I../subprojects/libdrm/include/drm -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O0 -g -include subprojects/libdrm/config.h -fPIC -MD -MQ subprojects/libdrm/tests/util/libutil.a.p/pattern.c.o -MF subprojects/libdrm/tests/util/libutil.a.p/pattern.c.o.d -o subprojects/libdrm/tests/util/libutil.a.p/pattern.c.o -c ../subprojects/libdrm/tests/util/pattern.c
../subprojects/libdrm/tests/util/pattern.c: In function 'make_pwetty':
../subprojects/libdrm/tests/util/pattern.c:772:31: error: unused parameter 'data' [-Werror=unused-parameter]
  772 | static void make_pwetty(void *data, unsigned int width, unsigned int height,
      |                         ~~~~~~^~~~
../subprojects/libdrm/tests/util/pattern.c:772:50: error: unused parameter 'width' [-Werror=unused-parameter]
  772 | static void make_pwetty(void *data, unsigned int width, unsigned int height,
      |                                     ~~~~~~~~~~~~~^~~~~
../subprojects/libdrm/tests/util/pattern.c:772:70: error: unused parameter 'height' [-Werror=unused-parameter]
  772 | static void make_pwetty(void *data, unsigned int width, unsigned int height,
      |                                                         ~~~~~~~~~~~~~^~~~~~
../subprojects/libdrm/tests/util/pattern.c:773:38: error: unused parameter 'stride' [-Werror=unused-parameter]
  773 |                         unsigned int stride, uint32_t format)
      |                         ~~~~~~~~~~~~~^~~~~~
../subprojects/libdrm/tests/util/pattern.c:773:55: error: unused parameter 'format' [-Werror=unused-parameter]
  773 |                         unsigned int stride, uint32_t format)
      |                                              ~~~~~~~~~^~~~~~
cc1: all warnings being treated as errors

Merge request reports

Loading