Skip to content

Commit 1dc0260

Browse files
Ever ATILANOkraj
Ever ATILANO
authored andcommitted
meta-oe: recipes-support: dc: Add ptest
Signed-off-by: Ever ATILANO <[email protected]> Signed-off-by: Yoann Congal <[email protected]> Signed-off-by: Khem Raj <[email protected]>
1 parent 74dcb3a commit 1dc0260

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

meta-oe/recipes-support/dc/double-conversion_3.2.1.bb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,32 @@ S = "${WORKDIR}/git"
1010

1111
SRC_URI = " \
1212
git://github.com/google/double-conversion.git;protocol=https;branch=master \
13+
file://run-ptest \
1314
"
1415
SRCREV = "af09fd65fcf24eee95dc62813ba9123414635428"
1516

16-
inherit cmake
17+
inherit cmake ptest
1718

1819
EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON"
20+
21+
# These ptest use ctest (provided by cmake)
22+
RDEPENDS:${PN}-ptest += "cmake"
23+
# Build tests only if ptest is enabled
24+
EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DBUILD_TESTING=ON', '', d)}"
25+
26+
do_install_ptest() {
27+
install -d ${D}${PTEST_PATH}/test
28+
cp -rf ${B}/test ${D}${PTEST_PATH}
29+
install -m 0644 ${B}/CTestTestfile.cmake ${D}${PTEST_PATH}/
30+
files="
31+
CTestTestfile.cmake
32+
test/CTestTestfile.cmake
33+
test/cmake_install.cmake
34+
test/cctest/CTestTestfile.cmake
35+
test/cctest/cmake_install.cmake
36+
"
37+
for file in $files; do
38+
sed -i -e "s|${B}|${PTEST_PATH}|g" -e "s|${S}|${PTEST_PATH}|g" -e "s|${WORKDIR}/recipe-sysroot-native||g" "${D}${PTEST_PATH}/${file}"
39+
done
40+
41+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
# This script runs tests taken from the github CI for the Double-Conversion library.
4+
# For more information, please see: https://github.com/google/double-conversion/blob/master/.github/workflows/ci.yml#L60
5+
6+
# Count the number of failed tests
7+
NUM_FAILS=0
8+
9+
# Run all tests using ctest
10+
ctest -V
11+
12+
# VCount the number of failed tests by checking the LastTest.log file generated by ctest
13+
NUM_FAILS=$(grep -c "Failed" Testing/Temporary/LastTest.log)
14+
15+
# Run the tests directly as well, just in case we forgot to add it to ctest
16+
test/cctest/cctest
17+
if [ $? -ne 0 ]; then
18+
# If the test failed, increment the number of failed tests
19+
NUM_FAILS=$(expr $NUM_FAILS + 1)
20+
fi
21+
22+
# Return the number of failed tests
23+
exit $NUM_FAILS

0 commit comments

Comments
 (0)