@@ -12,84 +12,89 @@ 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) /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} "
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}
21+ # Generate a temporary key
22+ # SSH_KEY=$(pwd)/target/id_rsa
23+ # rm -vf "${SSH_KEY}"*
24+ # ssh-keygen -f "${SSH_KEY}" -N "" -q -t rsa-sha2-256 -b 4096
25+ # chmod 600 "${SSH_KEY}"
26+
27+ # SSH_OPTIONS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o PasswordAuthentication=no -o ConnectTimeout=5)
28+ # pubkey=$(base64 -w 0 < target/id_rsa.pub)
29+ # ssh_tmpfiles=$(printf "d /root/.ssh 0750 - - -\nf+~ /root/.ssh/authorized_keys 700 - - - ${pubkey}" | base64 -w 0)
30+ # ssh_cred="io.systemd.credential.binary:tmpfiles.extra="${ssh_tmpfiles}
3031
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- )
32+ # # TODO replace with tmt's virt provisioner
33+ # ARCH=$(uname -m)
34+ # qemu_args=()
35+ # case "$ARCH" in
36+ # "aarch64")
37+ # qemu_args+=(qemu-system-aarch64
38+ # -machine virt
39+ # -bios /usr/share/AAVMF/AAVMF_CODE.fd)
40+ # ;;
41+ # "x86_64")
42+ # qemu_args+=(qemu-system-x86_64)
43+ # ;;
44+ # *)
45+ # echo "Unhandled architecture: $ARCH" >&2
46+ # exit 1
47+ # ;;
48+ # esac
49+ # qemu_args+=(
50+ # -name bootc-vm
51+ # -enable-kvm
52+ # -cpu host
53+ # -m 2G
54+ # -drive file="target/disk.raw",if=virtio,format=raw
55+ # -snapshot
56+ # -net nic,model=virtio
57+ # -net user,hostfwd=tcp::2222-:22
58+ # -display none
59+ # -smbios type=11,value=${ssh_cred}
60+ # )
6061
61- # Kill qemu when the test exits by default
62- setpriv --pdeathsig SIGTERM -- ${qemu_args[@]} & > /dev/null &
62+ # # Kill qemu when the test exits by default
63+ # setpriv --pdeathsig SIGTERM -- ${qemu_args[@]} &>/dev/null &
6364
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- }
65+ # wait_for_ssh_up() {
66+ # SSH_STATUS=$(ssh "${SSH_OPTIONS[@]}" -i "$SSH_KEY" -p 2222 root@"${1}" '/bin/bash -c "echo -n READY"')
67+ # if [[ $SSH_STATUS == READY ]]; then
68+ # echo 1
69+ # else
70+ # echo 0
71+ # fi
72+ # }
7273
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
74+ # for _ in $(seq 0 30); do
75+ # RESULT=$(wait_for_ssh_up "localhost")
76+ # if [[ $RESULT == 1 ]]; then
77+ # echo "SSH is ready now! 🥳"
78+ # break
79+ # fi
80+ # sleep 10
81+ # done
8182
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"
83+ # # Make sure VM is ready for testing
84+ # ssh "${SSH_OPTIONS[@]}" \
85+ # -i "$SSH_KEY" \
86+ # -p 2222 \
87+ # root@localhost \
88+ # "bootc status"
8889
8990# Move the tmt bits to a subdirectory to work around https://github.com/teemtee/tmt/issues/4062
9091rm target/tmt-workdir -rf
9192mkdir target/tmt-workdir
9293cp -a .fmf tmt target/tmt-workdir/
94+
95+ # Hack around https://github.com/teemtee/testcloud/issues/17
96+ rm -vrf /var/tmp/tmt/testcloud/images/bootc-integration-test.qcow2
97+
9398cd target/tmt-workdir
9499# 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} "
100+ 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