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

View File

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

View File

@ -315,29 +315,22 @@ fi
# Install vmlinux.
vmlinux="$mnt/boot/vmlinux-$KERNELRELEASE"
if [[ ! -e $vmlinux ]]; then
if (( ! ONESHOT )); then
downloaded_vmlinux="$DIR/vmlinux-$KERNELRELEASE"
if [[ ! -e $downloaded_vmlinux ]]; then
tmp="$(mktemp "$downloaded_vmlinux.XXX.part")"
download "vmlinux-$KERNELRELEASE.zst" | zstd -dfo "$tmp"
mv "$tmp" "$downloaded_vmlinux"
tmp=
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
sudo cp "$downloaded_vmlinux" "$tmp"
fi
sudo mv "$tmp" "$vmlinux"
tmp=
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"
if [[ ! -e $downloaded_vmlinux ]]; then
tmp="$(mktemp "$downloaded_vmlinux.XXX.part")"
download "vmlinux-$KERNELRELEASE.zst" | zstd -dfo "$tmp"
mv "$tmp" "$downloaded_vmlinux"
tmp=
fi
echo "Copying vmlinux..." >&2
sudo rsync -cp --chmod 0644 "$downloaded_vmlinux" "$vmlinux"
fi
if (( SKIPSOURCE )); then
@ -353,7 +346,7 @@ else
else
tr '\n' '\0' < drgn.egg-info/SOURCES.txt
fi
} | sudo xargs -0 cp --parents --preserve=mode,timestamps -t "$mnt/drgn"
} | sudo rsync --files-from=- -0cpt . "$mnt/drgn"
# Create the init scripts.
sudo tee "$mnt/etc/rcS.d/S50-run-tests" > /dev/null << "EOF"