8000 Adding a test "framework" to run real world machine tests by Torxed · Pull Request #2500 · archlinux/archinstall · GitHub
[go: up one dir, main page]

Skip to content

Adding a test "framework" to run real world machine tests #2500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2063a65
Adding base functions for end to end testing using qemu tooling
Torxed May 13, 2024
589a09b
Fixing issue of: _Warning: Package 'archinstall.default_profiles' is …
Torxed May 13, 2024
9b2edb1
Merging in changes from branch fix-pybuild
Torxed May 13, 2024
3a19b50
Corrected the package name from 'where' to 'archinstall'
Torxed May 13, 2024
c097fc2
Merging in changes from branch fix-pybuild
Torxed May 13, 2024
583b865
Undoing change to 'package-data'
Torxed May 13, 2024
0ecf623
Merging in changes from branch fix-pybuild
Torxed May 13, 2024
8000
79021c1
Added a minimal test example of a runner that can cycle through the m…
Torxed May 13, 2024
a5cec12
Fixing flake8
Torxed May 13, 2024
a604afd
Merged changes in master
Torxed May 13, 2024
c6dd76e
Testing local runner
Torxed May 14, 2024
adaef17
Testing local runner
Torxed May 14, 2024
5c02fdb
Attempting to grab artifact from build job
Torxed May 14, 2024
0b8d386
Attempting to grab artifact from build job
Torxed May 14, 2024
8d34a8b
Attempting to call the qemu-tests from the iso-build to create a pipe…
Torxed May 14, 2024
3f07bb4
Attempting to call the qemu-tests from the iso-build to create a pipe…
Torxed May 14, 2024
83671b4
Figuring out github workflow job dependencies
Torxed May 14, 2024
02d2fee
Figuring out github workflow job dependencies
Torxed May 14, 2024
8a7f6e0
Figuring out github workflow job dependencies
Torxed May 14, 2024
c1214e2
Figuring out github workflow job dependencies
Torxed May 14, 2024
933d466
Making screen work in the gitlab runner
Torxed May 14, 2024
d251e83
Making sure the iso-build job and qemu-runner puts the ISO in the cor…
Torxed May 14, 2024
818b945
Making sure screen can be executed
Torxed May 14, 2024
7d815e5
Making sure OVMF things are in place
Torxed May 14, 2024
0161326
Making sure OVMF things are in place
Torxed May 14, 2024
7ffb0e0
Making sure OVMF things are in place
Torxed May 14, 2024
4d200e2
Making sure qemu images are in correct place
Torxed May 14, 2024
b5df588
Attempting to limit runner to set users
Torxed May 14, 2024
a21be09
Attempting to limit runner to set users
Torxed May 14, 2024
7ef8013
Attempting to limit runner to set users
Torxed May 14, 2024
4bb5056
rm syntax issue
Torxed May 14, 2024
5e526c4
testing resize of 'screen'
Torxed May 14, 2024
c09f570
Attempting to limit codereview spam while improving runner requirements
Torxed May 14, 2024
66d7b1e
Setting environment on job
Torxed May 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# As per https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#example-of-a-codeowners-file

* @Torxed

# Any PKGBUILD changes should tag grazzolini
/PKGBUILDs/ @grazzolini
/PKGBUILD @grazzolini
.github/* @Torxed
tests/qemu/* @Torxed
9 changes: 8 additions & 1 deletion .github/workflows/iso-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: pwd
- run: find .
- run: echo "Building for $GITHUB_ACTOR"
- run: cat /etc/os-release
- run: pacman-key --init
- run: pacman --noconfirm -Sy archlinux-keyring
Expand All @@ -37,3 +37,10 @@ jobs:
with:
name: Arch Live ISO
path: /tmp/archlive/out/*.iso
call-workflow-qemu-test:
name: call qemu testbench
needs: build
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/qemu-tests.yaml
42 changes: 42 additions & 0 deletions .github/workflows/qemu-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Runs Qemu test case pci_emulation

# This job is callewd from iso-build
on:
workflow_call:

jobs:
run-qemu:
name: qemu testbench
if: ${{ github.actor == 'Torxed' }}
runs-on: self-hosted
environment: testing
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@master
with:
name: Arch Live ISO
path: ./_work/iso/
- run: echo '' > ./tests/qemu/serial.log
# Generate a .screenrc that will auto-run the test
# as well as record it for publishing using asciinema.
- run: |
cat <<EOF >> .screenrc_test
startup_message off
chdir tests/qemu
screen 0 python run_test.py
split
focus down
resize 24
screen 1 asciinema rec demo.cast --overwrite -c "tail -f serial.log"
EOF
- run: pwd
- run: cp /usr/share/ovmf/x64/OVMF_VARS.fd ./tests/qemu/OVMF_VARS.fd
- run: rm -f -- ./tests/qemu/archtest.img
- run: qemu-img create -f qcow2 ./tests/qemu/archtest.img 10G
- run: tree -L 2
- run: cat .screenrc_test
- run: script -c "stty rows 24 && stty cols 80 && screen -c .screenrc_test"
- uses: actions/upload-artifact@v4
with:
name: archtest-pci_emulation
path: ./tests/qemu/demo.cast
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ SAFETY_LOCK
**/**.qcow2
**/**.log
**/**.fd
**/**.cast
**/**.pid
/test*.py
**/archiso
/guided.py
Expand Down
56 changes: 56 additions & 0 deletions tests/qemu/machines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# flake8: noqa E131

import pathlib
from runners import TestLeaveAllDefault

parameters = {
"pci_emulation" : {
'test_class' : TestLeaveAllDefault,
'arguments' : [
'/usr/bin/qemu-system-x86_64',
'-name', '"archinstall-test"',
'-display', 'none',
'-monitor', 'none',
'-nographic',
'-m', '4096',
'-smp', '4,sockets=1,dies=1,cores=4,threads=1',
'-usb', '-device', 'usb-host,vendorid=0x1050,productid=0x0407',
'-pidfile', f'{pathlib.Path(__file__).parent}/archinstall-test.pid',
'-cpu', 'host,topoext,kvm=off,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time',
'-enable-kvm',
'-object', 'rng-random,filename=/dev/urandom,id=rng0',
'-device', 'virtio-rng-pci,rng=rng0',
'-usbdevice', 'mouse',
'-global', 'driver=cfi.pflash01,property=secure,value=on',
'-machine', 'type=q35,accel=kvm,kernel_irqchip=on',
'-smbios', '"type=0,vendor=American Megatrends Inc.,version=P4.60,date=08/03/2021,release=08.03.2021"',
'-smbios', '"type=1,manufacturer=Inet_AB,product=To Be Filled By O.E.M.,version=To Be Filled By O.E.M.,serial=245797,uuid=4154a2b8-7b7f-0000-0000-000000000000,sku=To Be Filled By O.E.M.,family=To Be Filled By O.E.M."',
'-smbios', '"type=2,manufacturer=ASRock,product=X570 Taichi,version=,serial=M80-D00000012340asset=,location="',
'-smbios', '"type=3,manufacturer=To Be Filled By O.E.M.,version=To Be Filled By O.E.M.,serial=214345,asset=To Be Filled By O.E.M.,sku=To Be Filled By O.E.M."',
'-smbios', '"type=4,sock_pfx=AM4,manufacturer=Advanced Micro Devices,, Inc.,version=AMD Ryzen 9 5900X 12-Core Processor,serial=Unknown,asset=Unknown,part=Unknown"',
'-smbios', '"type=17,loc_pfx=DIMM 1,bank=P0 CHANNEL A,manufacturer=Unknown,serial=00000000,asset=Not Specified,part=CMK64GX4M2E3200C16,speed=2133"',
'-smbios', '"type=17,loc_pfx=DIMM 1,bank=P0 CHANNEL B,manufacturer=Unknown,serial=00000000,asset=Not Specified,part=CMK64GX4M2E3200C16,speed=2133"',
'-device', 'intel-iommu,device-iotlb=on,caching-mode=on',
'-device', 'pcie-root-port,port=0xe,chassis=8,id=pci.8,bus=pcie.0,multifunction=on,addr=0x6',
'-device', 'virtio-keyboard-pci,id=input1,bus=pci.8,addr=0x0',
'-device', 'pcie-root-port,port=0xf,chassis=9,id=pci.9,bus=pcie.0,addr=0x6.0x1',
'-device', 'pcie-root-port,port=0x11,chassis=13,id=pci.13,bus=pcie.0,addr=0x6.0x3',
'-drive', 'if=pflash,format=raw,readonly=on,file=/usr/share/ovmf/x64/OVMF_CODE.secboot.fd',
'-drive', f'if=pflash,format=raw,file={pathlib.Path(__file__).parent}/OVMF_VARS.fd',
# '-tpmdev', 'passthrough,id=tpm0,path=/dev/tpm0,cancel-path=/tmp/foo-cancel2',
# '-device', 'tpm-tis,tpmdev=tpm0',
'-object', 'iothread,id=iothread1',
'-device', 'virtio-scsi-pci,bus=pcie.0,id=scsi2,addr=0x8',
'-device', 'virtio-scsi-pci,iothread=iothread1,id=scsi0,num_queues=8,bus=pci.13,addr=0x0',
'-device', '"scsi-hd,serial=S5GBAD12345ABCE,drive=libvirt-1-format,bus=scsi2.0,id=scsi0-0-0-0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi0-0-0-0,bootindex=2,write-cache=on"',
'-blockdev', '\'{"driver":"file","filename":"./archtest.img","aio":"threads","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}\'',
'-blockdev', '\'{"node-name":"libvirt-1-format","read-only":false,"discard":"unmap","cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":null}\'',
'-device', 'pcie-root-port,multifunction=on,bus=pcie.0,id=port9-0,addr=0x9,chassis=0',
'-device', 'virtio-net-pci,mac=FE:00:00:00:00:01,id=network0,netdev=network0.0,status=on,bus=port9-0',
'-netdev', 'tap,ifname=tap0,id=network0.0,script=no,downscript=no',
'-audiodev', 'pipewire,id=win11',
'-device', 'ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x1b',
'-device', 'hda-micro,audiodev=win11',
]
}
}
Loading
0