From 1712fa4839d373fb0f9ea7d92925a57a9aee4c52 Mon Sep 17 00:00:00 2001 From: Qiu Tingting Date: Wed, 28 Jun 2023 10:53:25 +0800 Subject: kbd: Add ptest support Add a ptest for kbd. It is a backport for https://lists.openembedded.org/g/openembedded-core/topic/patch_v4_kbd_add_ptest/99258821 It should be deleted after yocto version up. SPEC-4753 Signed-off-by: Qiu Tingting Change-Id: I98d0781239f17b01bb9cba3f06a3dfc100fc201f --- meta-agl-test/recipes-core/kbd/files/run-ptest | 12 ++++ meta-agl-test/recipes-core/kbd/kbd_2.4.0.bbappend | 76 +++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 meta-agl-test/recipes-core/kbd/files/run-ptest create mode 100644 meta-agl-test/recipes-core/kbd/kbd_2.4.0.bbappend (limited to 'meta-agl-test/recipes-core') diff --git a/meta-agl-test/recipes-core/kbd/files/run-ptest b/meta-agl-test/recipes-core/kbd/files/run-ptest new file mode 100644 index 00000000..0eab90ea --- /dev/null +++ b/meta-agl-test/recipes-core/kbd/files/run-ptest @@ -0,0 +1,12 @@ +#!/bin/sh + +# Define test work dir +WORKDIR=@PTEST_PATH@/tests/ + +# Run test +cd ${WORKDIR} + +./testsuite -k unittest | sed -e '/[0-9]:/s/://' \ + -e '/ ok/s/^/PASS: /;/ FAILED/s/^/FAIL: /;/ skipped/s/^/SKIP: /' \ + -e '/ ok/s/ ok.*//;/ skipped/s/ skipped.*//;/ FAILED/s/ FAILED.*//' + diff --git a/meta-agl-test/recipes-core/kbd/kbd_2.4.0.bbappend b/meta-agl-test/recipes-core/kbd/kbd_2.4.0.bbappend new file mode 100644 index 00000000..a588bf51 --- /dev/null +++ b/meta-agl-test/recipes-core/kbd/kbd_2.4.0.bbappend @@ -0,0 +1,76 @@ +# Add ptest support +# backport of yocto +# +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://run-ptest \ +" + +inherit ptest + +do_compile_ptest() { + # update DATADIR in Makefile + sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/libkeymap/Makefile + sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/helpers/Makefile + sed -i 's,-DDATADIR=.*,-DDATADIR=\\\"${PTEST_PATH}/tests\\\" \\,g' ${B}/tests/libkbdfile/Makefile + + # unset -D_TIME_BITS=64 in Makefile + sed -i 's,-D_TIME_BITS=64,,g' ${B}/tests/libtswrap/Makefile + + # recompile tests + oe_runmake -C ${B}/tests/ clean + oe_runmake -C ${B}/tests/ +} + +do_install_ptest() { + # install files from build directory + install -d ${D}${PTEST_PATH}/tests/ + install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/ + install --mode=755 ${B}/tests/testsuite ${D}${PTEST_PATH}/tests/ + install -d ${D}${PTEST_PATH}/tests/libkeymap/ + find ${B}/tests/libkeymap/ -type f -not -name "*.o" -not -name "Makefile" \ + -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/libkeymap/ \; + install -d ${D}${PTEST_PATH}/tests/helpers/ + find ${B}/tests/helpers/ -type f -not -name "*.o" -not -name "Makefile" \ + -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/helpers/ \; + install -d ${D}${PTEST_PATH}/tests/libkbdfile/ + find ${B}/tests/libkbdfile/ -type f -not -name "*.o" -not -name "Makefile" \ + -exec install --mode=755 {} ${D}${PTEST_PATH}/tests/libkbdfile/ \; + install -d ${D}${PTEST_PATH}/src/ + install --mode=755 ${B}/src/loadkeys ${D}${PTEST_PATH}/src/ + + # install files from src/data directory + install -d ${D}${PTEST_PATH}/data/keymaps/i386/qwerty/ + install ${S}/data/keymaps/i386/qwerty/defkeymap.map ${D}${PTEST_PATH}/data/keymaps/i386/qwerty/ + + # install files from src/tests/data directory + install -d ${D}${PTEST_PATH}/tests/data/ + install -d ${D}${PTEST_PATH}/tests/data/libkeymap/ + install ${S}/tests/data/libkeymap/* ${D}${PTEST_PATH}/tests/data/libkeymap/ + install -d ${D}${PTEST_PATH}/tests/data/alt-is-meta/ + install ${S}/tests/data/alt-is-meta/* ${D}${PTEST_PATH}/tests/data/alt-is-meta/ + install -d ${D}${PTEST_PATH}/tests/data/bkeymap-2.0.4/ + install ${S}/tests/data/bkeymap-2.0.4/* ${D}${PTEST_PATH}/tests/data/bkeymap-2.0.4/ + install -d ${D}${PTEST_PATH}/tests/data/dumpkeys-mktable/ + install ${S}/tests/data/dumpkeys-mktable/* ${D}${PTEST_PATH}/tests/data/dumpkeys-mktable/ + install -d ${D}${PTEST_PATH}/tests/data/dumpkeys-fulltable/ + install ${S}/tests/data/dumpkeys-fulltable/* ${D}${PTEST_PATH}/tests/data/dumpkeys-fulltable/ + install -d ${D}${PTEST_PATH}/tests/data/findfile/test_1/consolefonts/ + install ${S}/tests/data/findfile/test_1/consolefonts/* ${D}${PTEST_PATH}/tests/data/findfile/test_1/consolefonts/ + install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/include/ + install ${S}/tests/data/findfile/test_0/keymaps/test0.map ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/ + install ${S}/tests/data/findfile/test_0/keymaps/include/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/include/ + install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/include/ + install ${S}/tests/data/findfile/test_0/keymaps/i386/include/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/include/ + install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwerty/ + install ${S}/tests/data/findfile/test_0/keymaps/i386/qwerty/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwerty/ + install -d ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwertz/ + install ${S}/tests/data/findfile/test_0/keymaps/i386/qwertz/* ${D}${PTEST_PATH}/tests/data/findfile/test_0/keymaps/i386/qwertz/ + + + # update PTEST_PATH in run-ptest + sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest + sed -i -e 's,${B},${PTEST_PATH},g' -e 's,/\.\./kbd-2.4.0,,g' ${D}${PTEST_PATH}/tests/atconfig +} + -- cgit 1.2.3-korg