#!/bin/bash
-# check if testbox has rootfs_partition to run the job +# check if testbox has rootfs_partition or rootfs_disk to run the job
Your comment is conflict with your code.
Well, i don't think so.
+# check if testbox has rootfs_partition or rootfs_disk to run the job
This means [ -n $rootfs_partition ] or [ -n $rootfs_disk ], we run the job.
- if [[ -z "$rootfs_partition" && -z "$rootfs_disk" ]]; then
echo "rm $job_file due to no rootfs_partition or rootfs_disk"
exit 1echo "run_on_local_disk needs rootfs_partition or rootfs_disk"
This means [ -z $rootfs_partition ] and [ -z $rootfs_disk ], we exit 1.
So i think it's right.
-------- Thanks Yu Chuan
Thanks, Xueliang
if [[ "$run_on_local_disk" == "yes" || "$run_on_local_disk" == "true" ]]; then
- if [[ -z "$rootfs_partition" ]]; then
echo "rm $job_file due to no rootfs_partition"
echo "run_on_local_disk needs rootfs_partition"
- if [[ -z "$rootfs_partition" && -z "$rootfs_disk" ]]; then
echo "rm $job_file due to no rootfs_partition or rootfs_disk"
exit 1 fiecho "run_on_local_disk needs rootfs_partition or rootfs_disk"
fi diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index b04ea3dd48b7..6c0055bd19f5 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -490,6 +490,12 @@ wait_load_disk() ls $rootfs_partition >/dev/null 2>&1 && return # eg: LABEL=LKP-ROOTFS blkid | grep -q ${rootfs_partition#*=} && return
# eg: /dev/disk/by-id/ata-WDC_WD1002FAEX-00Z3A0_WD-WCATRC577623
ls $rootfs_disk >/dev/null 2>&1 && return
# eg: LABEL=LKP-ROOTFS
blkid | grep -q ${rootfs_disk#*=} && return
- sleep 1 done
@@ -515,6 +521,23 @@ mount_rootfs() mkdir -p $ROOTFS_DIR/tmp CACHE_DIR=$ROOTFS_DIR/tmp cleanup_pkg_cache $CACHE_DIR
- elif [ -n "$rootfs_disk" ]; then
# wait for the machine to load the disk
wait_load_disk || {
# skipping following test if disk can't be load
echo "can't load the disk $rootfs_disk, skip testing..."
set_job_state 'load_disk_fail'
return 1
}
ROOTFS_DIR=/opt/rootfs
mkdir -p $ROOTFS_DIR
mount $rootfs_disk $ROOTFS_DIR || {
mkfs.btrfs -f $rootfs_disk
mount $rootfs_disk $ROOTFS_DIR
}
mkdir -p $ROOTFS_DIR/tmp
CACHE_DIR=$ROOTFS_DIR/tmp
else CACHE_DIR=/tmp/cache mkdir -p $CACHE_DIRcleanup_pkg_cache $CACHE_DIR
diff --git a/lkp-exec/qemu b/lkp-exec/qemu index 9e4b576cf50f..1cbd316f6146 100755 --- a/lkp-exec/qemu +++ b/lkp-exec/qemu @@ -91,14 +91,16 @@ replace_script_partition_val() local nr_hdd_vdisk="$(echo $hdd_partitions | wc -w)" local nr_ssd_vdisk="$(echo $ssd_partitions | wc -w)" local nr_swap_vdisk="$(echo $swap_partitions | wc -w)"
local nr_rootfs_vdisk="$(echo $rootfs_partition | wc -w)"
[ -z "$rootfs_partition" ] && nr_rootfs_vdisk="$(echo $rootfs_disk | wc -w)"
[[ $nr_hdd_partitions ]] || nr_hdd_partitions=$nr_hdd_vdisk [[ $nr_ssd_partitions ]] || nr_ssd_partitions=$nr_ssd_vdisk
VDISK_NUM=$((nr_hdd_partitions+nr_ssd_partitions+nr_swap_vdisk+nr_rootfs_vdisk))
- [[ "$hdd_partitions$ssd_partitions$swap_partitions$rootfs_partition" =~ '/dev/vda' ]] && return
[[ "$hdd_partitions$ssd_partitions$swap_partitions$rootfs_partition$rootfs_disk" =~ '/dev/vda' ]] && return
if ((VDISK_NUM)); then local index=0
@@ -115,6 +117,9 @@ replace_script_partition_val() -e "s%export swap_partitions=.*%export swap_partitions='${vdisk_swap_val}'%" \ -e "s%export rootfs_partition=.*%export rootfs_partition='${vdisk_rootfs_val}'%" \ $job_script
[ -z "$rootfs_partition" ] &&
fised -i -e "s%export rootfs_disk=.*%export rootfs_disk='${vdisk_rootfs_val}'%" $job_script
}
-- 2.23.0