]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
CI: Add systemd-nspawn boot test 514/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 15 Aug 2020 21:20:10 +0000 (22:20 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Aug 2020 16:27:07 +0000 (17:27 +0100)
.github/workflows/ci.yml
tests/pexpect/boot.py [new file with mode: 0755]

index ec73f53768837a6e1c9434d53ea4f4105e8080dd..eaf51413c04c92c9d414342f2fd031e773a45382 100644 (file)
@@ -51,11 +51,30 @@ jobs:
     - uses: actions/checkout@v2
     - uses: ./.github/actions/setup-mkosi
 
+    - name: Install pexpect
+      run: sudo apt-get install python3-pexpect
+
     - name: Build ${{ matrix.distro }}/${{ matrix.format }}
-      run: sudo ./mkosi
-            --debug run
-            --distribution ${{ matrix.distro }}
-            --format ${{ matrix.format }}
+      run: |
+        tee mkosi.default << EOF
+        [Distribution]
+        Distribution=${{ matrix.distro }}
+
+        [Output]
+        Format=${{ matrix.format }}
+
+        [Validation]
+        # Set to empty password if we ever get opensuse to work with empty root password.
+        # See https://github.com/systemd/mkosi/pull/514.
+        Password=root
+        EOF
+
+        sudo ./mkosi build
+
+    - name: Boot ${{ matrix.distro }}/${{ matrix.format }}
+      # photon boot gets stuck on systemd-networkd-wait-online. See https://github.com/systemd/mkosi/pull/514.
+      if: matrix.format != 'tar' && matrix.distro != 'photon'
+      run: sudo ./tests/pexpect/boot.py ./mkosi boot
 
     - name: Build ${{ matrix.distro }}/${{ matrix.format }} UEFI
       if: matrix.format != 'directory' && matrix.format != 'tar' && matrix.format != 'plain_squashfs' &&
diff --git a/tests/pexpect/boot.py b/tests/pexpect/boot.py
new file mode 100755 (executable)
index 0000000..ad2b7ee
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+
+import pexpect
+import sys
+
+
+def run() -> None:
+    p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=45)
+
+    p.expect("login:")
+    p.sendline("root")
+
+    p.expect("Password:")
+    p.sendline("root")
+
+    p.expect("#")
+    p.sendline("systemctl poweroff")
+
+    p.expect(pexpect.EOF)
+
+
+try:
+    run()
+except pexpect.EOF:
+    print("UNEXPECTED EOF")
+    sys.exit(1)
+except pexpect.TIMEOUT:
+    print("TIMED OUT")
+    sys.exit(1)
+