Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 1 | // Copyright 2020 The Monogon Project Authors. |
| 2 | // |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | |
| 17 | // This package runs the installer image in a VM provided with an empty block |
| 18 | // device. It then examines the installer console output and the blok device to |
| 19 | // determine whether the installation process completed without issue. |
Mateusz Zalega | edffbb5 | 2022-01-11 15:27:22 +0100 | [diff] [blame] | 20 | package installer |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 21 | |
| 22 | import ( |
Mateusz Zalega | 367f759 | 2021-12-20 18:13:31 +0100 | [diff] [blame] | 23 | "bytes" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 24 | "context" |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 25 | "fmt" |
| 26 | "io" |
| 27 | "log" |
| 28 | "os" |
| 29 | "os/exec" |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 30 | "path/filepath" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 31 | "strings" |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 32 | "syscall" |
| 33 | "testing" |
| 34 | |
| 35 | diskfs "github.com/diskfs/go-diskfs" |
| 36 | "github.com/diskfs/go-diskfs/disk" |
| 37 | "github.com/diskfs/go-diskfs/partition/gpt" |
Lorenz Brun | 0b93c8d | 2021-11-09 03:58:40 +0100 | [diff] [blame] | 38 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 39 | mctl "source.monogon.dev/metropolis/cli/metroctl/core" |
Serge Bazanski | 9778322 | 2021-12-14 16:04:26 +0100 | [diff] [blame] | 40 | "source.monogon.dev/metropolis/cli/pkg/datafile" |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 41 | "source.monogon.dev/metropolis/node/build/mkimage/osimage" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 42 | "source.monogon.dev/metropolis/pkg/logbuffer" |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 43 | "source.monogon.dev/metropolis/proto/api" |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 44 | ) |
| 45 | |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 46 | // Each variable in this block points to either a test dependency or a side |
| 47 | // effect. These variables are initialized in TestMain using Bazel. |
| 48 | var ( |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 49 | // installerImage is a filesystem path pointing at the installer image that |
| 50 | // is generated during the test, and is removed afterwards. |
| 51 | installerImage string |
| 52 | // nodeStorage is a filesystem path pointing at the VM block device image |
| 53 | // Metropolis is installed to during the test. The file is removed afterwards. |
| 54 | nodeStorage string |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 55 | ) |
| 56 | |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 57 | // runQemu starts a QEMU process and waits until it either finishes or the given |
| 58 | // expectedOutput appears in a line emitted to stdout or stderr. It returns true |
| 59 | // if it was found, false otherwise. |
| 60 | // |
| 61 | // The qemu process will be killed when the context cancels or the function |
| 62 | // exits. |
| 63 | func runQemu(ctx context.Context, args []string, expectedOutput string) (bool, error) { |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 64 | // Prepare the default parameter list. |
| 65 | defaultArgs := []string{ |
| 66 | "-machine", "q35", "-accel", "kvm", "-nographic", "-nodefaults", |
| 67 | "-m", "512", |
| 68 | "-smp", "2", |
| 69 | "-cpu", "host", |
| 70 | "-drive", "if=pflash,format=raw,readonly,file=external/edk2/OVMF_CODE.fd", |
| 71 | "-drive", "if=pflash,format=raw,snapshot=on,file=external/edk2/OVMF_VARS.fd", |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 72 | "-serial", "stdio", |
| 73 | "-no-reboot", |
| 74 | } |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 75 | |
| 76 | // Make a sub-context to ensure that qemu exits when this function is done. |
| 77 | ctxQ, ctxC := context.WithCancel(ctx) |
| 78 | defer ctxC() |
| 79 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 80 | // Join the parameter lists and prepare the Qemu command, but don't run it |
| 81 | // just yet. |
| 82 | qemuArgs := append(defaultArgs, args...) |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 83 | qemuCmd := exec.CommandContext(ctxQ, "external/qemu/qemu-x86_64-softmmu", qemuArgs...) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 84 | |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 85 | // Copy the stdout and stderr output to a single channel of lines so that they |
| 86 | // can then be matched against expectedOutput. |
Mateusz Zalega | cdcc739 | 2021-12-08 15:34:53 +0100 | [diff] [blame] | 87 | |
| 88 | // Since LineBuffer can write its buffered contents on a deferred Close, |
| 89 | // after the reader loop is broken, avoid deadlocks by making lineC a |
| 90 | // buffered channel. |
| 91 | lineC := make(chan string, 2) |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 92 | outBuffer := logbuffer.NewLineBuffer(1024, func(l *logbuffer.Line) { |
| 93 | lineC <- l.Data |
| 94 | }) |
| 95 | defer outBuffer.Close() |
| 96 | errBuffer := logbuffer.NewLineBuffer(1024, func(l *logbuffer.Line) { |
| 97 | lineC <- l.Data |
| 98 | }) |
| 99 | defer errBuffer.Close() |
| 100 | |
| 101 | // Tee std{out,err} into the linebuffers above and the process' std{out,err}, to |
| 102 | // allow easier debugging. |
| 103 | qemuCmd.Stdout = io.MultiWriter(os.Stdout, outBuffer) |
| 104 | qemuCmd.Stderr = io.MultiWriter(os.Stderr, errBuffer) |
| 105 | if err := qemuCmd.Start(); err != nil { |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 106 | return false, fmt.Errorf("couldn't start QEMU: %w", err) |
| 107 | } |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 108 | |
| 109 | // Try matching against expectedOutput and return the result. |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 110 | for { |
| 111 | select { |
| 112 | case <-ctx.Done(): |
| 113 | return false, ctx.Err() |
| 114 | case line := <-lineC: |
| 115 | if strings.Contains(line, expectedOutput) { |
| 116 | return true, nil |
| 117 | } |
| 118 | } |
| 119 | } |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 120 | } |
| 121 | |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 122 | // runQemuWithInstaller runs the Metropolis Installer in a qemu, performing the |
| 123 | // same search-through-std{out,err} as runQemu. |
| 124 | func runQemuWithInstaller(ctx context.Context, args []string, expectedOutput string) (bool, error) { |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 125 | args = append(args, "-drive", "if=virtio,format=raw,snapshot=on,cache=unsafe,file="+installerImage) |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 126 | return runQemu(ctx, args, expectedOutput) |
Lorenz Brun | 0b93c8d | 2021-11-09 03:58:40 +0100 | [diff] [blame] | 127 | } |
| 128 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 129 | // getStorage creates a sparse file, given a size expressed in mebibytes, and |
| 130 | // returns a path to that file. It may return an error. |
| 131 | func getStorage(size int64) (string, error) { |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 132 | image, err := os.Create(nodeStorage) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 133 | if err != nil { |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 134 | return "", fmt.Errorf("couldn't create the block device image at %q: %w", nodeStorage, err) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 135 | } |
| 136 | if err := syscall.Ftruncate(int(image.Fd()), size*1024*1024); err != nil { |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 137 | return "", fmt.Errorf("couldn't resize the block device image at %q: %w", nodeStorage, err) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 138 | } |
| 139 | image.Close() |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 140 | return nodeStorage, nil |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | // qemuDriveParam returns QEMU parameters required to run it with a |
| 144 | // raw-format image at path. |
| 145 | func qemuDriveParam(path string) []string { |
| 146 | return []string{"-drive", "if=virtio,format=raw,snapshot=off,cache=unsafe,file=" + path} |
| 147 | } |
| 148 | |
| 149 | // checkEspContents verifies the presence of the EFI payload inside of image's |
| 150 | // first partition. It returns nil on success. |
| 151 | func checkEspContents(image *disk.Disk) error { |
| 152 | // Get the ESP. |
| 153 | fs, err := image.GetFilesystem(1) |
| 154 | if err != nil { |
| 155 | return fmt.Errorf("couldn't read the installer ESP: %w", err) |
| 156 | } |
| 157 | // Make sure the EFI payload exists by attempting to open it. |
| 158 | efiPayload, err := fs.OpenFile(osimage.EFIPayloadPath, os.O_RDONLY) |
| 159 | if err != nil { |
| 160 | return fmt.Errorf("couldn't open the installer's EFI Payload at %q: %w", osimage.EFIPayloadPath, err) |
| 161 | } |
| 162 | efiPayload.Close() |
| 163 | return nil |
| 164 | } |
| 165 | |
| 166 | func TestMain(m *testing.M) { |
Serge Bazanski | 9778322 | 2021-12-14 16:04:26 +0100 | [diff] [blame] | 167 | installerImage = filepath.Join(os.Getenv("TEST_TMPDIR"), "installer.img") |
| 168 | nodeStorage = filepath.Join(os.Getenv("TEST_TMPDIR"), "stor.img") |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 169 | |
Mateusz Zalega | edffbb5 | 2022-01-11 15:27:22 +0100 | [diff] [blame] | 170 | installer := datafile.MustGet("metropolis/installer/test/kernel.efi") |
| 171 | bundle := datafile.MustGet("metropolis/installer/test/testos/testos_bundle.zip") |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 172 | iargs := mctl.MakeInstallerImageArgs{ |
Serge Bazanski | 9778322 | 2021-12-14 16:04:26 +0100 | [diff] [blame] | 173 | Installer: bytes.NewBuffer(installer), |
| 174 | InstallerSize: uint64(len(installer)), |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 175 | TargetPath: installerImage, |
Lorenz Brun | 0b93c8d | 2021-11-09 03:58:40 +0100 | [diff] [blame] | 176 | NodeParams: &api.NodeParameters{}, |
Serge Bazanski | 9778322 | 2021-12-14 16:04:26 +0100 | [diff] [blame] | 177 | Bundle: bytes.NewBuffer(bundle), |
| 178 | BundleSize: uint64(len(bundle)), |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 179 | } |
| 180 | if err := mctl.MakeInstallerImage(iargs); err != nil { |
Mateusz Zalega | 8f72b5d | 2021-12-03 17:08:59 +0100 | [diff] [blame] | 181 | log.Fatalf("Couldn't create the installer image at %q: %v", installerImage, err) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 182 | } |
| 183 | // With common dependencies set up, run the tests. |
| 184 | code := m.Run() |
| 185 | // Clean up. |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 186 | os.Remove(installerImage) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 187 | os.Exit(code) |
| 188 | } |
| 189 | |
| 190 | func TestInstallerImage(t *testing.T) { |
| 191 | // This test examines the installer image, making sure that the GPT and the |
| 192 | // ESP contents are in order. |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 193 | image, err := diskfs.OpenWithMode(installerImage, diskfs.ReadOnly) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 194 | if err != nil { |
Mateusz Zalega | 8cde8e7 | 2021-11-30 16:22:20 +0100 | [diff] [blame] | 195 | t.Errorf("Couldn't open the installer image at %q: %s", installerImage, err.Error()) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 196 | } |
| 197 | // Verify that GPT exists. |
| 198 | ti, err := image.GetPartitionTable() |
| 199 | if ti.Type() != "gpt" { |
| 200 | t.Error("Couldn't verify that the installer image contains a GPT.") |
| 201 | } |
| 202 | // Check that the first partition is likely to be a valid ESP. |
| 203 | pi := ti.GetPartitions() |
| 204 | esp := (pi[0]).(*gpt.Partition) |
| 205 | if esp.Start == 0 || esp.End == 0 { |
| 206 | t.Error("The installer's ESP GPT entry looks off.") |
| 207 | } |
| 208 | // Verify that the image contains only one partition. |
| 209 | second := (pi[1]).(*gpt.Partition) |
| 210 | if second.Name != "" || second.Start != 0 || second.End != 0 { |
| 211 | t.Error("It appears the installer image contains more than one partition.") |
| 212 | } |
| 213 | // Verify the ESP contents. |
| 214 | if err := checkEspContents(image); err != nil { |
| 215 | t.Error(err.Error()) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | func TestNoBlockDevices(t *testing.T) { |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 220 | ctx, ctxC := context.WithCancel(context.Background()) |
| 221 | defer ctxC() |
| 222 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 223 | // No block devices are passed to QEMU aside from the install medium. Expect |
| 224 | // the installer to fail at the device probe stage rather than attempting to |
| 225 | // use the medium as the target device. |
Mateusz Zalega | cdcc739 | 2021-12-08 15:34:53 +0100 | [diff] [blame] | 226 | expectedOutput := "Couldn't find a suitable block device" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 227 | result, err := runQemuWithInstaller(ctx, nil, expectedOutput) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 228 | if err != nil { |
| 229 | t.Error(err.Error()) |
| 230 | } |
| 231 | if result != true { |
| 232 | t.Errorf("QEMU didn't produce the expected output %q", expectedOutput) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | func TestBlockDeviceTooSmall(t *testing.T) { |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 237 | ctx, ctxC := context.WithCancel(context.Background()) |
| 238 | defer ctxC() |
| 239 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 240 | // Prepare the block device the installer will install to. This time the |
| 241 | // target device is too small to host a Metropolis installation. |
| 242 | imagePath, err := getStorage(64) |
| 243 | defer os.Remove(imagePath) |
| 244 | if err != nil { |
| 245 | t.Errorf(err.Error()) |
| 246 | } |
| 247 | |
| 248 | // Run QEMU. Expect the installer to fail with a predefined error string. |
Mateusz Zalega | cdcc739 | 2021-12-08 15:34:53 +0100 | [diff] [blame] | 249 | expectedOutput := "Couldn't find a suitable block device" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 250 | result, err := runQemuWithInstaller(ctx, qemuDriveParam(imagePath), expectedOutput) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 251 | if err != nil { |
| 252 | t.Error(err.Error()) |
| 253 | } |
| 254 | if result != true { |
| 255 | t.Errorf("QEMU didn't produce the expected output %q", expectedOutput) |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | func TestInstall(t *testing.T) { |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 260 | ctx, ctxC := context.WithCancel(context.Background()) |
| 261 | defer ctxC() |
| 262 | |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 263 | // Prepare the block device image the installer will install to. |
| 264 | storagePath, err := getStorage(4096 + 128 + 128 + 1) |
| 265 | defer os.Remove(storagePath) |
| 266 | if err != nil { |
| 267 | t.Errorf(err.Error()) |
| 268 | } |
| 269 | |
| 270 | // Run QEMU. Expect the installer to succeed. |
| 271 | expectedOutput := "Installation completed" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 272 | result, err := runQemuWithInstaller(ctx, qemuDriveParam(storagePath), expectedOutput) |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 273 | if err != nil { |
| 274 | t.Error(err.Error()) |
| 275 | } |
| 276 | if result != true { |
| 277 | t.Errorf("QEMU didn't produce the expected output %q", expectedOutput) |
| 278 | } |
| 279 | |
| 280 | // Verify the resulting node image. Check whether the node GPT was created. |
| 281 | storage, err := diskfs.OpenWithMode(storagePath, diskfs.ReadOnly) |
| 282 | if err != nil { |
| 283 | t.Errorf("Couldn't open the resulting node image at %q: %s", storagePath, err.Error()) |
| 284 | } |
| 285 | // Verify that GPT exists. |
| 286 | ti, err := storage.GetPartitionTable() |
| 287 | if ti.Type() != "gpt" { |
| 288 | t.Error("Couldn't verify that the resulting node image contains a GPT.") |
| 289 | } |
| 290 | // Check that the first partition is likely to be a valid ESP. |
| 291 | pi := ti.GetPartitions() |
| 292 | esp := (pi[0]).(*gpt.Partition) |
| 293 | if esp.Name != osimage.ESPVolumeLabel || esp.Start == 0 || esp.End == 0 { |
| 294 | t.Error("The node's ESP GPT entry looks off.") |
| 295 | } |
| 296 | // Verify the system partition's GPT entry. |
| 297 | system := (pi[1]).(*gpt.Partition) |
| 298 | if system.Name != osimage.SystemVolumeLabel || system.Start == 0 || system.End == 0 { |
| 299 | t.Error("The node's system partition GPT entry looks off.") |
| 300 | } |
| 301 | // Verify the data partition's GPT entry. |
| 302 | data := (pi[2]).(*gpt.Partition) |
| 303 | if data.Name != osimage.DataVolumeLabel || data.Start == 0 || data.End == 0 { |
| 304 | t.Errorf("The node's data partition GPT entry looks off.") |
| 305 | } |
| 306 | // Verify that there are no more partitions. |
| 307 | fourth := (pi[3]).(*gpt.Partition) |
| 308 | if fourth.Name != "" || fourth.Start != 0 || fourth.End != 0 { |
| 309 | t.Error("The resulting node image contains more partitions than expected.") |
| 310 | } |
| 311 | // Verify the ESP contents. |
| 312 | if err := checkEspContents(storage); err != nil { |
| 313 | t.Error(err.Error()) |
| 314 | } |
Lorenz Brun | 0b93c8d | 2021-11-09 03:58:40 +0100 | [diff] [blame] | 315 | // Run QEMU again. Expect TestOS to launch successfully. |
| 316 | expectedOutput = "_TESTOS_LAUNCH_SUCCESS_" |
Serge Bazanski | e2e0371 | 2021-12-17 12:47:03 +0100 | [diff] [blame] | 317 | result, err = runQemu(ctx, qemuDriveParam(storagePath), expectedOutput) |
Lorenz Brun | 0b93c8d | 2021-11-09 03:58:40 +0100 | [diff] [blame] | 318 | if err != nil { |
| 319 | t.Error(err.Error()) |
| 320 | } |
| 321 | if result != true { |
| 322 | t.Errorf("QEMU didn't produce the expected output %q", expectedOutput) |
| 323 | } |
Mateusz Zalega | 43e2107 | 2021-10-08 18:05:29 +0200 | [diff] [blame] | 324 | } |