Skip to content
Snippets Groups Projects
Commit d1b10188 authored by Chase Qi's avatar Chase Qi
Browse files

ci: add oe-selftest gcc test jobs


gcc test suite has been integrated in oe-selftest framework. It allows
to run gcc test against qemu vm and within the build env using qemu
linux-user mode.

These tests can be run in gitlab CI with qemu friendly runners. This
commit add three oe-selftest jobs to run the tests using qemu
linux-user, qemu x86-64 vm and qemu arm64 vm.

Test log and sum files are collected as job artifacts.

When all test jobs finish, report job will be triggered to parse the
sum files to generate results in the format that supported by squad. The
report job will upload results to squad for reporting.

Signed-off-by: default avatarChase Qi <chase.qi@linaro.org>
parent 053b1d44
No related branches found
No related tags found
No related merge requests found
...@@ -550,3 +550,108 @@ build-npm-cspell: ...@@ -550,3 +550,108 @@ build-npm-cspell:
extends: .build-with-kaniko extends: .build-with-kaniko
variables: variables:
CONTAINER_PATH: npm-cspell CONTAINER_PATH: npm-cspell
.oe-selftest-rules:
stage: test
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
# TODO(Chase): remove comment after code review.
# changes:
# - manifests/*.xml
variables:
CI_ONIRO_MANIFEST_URL: "$CI_PROJECT_URL"
CI_ONIRO_MANIFEST_BRANCH: "$CI_COMMIT_REF_NAME"
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(wip|draft):.*/i'
when: manual
variables:
CI_ONIRO_MANIFEST_URL: "$CI_MERGE_REQUEST_SOURCE_PROJECT_URL"
CI_ONIRO_MANIFEST_BRANCH: "$CI_COMMIT_REF_NAME"
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# TODO(Chase): remove comment after code review.
# changes:
# - manifests/*.xml
variables:
CI_ONIRO_MANIFEST_URL: "$CI_MERGE_REQUEST_SOURCE_PROJECT_URL"
CI_ONIRO_MANIFEST_BRANCH: "$CI_COMMIT_REF_NAME"
oe-selftest-gcc-qemu-linux-user:
extends: [.oe-selftest, .oe-selftest-rules]
variables:
CI_ONIRO_OE_SEFLTESTS:
gcc.GccCrossSelfTest
gcc.GccLibAtomicSelfTest
gcc.GccLibGompSelfTest
gcc.GccLibItmSelfTest
gcc.GccLibSspSelfTest
gcc.GccLibStdCxxSelfTest
gcc.GxxCrossSelfTest
.oe-selftest-gcc-system-emulated:
timeout: 8h
extends: [.oe-selftest, .oe-selftest-rules]
variables:
MACHINE: qemux86-64
CI_ONIRO_OE_SEFLTESTS:
gcc.GccCrossSelfTestSystemEmulated
gcc.GccLibAtomicSelfTestSystemEmulated
gcc.GccLibGompSelfTestSystemEmulated
gcc.GccLibItmSelfTestSystemEmulated
gcc.GccLibStdCxxSelfTestSystemEmulated
gcc.GccLibSspSelfTestSystemEmulated
gcc.GxxCrossSelfTestSystemEmulated
oe-selftest-gcc-system-emulated-qemux86-64:
extends: .oe-selftest-gcc-system-emulated
variables:
MACHINE: qemux86-64
oe-selftest-gcc-system-emulated-qemuarm64:
extends: .oe-selftest-gcc-system-emulated
variables:
MACHINE: qemuarm64
oe-selftest-report:
extends: .oe-selftest-rules
image:
name: chaseqi/bitbake-builder:v1.3
stage: report
dependencies:
- oe-selftest-gcc-qemu-linux-user
- oe-selftest-gcc-system-emulated-qemux86-64
- oe-selftest-gcc-system-emulated-qemuarm64
needs:
- oe-selftest-gcc-qemu-linux-user
- oe-selftest-gcc-system-emulated-qemux86-64
- oe-selftest-gcc-system-emulated-qemuarm64
script:
- |
set -x
curl https://git.ostc-eu.org/OSTC/infrastructure/lava/lava-test-definitions/-/raw/gcc-test/automated/utils/gcc-result-parser.py \
> gcc-result-parser.py
for job_path in $(find artifacts/ -type d -name oe-selftest-gcc*); do
(
job=$(basename $job_path)
test_env="$(echo $job | cut -d'-' -f4-)"
cd $job_path
xz -d *.xz
# Parse sum file.
for sum_file in $(ls *.sum); do
python3 $CI_PROJECT_DIR/gcc-result-parser.py $sum_file
done
# Upload result to squad.
for result_file in $(ls result_*.json); do
component="$(basename $result_file .json | cut -d'_' -f2-)"
job_id="$job-$component"
time curl \
--header "Auth-Token: $CI_SQUAD_TOKEN" \
https://squadp.svc.ostc-eu.dev/api/submit/oniro-core/gcc-test/$CI_JOB_ID/$test_env \
--form tests=@$result_file \
--form metadata='{"job_id": "'$job_id'"}'
done
)
done
set +x
artifacts:
paths:
- artifacts/oe-selftest-gcc*/*.json
- artifacts/oe-selftest-gcc*/*.txt
...@@ -451,3 +451,35 @@ ...@@ -451,3 +451,35 @@
# Run this job in case the pipeline changes. # Run this job in case the pipeline changes.
- .oniro-ci/*.yml - .oniro-ci/*.yml
- .gitlab-ci.yml - .gitlab-ci.yml
# This job is documented in docs/ci/hidden-jobs/oe-selftest.rst
.oe-selftest:
image:
name: chaseqi/bitbake-builder:v1.3
tags: [qemu-friendly, large-disk, $CI_ONIRO_RUNNER_TAG, $CI_ONIRO_INSTANCE_SIZE]
extends: .bitbake-workspace
variables:
MACHINE: qemux86-64
CI_ONIRO_BUILD_FLAVOUR: linux
CI_ONIRO_BB_LOCAL_CONF_SANITY_TESTED_DISTROS: ""
CI_ONIRO_OE_SEFLTESTS: ""
CI_ONIRO_OE_SEFLTEST_SKIPS: ""
script:
- test -n "$CI_ONIRO_OE_SEFLTESTS" || (
echo "nothing to test - CI_ONIRO_OE_SEFLTESTS is empty"
&& exit 1 )
- !reference [.bitbake-workspace, script]
# The USER variable is required by oe-selftest but missing in env.
- export USER=builder
- echo "MACHINE = \"$MACHINE\"" >> conf/local.conf
- echo "Running specific tests $CI_ONIRO_OE_SEFLTESTS ..."
- time oe-selftest -vvv -r $CI_ONIRO_OE_SEFLTESTS -K
- artifacts_dir="$CI_PROJECT_DIR/artifacts/$CI_JOB_NAME"
- rm -rf "$artifacts_dir" & mkdir -p "$artifacts_dir"
- find ../build-st \( -name "*.sum" -o -name "*.log" \) \( -path "*/gcc-runtime/*testsuite*" \)
-exec cp --verbose {} "$artifacts_dir" \;
- for file in $(find "$artifacts_dir" -type f); do xz $file; done
- rm -rf ../build-st
artifacts:
paths:
- artifacts/$CI_JOB_NAME
...@@ -30,3 +30,4 @@ implementation details. ...@@ -30,3 +30,4 @@ implementation details.
lava-report lava-report
aggregate-docs aggregate-docs
publish-rauc-bundle-to-hawkbit publish-rauc-bundle-to-hawkbit
oe-selftest
.. SPDX-FileCopyrightText: Huawei Inc.
..
.. SPDX-License-Identifier: CC-BY-4.0
============
.oe-selftest
============
The ``.oe-selftest`` job extends the :doc:`bitbake-workspace` job to configure
OpenEmbedded Self test environment. The job does not run any tests by itself,
actual tests should be run in the downstream test jobs.
Job Variables
=============
Oe-selftest is based on Python unitest. Tests are orgnazied by module, class
and method. The ``.oe-selftest`` job defines two variables as a way to
customize what tests to run.
CI_ONIRO_OE_SEFLTESTS
---------------------
The specific tests to run. The default value is empty. The order the tests are
running is alphabetical.
CI_ONIRO_OE_SEFLTEST_SKIPS
--------------------------
The specific tests to skip. The default value is empty.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment