diff options
author | Laurent Bonnans <laurent.bonnans@here.com> | 2019-02-28 14:51:08 +0100 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2019-03-12 11:35:37 +0100 |
commit | 81143ca5802916a5cd3a395ff36e00f8909359bc (patch) | |
tree | 0ef377abc5e3cf45d0cd9a550afecc9632ffadd2 | |
parent | 72ba172d53da21918c10f78a4386dff17f5df92d (diff) | |
download | meta-updater-81143ca5802916a5cd3a395ff36e00f8909359bc.tar.gz |
Add working ptest suite for aktualizr
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
-rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 18 | ||||
-rwxr-xr-x | recipes-sota/aktualizr/files/run-ptest | 16 |
2 files changed, 33 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 8790fe5..9508f96 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -11,6 +11,8 @@ RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" | |||
11 | RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" | 11 | RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" |
12 | 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)}" |
13 | 13 | ||
14 | RDEPENDS_${PN}-ptest += "bash cmake python3-core python3-io python3-json python3-netserver sqlite3 valgrind" | ||
15 | |||
14 | PV = "1.0+git${SRCPV}" | 16 | PV = "1.0+git${SRCPV}" |
15 | PR = "7" | 17 | PR = "7" |
16 | 18 | ||
@@ -18,6 +20,7 @@ GARAGE_SIGN_PV = "0.6.0-3-gc38b9f3" | |||
18 | 20 | ||
19 | SRC_URI = " \ | 21 | SRC_URI = " \ |
20 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ | 22 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ |
23 | file://run-ptest \ | ||
21 | file://aktualizr.service \ | 24 | file://aktualizr.service \ |
22 | file://aktualizr-secondary.service \ | 25 | file://aktualizr-secondary.service \ |
23 | file://aktualizr-secondary.socket \ | 26 | file://aktualizr-secondary.socket \ |
@@ -40,7 +43,7 @@ SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" | |||
40 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" | 43 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" |
41 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" | 44 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" |
42 | 45 | ||
43 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" | 46 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}" |
44 | 47 | ||
45 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" | 48 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" |
46 | 49 | ||
@@ -59,6 +62,19 @@ do_compile_ptest() { | |||
59 | cmake_runcmake_build --target build_tests | 62 | cmake_runcmake_build --target build_tests |
60 | } | 63 | } |
61 | 64 | ||
65 | do_install_ptest() { | ||
66 | # copy the complete source directory (contains build) | ||
67 | cp -r ${B}/ ${D}/${PTEST_PATH}/build | ||
68 | cp -r ${S}/ ${D}/${PTEST_PATH}/src | ||
69 | |||
70 | # remove bogus elf file | ||
71 | rm ${D}/${PTEST_PATH}/src/partial/extern/RIOT/cpu/esp32/bin/bootloader.elf | ||
72 | |||
73 | # fix the absolute paths | ||
74 | find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf | ||
75 | 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 | ||
76 | } | ||
77 | |||
62 | do_install_append () { | 78 | do_install_append () { |
63 | install -d ${D}${libdir}/sota | 79 | install -d ${D}${libdir}/sota |
64 | install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml | 80 | 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 | ||