Skip to content

Commit

Permalink
Noble 24.04 move snap provider checkbox24 (#247)
Browse files Browse the repository at this point in the history
* tests : move checkbox provider to use core24 and checkbox24

* disable linter warnings

+ remove setting PYTHONPATH because it is not useful

* remove useless instructions in checkbox-cli-wrapper

* fix wrong comments and remove wrong instructions in install-full-deps script

* reduce supported architectures

* gh action : move to checkbox24
  • Loading branch information
hector-cao authored Oct 18, 2024
1 parent 937ddaf commit ce70b02
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 58 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/create-snap-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:

check-secret:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
snap-key: ${{ steps.snap-key.outputs.defined }}
steps:
Expand All @@ -30,7 +30,7 @@ jobs:
SNAPSTORE_KEY: ${{ secrets.SNAPCRAFT7_CREDS }}

build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [check-secret]
steps:
- uses: actions/checkout@v4
Expand All @@ -45,7 +45,7 @@ jobs:

- name: Verify snap
run: |
sudo snap install checkbox22
sudo snap install checkbox24
sudo snap install --dangerous --classic ${{ steps.build.outputs.snap }}
- if: needs.check-secret.outputs.snap-key == 'true' && (github.ref_name == 'noble-24.04')
Expand Down
2 changes: 1 addition & 1 deletion tests/bin/setup-env-and-run
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PROVIDER_FOLDER=${SNAP}/providers/checkbox-provider-tdx
# for provider python simple utilities
export PYTHONPATH=${PYTHONPATH}:${PROVIDER_FOLDER}/lib
# for tdxtools package
export PYTHONPATH=${PYTHONPATH}:${SNAP}/lib/python3.10/site-packages/
export PYTHONPATH=${PYTHONPATH}:${SNAP}/lib/python3.12/site-packages/

PYTEST_CACHE=${PLAINBOX_SESSION_SHARE}/pytest/.pytest_cache
mkdir -p ${PYTEST_CACHE}
Expand Down
6 changes: 1 addition & 5 deletions tests/checkbox/bin/checkbox-cli-wrapper
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/sh

# Remove temporary folder and rebuild in setup-env-and-run
TMP_FOLDER=/tmp/snap/checkbox-tdx
rm -rf ${TMP_FOLDER}

# wrapper around the checkbox-cli
# can't use /snap/bin/checkbox.checkbox-cli as it will run
# within the context of the wrong snap and the tdx tests
# won't get discovered via PROVIDERPATH
# checkbox-cli resolves to /snap/checkbox22/current/bin/checkbox-cli
# checkbox-cli resolves to /snap/checkbox24/current/bin/checkbox-cli
exec checkbox-cli "$@"
6 changes: 1 addition & 5 deletions tests/checkbox/bin/checkbox-cli-wrapper-image
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ if ! test -f $TDXTEST_GUEST_IMG; then
exit 1
fi

# Remove temporary folder and rebuild in setup-env-and-run
TMP_FOLDER=/tmp/snap/checkbox-tdx
rm -rf ${TMP_FOLDER}

# wrapper around the checkbox-cli
# can't use /snap/bin/checkbox.checkbox-cli as it will run
# within the context of the wrong snap and the tdx tests
# won't get discovered via PROVIDERPATH
# checkbox-cli resolves to /snap/checkbox22/current/bin/checkbox-cli
# checkbox-cli resolves to /snap/checkbox24/current/bin/checkbox-cli
exec checkbox-cli "$@"
10 changes: 5 additions & 5 deletions tests/checkbox/bin/configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import re
import sys

sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages"))
sitepkgpath = "$SNAP/lib/python3.10/site-packages"
sitepkgpath = "$SNAP/lib/python3.12/site-packages"
sys.path.append(os.path.expandvars(sitepkgpath))

sys.path.append(os.path.expandvars(
"/snap/checkbox22/current/usr/lib/python3/dist-packages"))
runtimepath = "/snap/checkbox22/current/lib/python3.10/site-packages"
"/snap/checkbox24/current/usr/lib/python3/dist-packages"))
runtimepath = "/snap/checkbox24/current/lib/python3.12/site-packages"
sys.path.append(os.path.expandvars(runtimepath))

try:
Expand All @@ -24,9 +24,9 @@ try:
except ImportError:
msg = """
checkbox-support not found!
You need to install the checkbox22 snap:
You need to install the checkbox24 snap:
snap install checkbox22
snap install checkbox24
"""
print(os.path.expandvars(msg), file=sys.stderr)
sys.exit(1)
Expand Down
13 changes: 1 addition & 12 deletions tests/checkbox/bin/install-full-deps
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#!/bin/bash

sudo apt install -y gstreamer1.0-vaapi gstreamer1.0-tools vainfo mpv python3-tinydb python3-jinja2 \
wl-clipboard gnome-screensaver gnome-screenshot ffmpeg

# kivu team PPA
sudo apt-add-repository -y 'ppa:kivuteam/ppa'
sudo apt update

# ydotool
sudo apt install -y ydotool ydotoold

# gfxi
sudo apt install -y gfxi
# setup the host system before the tests
12 changes: 3 additions & 9 deletions tests/checkbox/bin/wrapper_local
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
case "$SNAP_ARCH" in
"amd64") ARCH='x86_64-linux-gnu'
;;
"i386") ARCH='i386-linux-gnu'
;;
"arm64") ARCH='aarch64-linux-gnu'
;;
"armhf") ARCH='arm-linux-gnueabihf'
;;
*)
echo "Unsupported architecture: $SNAP_ARCH"
;;
Expand All @@ -18,12 +12,12 @@ esac
# Launcher common exports for any checkbox app #
################################################

RUNTIME=/snap/checkbox22/current
RUNTIME=/snap/checkbox24/current
if [ ! -d "$RUNTIME" ]; then
echo "You need to install the checkbox22 snap."
echo "You need to install the checkbox24 snap."
echo ""
echo "You can do this with this command:"
echo "snap install checkbox22"
echo "snap install checkbox24"
exit 1
fi

Expand Down
10 changes: 5 additions & 5 deletions tests/snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ import os
import sys

sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages"))
sitepkgpath = "$SNAP/lib/python3.10/site-packages"
sitepkgpath = "$SNAP/lib/python3.12/site-packages"
sys.path.append(os.path.expandvars(sitepkgpath))

sys.path.append(os.path.expandvars(
"/snap/checkbox22/current/usr/lib/python3/dist-packages"))
runtimepath = "/snap/checkbox22/current/lib/python3.10/site-packages"
"/snap/checkbox24/current/usr/lib/python3/dist-packages"))
runtimepath = "/snap/checkbox24/current/lib/python3.12/site-packages"
sys.path.append(os.path.expandvars(runtimepath))

try:
from checkbox_support.snap_utils.config import refresh_configuration
except ImportError:
msg = """
checkbox-support not found!
You need to install the checkbox22 snap:
You need to install the checkbox24 snap:
snap install checkbox22
snap install checkbox24
"""
print(os.path.expandvars(msg), file=sys.stderr)
sys.exit(1)
Expand Down
26 changes: 13 additions & 13 deletions tests/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '1.0.0'
confinement: classic
grade: stable

base: core22
base: core24

# Here are the available applications of the TDX checkbox provider snap
# To run : snap run checkbox-tdx.<app>
Expand All @@ -17,23 +17,16 @@ base: core22
# - inject environment variable into checkbox snap environnement
# the variable initial list can be found in config/config_vars
# use configure -l to get the list of the current variables
# For example, a useful use case is to inject environment variable
# to enable debugging output (LIBVA_MESSAGING_LEVEL)
# remote-slave:
# - checkbox slave daemon that will the responsible for running the test sesssion
# in the remote fashion (through checkbox-cli)
# test-runner / test-runner-automated:
# test-runner / test-runner-automated-xxx:
# - execute all provider tests inside the snap environment
# the test execution is standalone and does not depend on the remote-slave daemon
# shell:
# - give shell access to the provider snap
# test-runner-automated-hwdec:
# - execute hardware decoding tests
# the test execution is standalone and does not depend on the remote-slave daemon
# install-full-deps:
# - install all depedencies needed for provider jobs
# media-stress-test
# - execute hardware decoding tests which max out the video engines
apps:
checkbox-cli:
command-chain: [bin/wrapper_local]
Expand Down Expand Up @@ -88,16 +81,17 @@ parts:
source-type: local
build-snaps:
- checkbox-provider-tools
- checkbox22
- checkbox24
stage-packages:
- python3-parameterized
- python3-paramiko
- python3-pytest
- sshpass
- cpuid
override-build: |
export PYTHONPATH=$SNAPCRAFT_STAGE/lib/python3.10/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages
for path in $(find "/snap/checkbox22/current/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done
# the validation tool needs to access the to all checkbox providers
# we have to set the PROVIDERPATH to point to them
for path in $(find "/snap/checkbox24/current/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done
checkbox-provider-tools validate
checkbox-provider-tools build
checkbox-provider-tools install --layout=relocatable --prefix=/providers/checkbox-provider-tdx --root="$SNAPCRAFT_PART_INSTALL"
Expand All @@ -112,7 +106,7 @@ parts:
source: lib/tdx-tools/
source-type: local
stage-packages:
- python3.10-minimal
- python3.12-minimal

provider-bin:
plugin: dump
Expand Down Expand Up @@ -140,3 +134,9 @@ parts:
plugin: dump
source: checkbox/config/

# ignore rpath and interpreter link warnings
lint:
ignore:
- classic
- library:
- usr/bin/cpuid

0 comments on commit ce70b02

Please sign in to comment.