]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/vm/freebsd
5 # Copyright 2017-2019 Red Hat Inc.
8 # Fam Zheng <famz@redhat.com>
9 # Gerd Hoffmann <kraxel@redhat.com>
11 # This code is licensed under the GPL version 2 or later. See
12 # the COPYING file in the top-level directory.
24 'cpu' : "max,sse4.2=off",
27 class FreeBSDVM(basevm
.BaseVM
):
31 link
= "https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz"
32 csum
= "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e"
76 rm -rf /home/qemu/qemu-test.*
77 cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
78 mkdir src build; cd src;
81 ../src/configure --python=python3.9 {configure_opts};
82 gmake --output-sync -j{jobs} {target} {verbose};
85 def build_image(self
, img
):
86 self
.print_step("Downloading disk image")
87 cimg
= self
._download
_with
_cache
(self
.link
, sha256sum
=self
.csum
)
88 tmp_raw
= img
+ ".tmp.raw"
89 tmp_raw_xz
= tmp_raw
+ ".xz"
90 img_tmp
= img
+ ".tmp.qcow2"
92 self
.print_step("Preparing disk image")
93 subprocess
.check_call(["cp", "-f", cimg
, tmp_raw_xz
])
94 subprocess
.check_call(["xz", "-dvf", tmp_raw_xz
])
95 self
.exec_qemu_img("convert", "-O", "qcow2", tmp_raw
, img_tmp
)
96 self
.exec_qemu_img("resize", img_tmp
, self
.size
)
99 self
.print_step("Preparing disk image")
100 self
.boot(img_tmp
, extra_args
= [
101 "-machine", "graphics=off",
105 self
.console_wait_send("login:", "root\n")
106 self
.console_wait_send("~ #", "service growfs onestart\n")
109 self
.console_wait_send("~ #", "passwd\n")
110 self
.console_wait("New Password:")
111 self
.console_send("%s\n" % self
._config
["root_pass"])
112 self
.console_wait("Retype New Password:")
113 self
.console_send("%s\n" % self
._config
["root_pass"])
116 self
.console_wait_send("~ #", "adduser\n")
117 self
.console_wait("Username")
118 self
.console_send("%s\n" % self
._config
["guest_user"])
119 self
.console_wait("Full name")
120 self
.console_send("%s\n" % self
._config
["guest_user"])
121 self
.console_wait_send("Uid", "\n")
122 self
.console_wait_send("Login group", "\n")
123 self
.console_wait_send("Login group", "\n")
124 self
.console_wait_send("Login class", "\n")
125 self
.console_wait_send("Shell", "\n")
126 self
.console_wait_send("Home directory", "\n")
127 self
.console_wait_send("Home directory perm", "\n")
128 self
.console_wait_send("Use password", "\n")
129 self
.console_wait_send("Use an empty password", "\n")
130 self
.console_wait_send("Use a random password", "\n")
131 self
.console_wait("Enter password:")
132 self
.console_send("%s\n" % self
._config
["guest_pass"])
133 self
.console_wait("Enter password again:")
134 self
.console_send("%s\n" % self
._config
["guest_pass"])
135 self
.console_wait_send("Lock out", "\n")
136 self
.console_wait_send("OK", "yes\n")
137 self
.console_wait_send("Add another user", "no\n")
138 self
.console_wait_send("~ #", "exit\n")
142 self
.console_ssh_init(prompt
, self
._config
["guest_user"], self
._config
["guest_pass"])
143 self
.console_wait_send(prompt
, "exit\n")
146 prompt
= "root@freebsd:~ #"
147 self
.console_ssh_init(prompt
, "root", self
._config
["root_pass"])
148 self
.console_sshd_config(prompt
)
150 # setup virtio-blk #1 (tarfile)
151 self
.console_wait(prompt
)
152 self
.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n")
154 self
.print_step("Installing packages")
155 self
.ssh_root_check("pkg install -y %s\n" % " ".join(self
.pkgs
))
158 self
.ssh_root(self
.poweroff
)
161 if os
.path
.exists(img
):
163 os
.rename(img_tmp
, img
)
164 self
.print_step("All done")
166 if __name__
== "__main__":
167 sys
.exit(basevm
.main(FreeBSDVM
, config
=FREEBSD_CONFIG
))