diff options
Diffstat (limited to 'recipes-sota/aktualizr')
-rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 34 | ||||
-rwxr-xr-x | recipes-sota/aktualizr/files/run-ptest | 16 |
2 files changed, 47 insertions, 3 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 97f784f..49c4e5e 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -6,10 +6,13 @@ LICENSE = "MPL-2.0" | |||
6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" | 6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" |
7 | 7 | ||
8 | DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" | 8 | DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" |
9 | DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native ostree-native aktualizr-native ', '', d)}" | ||
9 | RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" | 10 | RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" |
10 | RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" | 11 | RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" |
11 | RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" | 12 | RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" |
12 | 13 | ||
14 | RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules sqlite3 valgrind" | ||
15 | |||
13 | PV = "1.0+git${SRCPV}" | 16 | PV = "1.0+git${SRCPV}" |
14 | PR = "7" | 17 | PR = "7" |
15 | 18 | ||
@@ -17,6 +20,7 @@ GARAGE_SIGN_PV = "0.6.0-3-gc38b9f3" | |||
17 | 20 | ||
18 | SRC_URI = " \ | 21 | SRC_URI = " \ |
19 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ | 22 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ |
23 | file://run-ptest \ | ||
20 | file://aktualizr.service \ | 24 | file://aktualizr.service \ |
21 | file://aktualizr-secondary.service \ | 25 | file://aktualizr-secondary.service \ |
22 | file://aktualizr-secondary.socket \ | 26 | file://aktualizr-secondary.socket \ |
@@ -28,18 +32,22 @@ SRC_URI = " \ | |||
28 | SRC_URI[md5sum] = "30d7f0931e2236954679e75d1bae174f" | 32 | SRC_URI[md5sum] = "30d7f0931e2236954679e75d1bae174f" |
29 | SRC_URI[sha256sum] = "46d8c6448ce14cbb9af6a93eba7e29d38579e566dcd6518d22f723a8da16cad5" | 33 | SRC_URI[sha256sum] = "46d8c6448ce14cbb9af6a93eba7e29d38579e566dcd6518d22f723a8da16cad5" |
30 | 34 | ||
31 | SRCREV = "ea03a5cf57def6b8d368f783cb12b91255365a80" | 35 | SRCREV = "2e3ccbbdd43fdf70eb815454ea64f0bd8085856c" |
32 | BRANCH ?= "master" | 36 | BRANCH ?= "master" |
33 | 37 | ||
34 | S = "${WORKDIR}/git" | 38 | S = "${WORKDIR}/git" |
35 | 39 | ||
36 | inherit pkgconfig cmake systemd | 40 | inherit cmake pkgconfig ptest systemd |
41 | |||
42 | # disable ptest by default as it slows down builds quite a lot | ||
43 | # can be enabled manually by setting 'PTEST_ENABLED_pn-aktualizr' to '1' in local.conf | ||
44 | PTEST_ENABLED = "0" | ||
37 | 45 | ||
38 | SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" | 46 | SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" |
39 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" | 47 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" |
40 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" | 48 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" |
41 | 49 | ||
42 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" | 50 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}" |
43 | 51 | ||
44 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" | 52 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" |
45 | 53 | ||
@@ -54,6 +62,26 @@ PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," | |||
54 | PACKAGECONFIG[serialcan] = ",,,slcand-start" | 62 | PACKAGECONFIG[serialcan] = ",,,slcand-start" |
55 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" | 63 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" |
56 | 64 | ||
65 | do_compile_ptest() { | ||
66 | cmake_runcmake_build --target build_tests | ||
67 | } | ||
68 | |||
69 | do_install_ptest() { | ||
70 | # copy the complete source directory (contains build) | ||
71 | cp -r ${B}/ ${D}/${PTEST_PATH}/build | ||
72 | cp -r ${S}/ ${D}/${PTEST_PATH}/src | ||
73 | |||
74 | # remove huge external unused repository | ||
75 | rm -rf ${D}/${PTEST_PATH}/src/partial/extern/RIOT | ||
76 | |||
77 | # remove huge build artifacts | ||
78 | find ${D}/${PTEST_PATH}/build/src -name "*.a" -delete | ||
79 | |||
80 | # fix the absolute paths | ||
81 | find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf | ||
82 | find ${D}/${PTEST_PATH}/build -name "*.cmake" -or -name "DartConfiguration.tcl" -or -name "run-valgrind" | xargs sed -e "s|${S}|${PTEST_PATH}/src|g" -e "s|${B}|${PTEST_PATH}/build|g" -e "s|\"--gtest_output[^\"]*\"||g" -i | ||
83 | } | ||
84 | |||
57 | do_install_append () { | 85 | do_install_append () { |
58 | install -d ${D}${libdir}/sota | 86 | install -d ${D}${libdir}/sota |
59 | install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml | 87 | install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml |
diff --git a/recipes-sota/aktualizr/files/run-ptest b/recipes-sota/aktualizr/files/run-ptest new file mode 100755 index 0000000..e5f0d56 --- /dev/null +++ b/recipes-sota/aktualizr/files/run-ptest | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -e | ||
4 | |||
5 | filter_logs() { | ||
6 | awk '/^.*Test[[:space:]]*#[[:digit:]]+:/ { | ||
7 | a = gensub(/^.*Test[[:space:]]*#[[:digit:]]+:[[:space:]]*([^[:space:]]+).*(Passed|Skipped|Not Run|Failed|Timeout|Exception)[[:space:]:].*$/, "\\2: \\1", "g"); | ||
8 | a = gensub(/^Passed/, "PASS", "g", a); | ||
9 | a = gensub(/^(Skipped|Disabled)/, "SKIP", "g", a); | ||
10 | a = gensub(/^(Not Run|Failed|Timeout|Exception)/, "FAIL", "g", a); | ||
11 | print a; | ||
12 | }' | ||
13 | } | ||
14 | |||
15 | cd build | ||
16 | ctest -j 8 -O /tmp/aktualizr-ptest.log --output-on-failure -LE 'noptest' 2> /dev/null | filter_logs | ||