Allow desktop transaction tests to set QEMU memory
@@ -22,6 +22,9 @@ bootloader. It uses a diskless QEMU virt machine with GICv3. The probe
2222checks BusyBox init, shell arithmetic, applet links, `uname -o`, and the
2323Vinix allocator's `malloc_trim`. It compares the SHA-256 of the executable
2424and the dynamic loader printed in the guest with their installed files.
25+For a full desktop transaction, set `VINIX_QEMU_MEMORY_MIB=2048` to use the
26+same guest memory as the default desktop smoke test. Userland fixtures use
27+512 MiB by default.
2528
2629For the full release applet check, install `busybox`, `busybox-init` and their
2730runtime dependencies into a separate root. The fixture checks the target
@@ -23,6 +23,19 @@ fn boot_image(root string, iso string, output string, mode string, fixture strin
2323 shell := mode == '--shell'
2424 arm := mode.starts_with('--aarch64-')
2525 userland := mode in ['--userland', '--aarch64-userland'] || fixture != ''
26+ default_memory := if userland {
27+ '512'
28+ } else if arm {
29+ '384'
30+ } else {
31+ '1024'
32+ }
33+ memory := strconv.atoi(os.getenv_opt('VINIX_QEMU_MEMORY_MIB') or { default_memory }) or {
34+ return error('VINIX_QEMU_MEMORY_MIB must be a positive integer in MiB')
35+ }
36+ if memory <= 0 {
37+ return error('VINIX_QEMU_MEMORY_MIB must be a positive integer in MiB')
38+ }
2639 musl := mode in ['--musl', '--aarch64-musl']
2740 machine := if arm { 'aarch64' } else { 'x86_64' }
2841 acceleration := os.getenv_opt('VINIX_QEMU_ACCEL') or { 'tcg' }
@@ -67,7 +80,11 @@ fn boot_image(root string, iso string, output string, mode string, fixture strin
6780 os.write_file(os.join_path(additions, 'etc/inittab'), inittab + '\n')!
6881 mut loader_digest := ''
6982 if userland {
70- source := if fixture != '' { fixture } else { os.join_path(os.dir(@FILE), '..', 'userland', 'check.sh') }
83+ source := if fixture != '' {
84+ fixture
85+ } else {
86+ os.join_path(os.dir(@FILE), '..', 'userland', 'check.sh')
87+ }
7188 os.cp(source, os.join_path(additions, helper))!
7289 } else {
7390 source := if shell { 'serial-line.v' } else { 'guest.v' }
@@ -124,21 +141,15 @@ fn boot_image(root string, iso string, output string, mode string, fixture strin
124141 if disk != '' {
125142 drive := 'format=raw,snapshot=on,file=' + disk.replace(',', ',,')
126143 if arm {
127- emulator << ['-drive', 'if=none,id=ports,' + drive, '-device', 'virtio-blk-device,drive=ports']
144+ emulator << ['-drive', 'if=none,id=ports,' + drive, '-device',
145+ 'virtio-blk-device,drive=ports']
128146 } else {
129147 // The x86 release kernel probes ATA and AHCI before choosing the root.
130148 emulator << ['-drive', 'if=ide,' + drive]
131149 }
132150 }
133- memory := if userland {
134- '512'
135- } else if arm {
136- '384'
137- } else {
138- '1024'
139- }
140- emulator << ['-accel', acceleration, '-cpu', cpu, '-m', memory, '-smp', '2', '-nic', 'none', '-display',
141- 'none', '-monitor', 'none', '-serial', 'file:' + log, '-no-reboot']
151+ emulator << ['-accel', acceleration, '-cpu', cpu, '-m', memory.str(), '-smp', '2', '-nic',
152+ 'none', '-display', 'none', '-monitor', 'none', '-serial', 'file:' + log, '-no-reboot']
142153 run(['timeout', '${deadline}s', ...emulator])!
143154 lines := os.read_lines(log)!.map(it.trim_space())
144155 if disk != '' {