Skip to content

Commit

Permalink
WIP spread tests
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Nov 22, 2023
1 parent 122068d commit 3849abe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ prepare: |
apt install -y snapd libc6-dev gcc-multilib git
snap install core20 --channel=latest/edge
snap install --classic snapcraft
snap install yq
snap install --classic yq
snap install --classic go --channel=1.19/stable
unset SHELL
git clone https://git.launchpad.net/ubuntu-images
git clone https://github.com/snapcore/models
snapcraft --destructive-mode
snap install --classic --dangerous ubuntu-image_*.snap
mkdir /workdir
mkdir /tmp/workdir
suites:
tests/:
Expand Down
27 changes: 12 additions & 15 deletions tests/classic/task.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
summary: Run ubuntu-image classic command tests
execute: |
IMG_DEF_PATH=/home/ubuntu-image/ubuntu-images/ubuntu-server-pc-amd64.yaml
echo $IMG_DEF_PATH > img_def_path.txt
ubuntu-image classic --debug --workdir /workdir $IMG_DEF_PATH
IMG_NAME=$(yq '.artifacts.img.[0].name' $IMG_DEF_PATH)
ls /workdir
mkdir /loopback
losetup --find --show --partscan /workdir/$IMG_NAME
losetup -a |grep $IMG_NAME|cut -f1 -d: > loop.txt
ubuntu-image classic --debug --workdir /tmp/workdir $IMG_DEF_PATH
IMG_NAME=$(cat $IMG_DEF_PATH | yq '.artifacts.img.[0].name')
mkdir /tmp/loopback
losetup --find --show --partscan /tmp/workdir/$IMG_NAME
losetup -a |grep $IMG_NAME|cut -f1 -d: >> loop.txt
LOOP="$(cat loop.txt)"
for l in `ls -d "$LOOP"p*`
Expand All @@ -25,20 +24,18 @@ restore: |
if [ -f loop.txt ]; then
LOOP="$(cat loop.txt)"
for l in `ls -d "$LOOP"p`
for l in `ls -d "$LOOP"p*`
do
p=${l#"$LOOP"}
mkdir /tmp/$p
mount --make-rprivate $l
umount --recursive $l
done
losetup -d "$LOOP"
sync
losetup -l | NOMATCH "$LOOP"
rm loop.txt
fi
if [ -f img_def_path.txt ]; then
IMG_DEF_PATH="$(cat img_def_path.txt)"
rm -f $IMG_DEF_PATH || true
fi
rm -rf /tmp/workdir /tmp/loopback
1 change: 1 addition & 0 deletions tests/snap/task.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
summary: Run ubuntu-image snap command tests
execute: |
ubuntu-image snap --debug /home/ubuntu-image/models/ubuntu-core-20-amd64.model
test pc.img

0 comments on commit 3849abe

Please sign in to comment.