@@ -12,84 +12,20 @@ set -exuo pipefail
1212#  Ensure we're in the topdir canonically
1313cd  $( git rev-parse --show-toplevel) 
1414
15- DISK=target/integration-test.raw
16- 
17- #  Generate a temporary key
18- SSH_KEY=$( pwd) 
19- rm -vf " ${SSH_KEY} " * 
20- ssh-keygen -f " ${SSH_KEY} " " " 
21- chmod 600 " ${SSH_KEY} " 
15+ DISK=$( pwd) 
16+ test  -f " ${DISK} " 
2217
2318TMT_PLAN_NAME=$1 
2419shift 
2520
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" 
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[@]} " " $SSH_KEY " " ${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- 
8921#  Move the tmt bits to a subdirectory to work around https://github.com/teemtee/tmt/issues/4062
9022rm target/tmt-workdir -rf
9123mkdir target/tmt-workdir
9224cp -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+ 
9329cd  target/tmt-workdir
9430#  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