patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 73539efc99814d16eee268524cf415f60b7235fa 1307 bytes (raw)
name: release/checks/try.nix 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>

import ../../lib/eval-config.nix ({ config, ... }:

let
  live = import ../live { inherit config; };
in

config.pkgs.nixosTest ({ pkgs, ... }: {
  name = "try-spectrum-test";
  nodes = {};

  testScript = ''
    import shlex
    import subprocess

    conf = subprocess.run([
      "${pkgs.mtools}/bin/mcopy",
      "-i",
      "${live}@@1M",
      "::loader/entries/spectrum.conf",
      "-",
    ], stdout=subprocess.PIPE)
    conf.check_returncode()

    cmdline = None
    for line in conf.stdout.decode('utf-8').splitlines():
      key, value = line.split(' ', 1)
      if key == 'options':
        cmdline = value

    flags = " ".join(map(shlex.quote, [
      "qemu-kvm",
      "-m", "512",
      "-kernel", "${live.rootfs.kernel}/${pkgs.stdenv.hostPlatform.linux-kernel.target}",
      "-initrd", "${live.initramfs}",
      "-device", "qemu-xhci",
      "-device", "usb-storage,drive=drive1,removable=true",
      "-drive", "file=${live},id=drive1,format=raw,if=none,readonly=on",
      "-append", f"panic=-1 {cmdline}",
    ]))

    machine = create_machine({"startCommand": flags})

    machine.start()
    machine.wait_for_console_text("EXT4-fs \(sda4\): mounted filesystem")
    machine.crash()
  '';
}))

debug log:

solving 73539ef ...
found 73539ef in https://inbox.spectrum-os.org/spectrum-devel/20230526210757.397735-1-hi@alyssa.is/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20230526210757.397735-1-hi@alyssa.is/
diff --git a/release/checks/try.nix b/release/checks/try.nix
new file mode 100644
index 0000000..73539ef

Checking patch release/checks/try.nix...
Applied patch release/checks/try.nix cleanly.

index at:
100644 73539efc99814d16eee268524cf415f60b7235fa	release/checks/try.nix

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).