Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions examples/answers/bridge.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#source-catalog: examples/sources/bridge.yaml
#environ: examples/environ/has-drivers-no-oem
Source:
source: ubuntu-server
search_drivers: true
Expand Down
1 change: 1 addition & 0 deletions examples/environ/has-drivers-no-oem
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBIQUITY_DEBUG="has-drivers-no-oem"
10 changes: 9 additions & 1 deletion scripts/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ on_exit () {
exit $ec
}

testenv() {
environ="${1:-/dev/null}"
shift

env $(< $environ) LANG=C.UTF-8 "$@"
Copy link
Member

@ogayot ogayot Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to preserve the double quotes you have in your env file - but it's only fine to remove them if there's no whitespaces.

You could do "$(< $environ)" instead of $(< environ), but it's not going to work if there's multiple variables defined in the env file.

Sourcing the file is probably easier ...

}

trap on_exit EXIT
tty=$(tty) || tty=/dev/console

Expand All @@ -113,6 +120,7 @@ for answers in examples/answers/*.yaml; do
config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true)
catalog=$(sed -n 's/^#source-catalog: \(.*\)/\1/p' $answers || true)
dr_config=$(sed -n 's/^#dr-config: \(.*\)/\1/p' "$answers" || true)
environ=$(sed -n 's/^#environ: \(.*\)/\1/p' "$answers" || true)
if [ -z "$config" ]; then
config=examples/machines/simple.json
fi
Expand All @@ -128,7 +136,7 @@ for answers in examples/answers/*.yaml; do
opts+=(--dry-run-config "$dr_config")
fi
# The --foreground is important to avoid subiquity getting SIGTTOU-ed.
LANG=C.UTF-8 timeout --foreground 60 \
testenv "$environ" timeout --foreground 60 \
python3 -m subiquity.cmd.tui < "$tty" \
--dry-run \
--output-base "$tmpdir" \
Expand Down
13 changes: 12 additions & 1 deletion subiquity/server/ubuntu_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ async def list_oem(self, root_dir: str, context) -> List[str]:
return self.oem_metapackages


class UbuntuDriversHasDriversNoOEMInterface(UbuntuDriversHasDriversInterface):
"""A dry-run implementation of ubuntu-drivers that returns drivers package
and an empty OEM metapackage list."""

gpgpu_drivers: List[str] = ["nvidia-driver-470-server"]
not_gpgpu_drivers: List[str] = ["nvidia-driver-510"]
oem_metapackages: List[str] = []


class UbuntuDriversNoDriversInterface(UbuntuDriversHasDriversInterface):
"""A dry-run implementation of ubuntu-drivers that returns a hard-coded
empty list of drivers."""
Expand Down Expand Up @@ -408,7 +417,9 @@ def get_ubuntu_drivers_interface(app) -> UbuntuDriversInterface:
cls = UbuntuDriversNoDriversInterface
elif "run-drivers" in app.debug_flags:
cls = UbuntuDriversRunDriversInterface
else:
elif "has-drivers-no-oem" in app.debug_flags:
cls = UbuntuDriversHasDriversNoOEMInterface
else: # "has-drivers"
cls = UbuntuDriversHasDriversInterface

if app.opts.kernel_cmdline.get("subiquity-fake-pci-devices"):
Expand Down