mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
Run usr/fileio/fileio_tgt over scst_local with an LD_PRELOAD hook that replaces the block length of one READ CAPACITY(10) or (16) reply with 809052976, as a user space backend did in production. The invalid reply must be rejected with INTERNAL TARGET FAILURE sense, and afterwards READ CAPACITY(10) and (16), reads and writes must return the right geometry and data. The local suite now builds usr and loads scst_user, and the CI image builds usr for the Ginkgo guest.
58 lines
2.4 KiB
Bash
58 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
# Runs only in the image build container; never loads modules.
|
|
set -euo pipefail
|
|
suite=$1
|
|
commit=$2
|
|
export KDIR="/usr/src/kernels/$KVER"
|
|
mkdir -p /opt/ci-build /opt/go-cache /opt/go-mod
|
|
exec > >(tee /opt/ci-build/build.log) 2>&1
|
|
test -s "$KDIR/Module.symvers"
|
|
cp "$KDIR/.config" /opt/ci-build/kernel.config
|
|
rpm -qa | sort > /opt/ci-build/packages.txt
|
|
python3 - "$suite" "$commit" "$KVER" <<'PY'
|
|
import json, pathlib, sys
|
|
pathlib.Path('/opt/ci-build/image.json').write_text(json.dumps(dict(
|
|
suite=sys.argv[1], commit=sys.argv[2], kernel=sys.argv[3]), indent=2) + '\n')
|
|
PY
|
|
opts=("-j$(nproc)" "GIT_COMMIT=${commit:0:12}" "KDIR=$KDIR" "KVER=$KVER")
|
|
case "$suite" in
|
|
kunit)
|
|
grep -Eq '^CONFIG_KUNIT=[ym]$' "$KDIR/.config"
|
|
grep -qx 'CONFIG_KUNIT_DEBUGFS=y' "$KDIR/.config"
|
|
modinfo -k "$KVER" -n kunit
|
|
modinfo -k "$KVER" -n dlm
|
|
python3 -m unittest discover -s scripts/kunit -p 'test_*.py'
|
|
make kunit-list
|
|
make "${opts[@]}" kunit-build
|
|
# Exercise cleanup without losing the exact modules to be executed.
|
|
tar -czf /opt/ci-build/modules.tar.gz -T .kunit-modules .kunit-modules
|
|
make kunit-clean
|
|
test ! -e .kunit-modules
|
|
test ! -e .kunit-modules.tmp
|
|
test -z "$(find scst/src iscsi-scst/kernel -type f \( -name '*.ko' -o -name '*.o' -o -name '*.cmd' \) -print -quit)"
|
|
tar -xzf /opt/ci-build/modules.tar.gz
|
|
;;
|
|
ginkgo)
|
|
modinfo -k "$KVER" -n iscsi_tcp
|
|
modinfo -k "$KVER" -n dlm
|
|
# Drivers consume the core's Module.symvers. Keep these builds ordered.
|
|
make "${opts[@]}" scst
|
|
make "${opts[@]}" scst_local
|
|
make "${opts[@]}" usr
|
|
make "${opts[@]}" iscsi INFINIBAND_ENABLED=false
|
|
make "${opts[@]}" scstadm
|
|
make ginkgo-check
|
|
# Populate Go's build cache at the same /scst path used by the guest.
|
|
# No package downloads or kernel compilation are needed in a test VM.
|
|
make ginkgo-list GINKGO_LABEL=
|
|
;;
|
|
*) exit 2 ;;
|
|
esac
|
|
# Keep the sources, modules and Go caches, but omit intermediate kernel objects.
|
|
find /scst -type f \( -name '*.o' -o -name '*.cmd' -o -name '*.mod.c' \) -delete
|
|
# Module signing keys must never enter a VM image or CI artifact.
|
|
# The ordinary scst target generates these, even without modules_install.
|
|
rm -f /scst/scst/src/certs/scst_module_key.priv /scst/scst/src/certs/scst_module_key.der
|
|
test -z "$(find /scst -type f -name '*.priv' -print -quit)"
|