Skip to content

Commit da5977d

Browse files
author
Staging script
committed
Staging PR 2871
1 parent 59e649c commit da5977d

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

config/runtime/tests/ltp.jinja2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
timeout:
44
minutes: {{ job_timeout|default(15) }}
55
definitions:
6+
{% if "coverage" in node.data.config_full %}
7+
{% include "util/gcov-reset.jinja2" %}
8+
{% endif %}
69
- repository: https://github.com/kernelci/test-definitions
710
from: git
811
revision: kernelci.org
@@ -12,3 +15,6 @@
1215
TST_CMDFILES: "{{ tst_cmdfiles|default('') }}"
1316
SKIP_INSTALL: "{{ skip_install }}"
1417
SKIPFILE: {{ skipfile }}
18+
{% if "coverage" in node.data.config_full %}
19+
{% include "util/gcov-upload.jinja2" %}
20+
{% endif %}

config/runtime/util/gcov-reset.jinja2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- from: inline
2+
repository:
3+
metadata:
4+
format: Lava-Test Test Definition 1.0
5+
name: reset-gcov
6+
description: Reset GCOV data
7+
run:
8+
steps:
9+
- GCOV_RESET="/sys/kernel/debug/gcov/reset"
10+
- if [ -f ${GCOV_RESET} ]; then echo 1 > ${GCOV_RESET}; fi
11+
name: reset-gcov
12+
path: inline/reset-gcov.yaml
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
- from: inline
2+
name: upload
3+
path: inline/upload.yaml
4+
repository:
5+
metadata:
6+
description: GCOV artifacts upload
7+
format: Lava-Test Test Definition 1.0
8+
name: upload
9+
environment:
10+
- lava-test-shell
11+
os:
12+
- debian
13+
run:
14+
steps:
15+
- GCDA=/sys/kernel/debug/gcov
16+
# Bail out if $GCDA doesn't exist (as GCOV is likely not enabled)
17+
- test -d ${GCDA} || exit 0
18+
- TEMPDIR=$(mktemp -d)
19+
- UPLOAD_PATH="{{ node.name }}-{{ node.id }}"
20+
- UPLOAD_NAME="gcov.tar.xz"
21+
# Retrieve GCOV artifacts
22+
# Taken from https://www.kernel.org/doc/html/v6.12/dev-tools/gcov.html#appendix-b-gather-on-test-sh
23+
- find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \;
24+
- find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \;
25+
- find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \;
26+
- tar cJf ${UPLOAD_NAME} -C $TEMPDIR sys
27+
- rm -rf $TEMPDIR
28+
# Use set +x so we can don't echo secret tokens in the logs
29+
- set +x
30+
- . /lava-${LAVA_JOB_ID}/secrets
31+
- >-
32+
lava-test-case "artifact-upload:coverage_data:{{ storage_config.base_url }}/${UPLOAD_PATH}/${UPLOAD_NAME}"
33+
--shell curl -X POST {{ storage_config.base_url }}/upload
34+
-H "Authorization: Bearer ${UPLOAD_TOKEN}"
35+
-F "file0=@${UPLOAD_NAME}"
36+
-F "path=${UPLOAD_PATH}"
37+
38+
secrets:
39+
UPLOAD_TOKEN: {{ storage_config.name }}-token

0 commit comments

Comments
 (0)