summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-08 23:24:14 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-09 00:59:55 -0500
commit610e0b33c14d8216dc56f9625624ccad8dd4058b (patch)
tree623791345877238b75a031b25e266c04197b3d49
parentf212ca7ac70982d6a006783a99a4b356feaf550d (diff)
build-test-kernel: Add -p for precise
This adds a new build-test-kernel flag, which doesn't keep the existing kernel .config - ensuring that we test with the precise kernel config options the test specifies. Also, the CI is updated to use it. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rwxr-xr-xbuild-test-kernel16
-rw-r--r--ci/_test-git-branch.sh2
2 files changed, 16 insertions, 2 deletions
diff --git a/build-test-kernel b/build-test-kernel
index 7ea4823..0a5388e 100755
--- a/build-test-kernel
+++ b/build-test-kernel
@@ -19,6 +19,7 @@ ktest_kernel_source="." # dir of kernel source
# set with: -k <path>
# defaults: current directory
ktest_njobs=$(nproc)
+ktest_precise=false
COVERAGE="" # doing code coverage?
MAKEARGS=()
@@ -56,11 +57,14 @@ fi
CMD="$1"
shift
-while getopts "k:c:h${ktest_args}" arg; do
+while getopts "k:Pc:h${ktest_args}" arg; do
case $arg in
k)
ktest_kernel_source="$OPTARG"
;;
+ P)
+ ktest_precise=true
+ ;;
c)
if [[ ! -d $OPTARG ]]; then
echo "$OPTARG must be a directory"
@@ -173,6 +177,11 @@ build_kernel()
{
rm -rf "$ktest_kernel_binary"
mkdir -p "$ktest_kernel_binary"
+ local kconfig="$ktest_kernel_build/.config"
+
+ if $ktest_precise && [[ -f "$kconfig" ]]; then
+ mv "$kconfig" "$kconfig".bak
+ fi
new_config
@@ -188,6 +197,11 @@ build_kernel()
[[ -n $opt ]] && kernel_opt check "$opt"
done
+ # Preserve timestamp if config didn't change:
+ if $ktest_precise && [[ -f "$kconfig".bak ]] && diff -q "$kconfig" "$kconfig".bak; then
+ mv "$kconfig".bak "$kconfig"
+ fi
+
case $KERNEL_ARCH in
mips)
do_make -k vmlinuz
diff --git a/ci/_test-git-branch.sh b/ci/_test-git-branch.sh
index 273add4..8f4b8a6 100644
--- a/ci/_test-git-branch.sh
+++ b/ci/_test-git-branch.sh
@@ -115,7 +115,7 @@ while (( ${#SUBTESTS[@]} )); do
$KTEST_DIR/lib/supervisor -T 1200 -f "$FULL_LOG" -S -F \
-b $TEST_NAME -o ktest-out/out \
- -- build-test-kernel run $TEST_PATH ${SUBTESTS[@]} > /dev/null &
+ -- build-test-kernel run -P $TEST_PATH ${SUBTESTS[@]} > /dev/null &
wait
SUBTESTS_REMAINING=()