vmtest: use rsync -c to copy vmlinux and source files

This is safer than relying on the existence/time stamps of the files in
the disk image.
This commit is contained in:
Omar Sandoval 2019-11-26 16:10:25 -08:00
parent 26b2708f5e
commit e00373de3c
3 changed files with 23 additions and 23 deletions

View File

@ -41,6 +41,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:
@ -57,6 +58,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:
@ -73,6 +75,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:
@ -89,6 +92,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:
@ -105,6 +109,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:
@ -121,6 +126,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:

View File

@ -40,6 +40,7 @@ jobs:
apt: apt:
packages: packages:
- qemu-kvm - qemu-kvm
- rsync
- zstd - zstd
install: sudo adduser "$USER" kvm install: sudo adduser "$USER" kvm
before_script: before_script:

View File

@ -315,8 +315,13 @@ fi
# Install vmlinux. # Install vmlinux.
vmlinux="$mnt/boot/vmlinux-$KERNELRELEASE" vmlinux="$mnt/boot/vmlinux-$KERNELRELEASE"
if [[ ! -e $vmlinux ]]; then if (( ONESHOT )); then
if (( ! ONESHOT )); then # We could use "sudo zstd -o", but let's not run zstd as root with
# input from the internet.
download "vmlinux-$KERNELRELEASE.zst" |
zstd -d | sudo tee "$vmlinux" > /dev/null
sudo chmod 644 "$vmlinux"
else
downloaded_vmlinux="$DIR/vmlinux-$KERNELRELEASE" downloaded_vmlinux="$DIR/vmlinux-$KERNELRELEASE"
if [[ ! -e $downloaded_vmlinux ]]; then if [[ ! -e $downloaded_vmlinux ]]; then
tmp="$(mktemp "$downloaded_vmlinux.XXX.part")" tmp="$(mktemp "$downloaded_vmlinux.XXX.part")"
@ -324,20 +329,8 @@ if [[ ! -e $vmlinux ]]; then
mv "$tmp" "$downloaded_vmlinux" mv "$tmp" "$downloaded_vmlinux"
tmp= tmp=
fi fi
fi
tmp="$(sudo mktemp -p "$mnt/boot" "vmlinux-$KERNELRELEASE.XXX.part")"
if (( ONESHOT )); then
# We could use "sudo zstd -o", but let's not run zstd as root
# with input from the internet.
download "vmlinux-$KERNELRELEASE.zst" |
zstd -d | sudo tee "$tmp" > /dev/null
else
echo "Copying vmlinux..." >&2 echo "Copying vmlinux..." >&2
sudo cp "$downloaded_vmlinux" "$tmp" sudo rsync -cp --chmod 0644 "$downloaded_vmlinux" "$vmlinux"
fi
sudo mv "$tmp" "$vmlinux"
tmp=
sudo chmod 644 "$vmlinux"
fi fi
if (( SKIPSOURCE )); then if (( SKIPSOURCE )); then
@ -353,7 +346,7 @@ else
else else
tr '\n' '\0' < drgn.egg-info/SOURCES.txt tr '\n' '\0' < drgn.egg-info/SOURCES.txt
fi fi
} | sudo xargs -0 cp --parents --preserve=mode,timestamps -t "$mnt/drgn" } | sudo rsync --files-from=- -0cpt . "$mnt/drgn"
# Create the init scripts. # Create the init scripts.
sudo tee "$mnt/etc/rcS.d/S50-run-tests" > /dev/null << "EOF" sudo tee "$mnt/etc/rcS.d/S50-run-tests" > /dev/null << "EOF"