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 .github/workflows/ubuntu-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
apache2-utils \
bash-completion \
codespell \
dbus \
fish \
flatpak \
gcc \
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ go_md2man = find_program('go-md2man')

bats = find_program('bats', required: false)
codespell = find_program('codespell', required: false)
dbus_daemon = find_program('dbus-daemon', required: false)
htpasswd = find_program('htpasswd', required: false)
openssl = find_program('openssl', required: false)

Expand Down
3 changes: 2 additions & 1 deletion playbooks/dependencies-centos-9-stream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
become: yes
package:
name:
- dbus-daemon
- flatpak-session-helper
- gcc
- golang
Expand Down Expand Up @@ -61,7 +62,7 @@
chdir: '{{ zuul.project.src_dir }}'

- name: Check versions of crucial packages
command: rpm -qa ShellCheck bash bash-completion bats codespell *kernel* gcc *glibc* golang golang-github-cpuguy83-md2man shadow-utils-subid-devel podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo
command: rpm -qa ShellCheck bash bash-completion bats codespell dbus-daemon *kernel* gcc *glibc* golang golang-github-cpuguy83-md2man shadow-utils-subid-devel podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo

- name: Show podman versions
command: podman version
Expand Down
9 changes: 9 additions & 0 deletions playbooks/dependencies-fedora-restricted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
update_cache: "{{ true if zuul.attempts > 1 else false }}"
use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}"

- name: Ensure that dbus-daemon(1) is absent
become: yes
package:
name:
- dbus-daemon
state: absent
update_cache: "{{ true if zuul.attempts > 1 else false }}"
use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}"

- name: Ensure that 'p11-kit server' is absent
become: yes
package:
Expand Down
3 changes: 2 additions & 1 deletion playbooks/dependencies-fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- ShellCheck
- bats
- codespell
- dbus-daemon
- fish
- flatpak-session-helper
- gcc
Expand Down Expand Up @@ -64,7 +65,7 @@
chdir: '{{ zuul.project.src_dir }}'

- name: Check versions of crucial packages
command: rpm -qa ShellCheck bash bash-completion bats codespell *kernel* gcc *glibc* shadow-utils-subid-devel golang golang-github-cpuguy83-md2man podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo
command: rpm -qa ShellCheck bash bash-completion bats codespell dbus-daemon *kernel* gcc *glibc* shadow-utils-subid-devel golang golang-github-cpuguy83-md2man podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo

- name: Show podman versions
command: podman version
Expand Down
4 changes: 2 additions & 2 deletions playbooks/setup-env-migration-path-for-coreos-toolbox.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2022 – 2024 Red Hat, Inc.
# Copyright © 2022 – 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,6 @@
- include_tasks: dependencies-centos-9-stream.yaml

- name: Set up build directory
command: meson -Dmigration_path_for_coreos_toolbox=true builddir
command: meson setup -Dmigration_path_for_coreos_toolbox=true builddir
args:
chdir: '{{ zuul.project.src_dir }}'
39 changes: 2 additions & 37 deletions src/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func ForwardToHost() (int, error) {
// https://github.com/containers/libpod/tree/master/pkg/cgroups
func GetCgroupsVersion() (int, error) {
var st syscall.Statfs_t

if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil {
return -1, err
}
Expand Down Expand Up @@ -474,40 +473,6 @@ func GetInitializedStamp(entryPointPID int, targetUser *user.User) (string, erro
return initializedStamp, nil
}

// GetMountPoint returns the mount point of a target.
func GetMountPoint(target string) (string, error) {
var stdout strings.Builder

if err := shell.Run("df", nil, &stdout, nil, "--output=target", target); err != nil {
return "", err
}

output := stdout.String()
options := strings.Split(output, "\n")
if len(options) != 3 {
return "", errors.New("unexpected output from df(1)")
}

mountPoint := strings.TrimSpace(options[1])
return mountPoint, nil
}

// GetMountOptions returns the mount options of a target.
func GetMountOptions(target string) (string, error) {
var stdout strings.Builder
findMntArgs := []string{"--noheadings", "--output", "OPTIONS", target}

if err := shell.Run("findmnt", nil, &stdout, nil, findMntArgs...); err != nil {
return "", err
}

output := stdout.String()
options := strings.Split(output, "\n")

mountOptions := strings.TrimSpace(options[0])
return mountOptions, nil
}

func GetP11KitServerSocket(targetUser *user.User) (string, error) {
toolbxRuntimeDirectory, err := GetRuntimeDirectory(targetUser)
if err != nil {
Expand Down Expand Up @@ -579,6 +544,7 @@ func GetSupportedDistros() []string {
for d := range supportedDistros {
distros = append(distros, d)
}

return distros
}

Expand All @@ -596,12 +562,12 @@ func ImageReferenceCanBeID(image string) bool {
if err != nil {
panic("regular expression for ID reference matching is invalid")
}

return matched
}

func ImageReferenceGetBasename(image string) string {
var i int

if ImageReferenceHasDomain(image) {
i = strings.IndexRune(image, '/')
}
Expand Down Expand Up @@ -629,7 +595,6 @@ func ImageReferenceGetDomain(image string) string {

func ImageReferenceGetTag(image string) string {
var i int

if ImageReferenceHasDomain(image) {
i = strings.IndexRune(image, '/')
}
Expand Down
2 changes: 1 addition & 1 deletion test/system/203-network.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ readonly RESOLVER_SH='resolvectl --legend false --no-pager --type "$0" query "$1

setup_file() {
bats_require_minimum_version 1.10.0
cleanup_all
# cleanup_all
pushd "$HOME" || return 1

if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then
Expand Down
23 changes: 23 additions & 0 deletions test/system/config/containers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright © 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

[containers]
default_sysctls = [
"net.ipv4.ping_group_range=0 0",
]

[engine]
cgroup_manager = "cgroupfs"
29 changes: 29 additions & 0 deletions test/system/config/dbus-session.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
Copyright © 2025 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<fork/>
<listen>unix:runtime=yes</listen>
<policy context="default">
<allow eavesdrop="true"/>
<allow own="*"/>
<allow send_destination="*" eavesdrop="true"/>
</policy>
<standard_session_servicedirs/>
<type>session</type>
</busconfig>
37 changes: 34 additions & 3 deletions test/system/libs/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ export XDG_CONFIG_HOME
readonly XDG_DATA_HOME="$HOME/.local/share"
export XDG_DATA_HOME

readonly XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$UID}"
readonly XDG_RUNTIME_DIR="$BATS_SUITE_TMPDIR/xdg-runtime-dir"
export XDG_RUNTIME_DIR

readonly XDG_STATE_HOME="$HOME/.local/state"
export XDG_STATE_HOME

readonly CONTAINERS_CONF="$BATS_TEST_DIRNAME/config/containers.conf"
export CONTAINERS_CONF

readonly CONTAINERS_STORAGE_CONF="$XDG_CONFIG_HOME/containers/storage.conf"
export CONTAINERS_STORAGE_CONF

readonly DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
export DBUS_SESSION_BUS_ADDRESS

# Helpful globals
readonly IMAGE_CACHE_DIR="$BATS_SUITE_TMPDIR/image-cache"
readonly TOOLBX_ROOTLESS_STORAGE_PATH="$XDG_DATA_HOME/containers/storage"
Expand All @@ -49,14 +55,39 @@ declare -Ag IMAGES=([arch]="quay.io/toolbx/arch-toolbox" \


function cleanup_all() {
podman rm --all --force >/dev/null
podman rmi --all --force >/dev/null
ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 1)"
cat "$XDG_RUNTIME_DIR/crun/$ctr_id/status"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi

ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 2 | tail --lines 1)"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi

ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 3 | tail --lines 1)"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi

podman --log-level debug stop --all
podman rm --all
podman rmi --all
}


function _setup_environment() {
# shellcheck disable=SC2174
mkdir --mode 700 --parents "$HOME"
mkdir --mode 0700 --parents "$XDG_RUNTIME_DIR"

_setup_containers_storage
}

Expand Down
13 changes: 10 additions & 3 deletions test/system/setup_suite.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.
#

dbus_daemon_pid=0
missing_dependencies=false

if [ -f "$BATS_TEST_DIRNAME/libs/bats-assert/load.bash" ] && [ -f "$BATS_TEST_DIRNAME/libs/bats-support/load.bash" ]; then
Expand All @@ -40,6 +41,7 @@ setup_suite() {
system_version="$(get_system_version)"

_setup_environment
dbus_daemon_pid="$(dbus-daemon --config-file "$BATS_TEST_DIRNAME/config/dbus-session.conf" --print-pid)"

if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then
_pull_and_cache_distro_image arch latest || false
Expand Down Expand Up @@ -67,7 +69,7 @@ setup_suite() {
_pull_and_cache_distro_image fedora "$((system_version-2))" || false
fi

_setup_docker_registry
# _setup_docker_registry
fi
}

Expand All @@ -79,9 +81,14 @@ teardown_suite() {
return 0
fi

if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "commands-options" >/dev/null 2>/dev/null; then
_clean_docker_registry
if [ "$dbus_daemon_pid" != 0 ]; then
kill -s SIGTERM "$dbus_daemon_pid"
dbus_daemon_pid=0
fi

# if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "commands-options" >/dev/null 2>/dev/null; then
# _clean_docker_registry
# fi

podman system reset --force >/dev/null
}
Loading