Commit 353dfaaa authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Rodrigo Vivi

drm/xe: Fix kunit integration due to missing prototypes

In order to avoid  -Werror=missing-prototypes, add the prototypes
in a separate tests/<test-name>_test.h file that is included by both
the implementation (tests/xe_<testname>.c, injected in xe.ko) and the
kunit module (tests/xe_<testname>_test.c -> xe-<testname>-test.ko).

v2: Add header and don't add ifdef to files that are already not built
when not using kunit (Matt Auld)
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 5b7e50e2
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <kunit/test.h> #include <kunit/test.h>
#include "tests/xe_bo_test.h"
#include "xe_bo_evict.h" #include "xe_bo_evict.h"
#include "xe_pci.h" #include "xe_pci.h"
......
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
* Copyright © 2022 Intel Corporation * Copyright © 2022 Intel Corporation
*/ */
#include <kunit/test.h> #include "xe_bo_test.h"
void xe_ccs_migrate_kunit(struct kunit *test); #include <kunit/test.h>
void xe_bo_evict_kunit(struct kunit *test);
static struct kunit_case xe_bo_tests[] = { static struct kunit_case xe_bo_tests[] = {
KUNIT_CASE(xe_ccs_migrate_kunit), KUNIT_CASE(xe_ccs_migrate_kunit),
......
/* SPDX-License-Identifier: GPL-2.0 AND MIT */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef __XE_BO_TEST_H__
#define __XE_BO_TEST_H__
struct kunit;
void xe_ccs_migrate_kunit(struct kunit *test);
void xe_bo_evict_kunit(struct kunit *test);
#endif
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <kunit/test.h> #include <kunit/test.h>
#include "tests/xe_dma_buf_test.h"
#include "xe_pci.h" #include "xe_pci.h"
static bool p2p_enabled(struct dma_buf_test_params *params) static bool p2p_enabled(struct dma_buf_test_params *params)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* Copyright © 2022 Intel Corporation * Copyright © 2022 Intel Corporation
*/ */
#include <kunit/test.h> #include "xe_dma_buf_test.h"
void xe_dma_buf_kunit(struct kunit *test); #include <kunit/test.h>
static struct kunit_case xe_dma_buf_tests[] = { static struct kunit_case xe_dma_buf_tests[] = {
KUNIT_CASE(xe_dma_buf_kunit), KUNIT_CASE(xe_dma_buf_kunit),
......
/* SPDX-License-Identifier: GPL-2.0 AND MIT */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef __XE_DMA_BUF_TEST_H__
#define __XE_DMA_BUF_TEST_H__
struct kunit;
void xe_dma_buf_kunit(struct kunit *test);
#endif
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <kunit/test.h> #include <kunit/test.h>
#include "tests/xe_migrate_test.h"
#include "xe_pci.h" #include "xe_pci.h"
static bool sanity_fence_failed(struct xe_device *xe, struct dma_fence *fence, static bool sanity_fence_failed(struct xe_device *xe, struct dma_fence *fence,
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* Copyright © 2022 Intel Corporation * Copyright © 2022 Intel Corporation
*/ */
#include <kunit/test.h> #include "xe_migrate_test.h"
void xe_migrate_sanity_kunit(struct kunit *test); #include <kunit/test.h>
static struct kunit_case xe_migrate_tests[] = { static struct kunit_case xe_migrate_tests[] = {
KUNIT_CASE(xe_migrate_sanity_kunit), KUNIT_CASE(xe_migrate_sanity_kunit),
......
/* SPDX-License-Identifier: GPL-2.0 AND MIT */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef __XE_MIGRATE_TEST_H__
#define __XE_MIGRATE_TEST_H__
struct kunit;
void xe_migrate_sanity_kunit(struct kunit *test);
#endif
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