-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to run kunit-tests for evdi module
Run ./ci/run_kunit to execute unit tests for evdi module
- Loading branch information
1 parent
c27c9b7
commit 9884501
Showing
8 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /usr/bin/env bash | ||
# Copyright (c) 2024 DisplayLink (UK) Ltd. | ||
|
||
set -e | ||
set -u | ||
|
||
clone_linux() | ||
{ | ||
echo "Clone linux repository" | ||
local linux_mirror="https://oauth2:glpat-jeZZawHtkoZ3xLHWGCJQ@gitlab/ppd_posix/linux.git" | ||
if curl -k --output /dev/null --silent --head --fail "$linux_mirror"; then | ||
git -c http.sslVerify=false clone --depth 1 "$linux_mirror" | ||
(cd linux; git config http.sslVerify false) | ||
else | ||
git clone --depth 1 https://github.com/torvalds/linux | ||
fi | ||
} | ||
|
||
patch_linux_with_evdi_module() | ||
{ | ||
local EVDI_REPO_DIR="$1" | ||
local LINUX_DIR="$2" | ||
|
||
[ -f "$LINUX_DIR/drivers/gpu/drm/evdi/Kconfig" ] && return | ||
|
||
(cd "$LINUX_DIR" | ||
ln -s -T "${EVDI_REPO_DIR}"/module drivers/gpu/drm/evdi | ||
echo -e "\nsource \"drivers/gpu/drm/evdi/Kconfig\"" >> drivers/gpu/drm/Kconfig | ||
echo "obj-\$(CONFIG_DRM_EVDI) += evdi/" >> drivers/gpu/drm/Makefile | ||
|
||
make ARCH=um mrproper) | ||
} | ||
|
||
EVDI_REPO_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd) | ||
LINUX_DIR=$EVDI_REPO_DIR/tmp/linux | ||
mkdir -p "$EVDI_REPO_DIR/tmp" | ||
[ -d "${EVDI_REPO_DIR}"/tmp/linux ] || (cd "$EVDI_REPO_DIR/tmp"; clone_linux) | ||
|
||
patch_linux_with_evdi_module "$EVDI_REPO_DIR" "$LINUX_DIR" | ||
|
||
echo "Run kunit tests for evdi module" | ||
(cd "${LINUX_DIR}" | ||
./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/evdi/tests/.kunitconfig) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CONFIG_KUNIT=y | ||
|
||
CONFIG_DRM=y | ||
CONFIG_MODULES=y | ||
CONFIG_DRM_EVDI=y | ||
|
||
CONFIG_DRM_KUNIT_TEST=y | ||
CONFIG_DRM_EVDI_KUNIT_TEST=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
ccflags-$(CONFIG_DRM_EVDI_KUNIT_TEST) += -I $(srctree)/$(src)/.. | ||
obj-$(CONFIG_DRM_EVDI_KUNIT_TEST) += evdi_test.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Copyright (c) 2024 DisplayLink (UK) Ltd. | ||
* | ||
* This file is subject to the terms and conditions of the GNU General Public | ||
* License v2. See the file COPYING in the main directory of this archive for | ||
* more details. | ||
*/ | ||
|
||
|
||
#include <kunit/test.h> | ||
#include <kunit/device.h> | ||
#include "evdi_drm_drv.h" | ||
|
||
static void test_evdi_create_drm_device(struct kunit *test) | ||
{ | ||
struct device* parent = kunit_device_register(test, "/dev/card1"); | ||
struct drm_device* dev = evdi_drm_device_create(parent); | ||
|
||
KUNIT_EXPECT_NOT_NULL(test, dev); | ||
|
||
evdi_drm_device_remove(dev); | ||
|
||
kunit_device_unregister(test, parent); | ||
} | ||
|
||
static struct kunit_case evdi_test_cases[] = { | ||
KUNIT_CASE(test_evdi_create_drm_device), | ||
{} | ||
}; | ||
|
||
static struct kunit_suite evdi_test_suite = { | ||
.name = "drm_evdi_tests", | ||
.test_cases = evdi_test_cases, | ||
}; | ||
|
||
kunit_test_suite(evdi_test_suite); | ||
|
||
MODULE_LICENSE("GPL"); |
This removal break the build on Gentoo and on Nix... and probably on some other distros.
Context: NixOS/nixpkgs#328219, #476