Skip to content

Commit b166747

Browse files
committed
ci: Run rawhide csmock.
Switch to rawhide version of csmock.
1 parent 3e114bc commit b166747

4 files changed

Lines changed: 75 additions & 10 deletions

File tree

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include:
1313
- local: .gitlab/ci/rhel.yml
1414
- local: .gitlab/ci/centos.yml
1515
# - local: .gitlab/ci/annocheck.yml
16-
# - local: .gitlab/ci/csmock.yml
16+
- local: .gitlab/ci/csmock.yml
1717
- local: .gitlab/ci/gitlab-shared-docker.yml
1818
- local: .gitlab/ci/compilation-various-disables.yml
1919
- local: .gitlab/ci/compilation-gcc.gitlab-ci.yml

.gitlab/ci/build_srpm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SAVED_PWD=$(pwd)
6+
GIT_DIR="$SAVED_PWD/upstream_git"
7+
SPEC="$GIT_DIR/misc/fedora/cryptsetup.spec"
8+
9+
rm -fr $GIT_DIR
10+
11+
git clone -q --depth 1 https://gitlab.com/cryptsetup/cryptsetup.git $GIT_DIR
12+
cd $GIT_DIR
13+
14+
GIT_COMMIT=$(git rev-parse --short=8 HEAD)
15+
[ -z "$GIT_COMMIT" ] && exit 1
16+
17+
sed -i "s/^AC_INIT.*/AC_INIT([cryptsetup],[$GIT_COMMIT])/" $GIT_DIR/configure.ac
18+
sed -i "s/^Version:.*/Version: $GIT_COMMIT/" $SPEC
19+
sed -i "s/%{version_no_tilde}/$GIT_COMMIT/" $SPEC
20+
sed -i "2i %global source_date_epoch_from_changelog 0" $SPEC
21+
sed -i "3i %define _unpackaged_files_terminate_build 0" $SPEC
22+
23+
./autogen.sh
24+
./configure
25+
make -j dist
26+
27+
rpmbuild --define "_sourcedir $GIT_DIR" --define "_srcrpmdir $SAVED_PWD" -bs $SPEC
28+
29+
cd $SAVED_PWD
30+
rm -fr $GIT_DIR
31+
32+
exit 0

.gitlab/ci/csmock.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
test-commit-job-csmock:
1+
.dnf-csmock:
2+
variables:
3+
DISTRO: cryptsetup-fedora-rawhide
4+
DISK_SIZE: 20
25
extends:
36
- .fail_if_coredump_generated
7+
before_script:
8+
- >
9+
sudo dnf -y -q install
10+
autoconf automake device-mapper-devel gcc gettext-devel json-c-devel
11+
libblkid-devel libpwquality-devel libselinux-devel
12+
libssh-devel libtool libuuid-devel make popt-devel
13+
libsepol-devel.x86_64 pkgconfig tar uuid-devel git
14+
openssl-devel asciidoctor meson ninja-build
15+
rpm-build csmock
16+
17+
test-commit-job-csmock:
18+
extends:
19+
- .dnf-csmock
420
tags:
521
- libvirt
6-
- cryptsetup-rhel-9
22+
- cryptsetup-fedora-rawhide
723
stage: test
824
interruptible: true
925
allow_failure: true
10-
variables:
11-
DISTRO: cryptsetup-rhel-9
12-
RUN_SSH_PLUGIN_TEST: "1"
13-
DISK_SIZE: 20
1426
rules:
1527
- if: $CI_PROJECT_PATH != "cryptsetup/cryptsetup"
1628
when: never
1729
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /v2\..\.x$/ || $CI_PIPELINE_SOURCE == "merge_request_event"
1830
script:
19-
- sudo /opt/run-csmock.sh
31+
- .gitlab/ci/build_srpm
32+
- .gitlab/ci/run_csmock
2033
artifacts:
21-
# Upload artifacts when a crash makes the job fail.
2234
when: always
2335
paths:
2436
- cryptsetup-csmock-results.tar.xz
25-
- cryptsetup-csmock-results

.gitlab/ci/run_csmock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
CSMOCK="sudo /usr/bin/csmock"
4+
CSMOCK_TOOLS="gcc,clang,cppcheck,shellcheck"
5+
CSMOCK_TXZ="cryptsetup-csmock-results.tar.xz"
6+
CSMOCK_ERR="cryptsetup-csmock-results/scan-results.err"
7+
8+
$CSMOCK cryptsetup-*.src.rpm \
9+
--keep-going --force \
10+
--cswrap-timeout 300 \
11+
--skip-patches \
12+
--tools $CSMOCK_TOOLS \
13+
--output $CSMOCK_TXZ \
14+
--gcc-analyze \
15+
--cppcheck-add-flag=--check-level=exhaustive \
16+
|| { echo "csmock command failed"; exit 2; }
17+
18+
tar xJf $CSMOCK_TXZ $CSMOCK_ERR --strip-components 1 \
19+
&& test -s $CSMOCK_ERR \
20+
&& { echo "csmock discovered important errors"; echo 3; }
21+
22+
exit 0

0 commit comments

Comments
 (0)