@@ -12,84 +12,20 @@ set -exuo pipefail
12
12
# Ensure we're in the topdir canonically
13
13
cd $( git rev-parse --show-toplevel)
14
14
15
- DISK=target/integration-test.raw
16
-
17
- # Generate a temporary key
18
- SSH_KEY=$( pwd) /target/id_rsa
19
- rm -vf " ${SSH_KEY} " *
20
- ssh-keygen -f " ${SSH_KEY} " -N " " -q -t rsa-sha2-256 -b 4096
21
- chmod 600 " ${SSH_KEY} "
15
+ DISK=$( pwd) /target/bootc-integration-test.qcow2
16
+ test -f " ${DISK} "
22
17
23
18
TMT_PLAN_NAME=$1
24
19
shift
25
20
26
- SSH_OPTIONS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o PasswordAuthentication=no -o ConnectTimeout=5)
27
- pubkey=$( base64 -w 0 < target/id_rsa.pub)
28
- ssh_tmpfiles=$( printf " d /root/.ssh 0750 - - -\nf+~ /root/.ssh/authorized_keys 700 - - - ${pubkey} " | base64 -w 0)
29
- ssh_cred=" io.systemd.credential.binary:tmpfiles.extra=" ${ssh_tmpfiles}
30
-
31
- # TODO replace with tmt's virt provisioner
32
- ARCH=$( uname -m)
33
- qemu_args=()
34
- case " $ARCH " in
35
- " aarch64" )
36
- qemu_args+=(qemu-system-aarch64
37
- -machine virt
38
- -bios /usr/share/AAVMF/AAVMF_CODE.fd)
39
- ;;
40
- " x86_64" )
41
- qemu_args+=(qemu-system-x86_64)
42
- ;;
43
- * )
44
- echo " Unhandled architecture: $ARCH " >&2
45
- exit 1
46
- ;;
47
- esac
48
- qemu_args+=(
49
- -name bootc-vm
50
- -enable-kvm
51
- -cpu host
52
- -m 2G
53
- -drive file=" target/disk.raw" ,if=virtio,format=raw
54
- -snapshot
55
- -net nic,model=virtio
56
- -net user,hostfwd=tcp::2222-:22
57
- -display none
58
- -smbios type=11,value=${ssh_cred}
59
- )
60
-
61
- # Kill qemu when the test exits by default
62
- setpriv --pdeathsig SIGTERM -- ${qemu_args[@]} & > /dev/null &
63
-
64
- wait_for_ssh_up () {
65
- SSH_STATUS=$( ssh " ${SSH_OPTIONS[@]} " -i " $SSH_KEY " -p 2222 root@" ${1} " ' /bin/bash -c "echo -n READY"' )
66
- if [[ $SSH_STATUS == READY ]]; then
67
- echo 1
68
- else
69
- echo 0
70
- fi
71
- }
72
-
73
- for _ in $( seq 0 30) ; do
74
- RESULT=$( wait_for_ssh_up " localhost" )
75
- if [[ $RESULT == 1 ]]; then
76
- echo " SSH is ready now! 🥳"
77
- break
78
- fi
79
- sleep 10
80
- done
81
-
82
- # Make sure VM is ready for testing
83
- ssh " ${SSH_OPTIONS[@]} " \
84
- -i " $SSH_KEY " \
85
- -p 2222 \
86
- root@localhost \
87
- " bootc status"
88
-
89
21
# Move the tmt bits to a subdirectory to work around https://github.com/teemtee/tmt/issues/4062
90
22
rm target/tmt-workdir -rf
91
23
mkdir target/tmt-workdir
92
24
cp -a .fmf tmt target/tmt-workdir/
25
+
26
+ # Hack around https://github.com/teemtee/testcloud/issues/17
27
+ rm -vrf /var/tmp/tmt/testcloud/images/bootc-integration-test.qcow2
28
+
93
29
cd target/tmt-workdir
94
30
# TMT will rsync tmt-* scripts to TMT_SCRIPTS_DIR=/var/lib/tmt/scripts
95
- tmt run --all --verbose -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts provision --how connect --guest localhost --port 2222 --user root --key " $SSH_KEY " plan --name " /tmt/plans/integration/${TMT_PLAN_NAME} "
31
+ tmt --context " test_disk_image= ${DISK} " run --all --verbose -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts plan --name " /tmt/plans/integration/${TMT_PLAN_NAME} "
0 commit comments