diff --git a/checkbox-core-snap/common_files/config/wrapper_common b/checkbox-core-snap/common_files/config/wrapper_common index 762414d143..36d0c27742 100644 --- a/checkbox-core-snap/common_files/config/wrapper_common +++ b/checkbox-core-snap/common_files/config/wrapper_common @@ -17,6 +17,7 @@ else append_path LD_LIBRARY_PATH $RUNTIME/lib append_path LD_LIBRARY_PATH $RUNTIME/lib/$ARCH append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH + append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/fwts append_path LD_LIBRARY_PATH $RUNTIME/lib/fwts append_path GI_TYPELIB_PATH $RUNTIME/usr/lib/girepository-1.0 append_path GI_TYPELIB_PATH $RUNTIME/usr/lib/$ARCH/girepository-1.0 diff --git a/checkbox-core-snap/common_files/config/wrapper_common_classic b/checkbox-core-snap/common_files/config/wrapper_common_classic index d64634bbf3..f0b633b19e 100644 --- a/checkbox-core-snap/common_files/config/wrapper_common_classic +++ b/checkbox-core-snap/common_files/config/wrapper_common_classic @@ -25,6 +25,7 @@ else append_path LD_LIBRARY_PATH $RUNTIME/lib append_path LD_LIBRARY_PATH $RUNTIME/lib/$ARCH append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH + append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/fwts append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/blas append_path LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/lapack append_path LD_LIBRARY_PATH $RUNTIME/lib/fwts diff --git a/checkbox-core-snap/series24/.gitignore b/checkbox-core-snap/series24/.gitignore new file mode 100644 index 0000000000..281cc4dbcf --- /dev/null +++ b/checkbox-core-snap/series24/.gitignore @@ -0,0 +1,21 @@ +*.pyc +*.snap +__pycache__ +build/mo/* +dist/*.tar.gz +parts/ +snap/.snapcraft +snap/gui/ +stage/ +prime/ + +# following files are populated by the prepare.sh script and should be ignored +config/ +checkbox-ng/ +checkbox-support/ +providers/ +version.txt + +# following files are the result of the build process +checkbox*.txt +checkbox*.snap diff --git a/checkbox-core-snap/series24/snap/snapcraft.yaml b/checkbox-core-snap/series24/snap/snapcraft.yaml new file mode 100644 index 0000000000..e92148924c --- /dev/null +++ b/checkbox-core-snap/series24/snap/snapcraft.yaml @@ -0,0 +1,503 @@ +name: checkbox24 +summary: Checkbox runtime and public providers +description: "Checkbox runtime and public providers" +grade: devel +confinement: strict + +adopt-info: version-calculator + +base: core24 +build-base: devel + +# Don't forget to add a new slot if a new provider part is added in the parts +# section below. +slots: + provider-resource: + interface: content + read: + - $SNAP/providers/checkbox-provider-resource + provider-checkbox: + interface: content + read: + - $SNAP/providers/checkbox-provider-base + provider-docker: + interface: content + read: + - $SNAP/providers/checkbox-provider-docker + provider-tpm2: + interface: content + read: + - $SNAP/providers/checkbox-provider-tpm2 + provider-iiotg: + interface: content + read: + - $SNAP/providers/checkbox-provider-iiotg + provider-engineering-tests: + interface: content + read: + - $SNAP/providers/checkbox-provider-engineering-tests + provider-sru: + interface: content + read: + - $SNAP/providers/checkbox-provider-sru + provider-gpgpu: + interface: content + read: + - $SNAP/providers/checkbox-provider-gpgpu + provider-certification-client: + interface: content + read: + - $SNAP/providers/checkbox-provider-certification-client + provider-certification-server: + interface: content + read: + - $SNAP/providers/checkbox-provider-certification-server + provider-tutorial: + interface: content + read: + - $SNAP/providers/checkbox-provider-tutorial + checkbox-runtime: + interface: content + read: + - / + +package-repositories: + - type: apt + ppa: checkbox-dev/stable + +parts: + version-calculator: + plugin: dump + source: . + override-pull: | + craftctl default + # version.txt created by prepare.sh + export version=`cat $CRAFT_PART_SRC/version.txt` + [ $version ] || exit 1 + craftctl set version=$version + stage: + - version.txt +################################################################################ + fwts: + plugin: nil + stage-packages: + - fwts + after: [version-calculator] +################################################################################ + stress-ng: + plugin: nil + stage-packages: + - stress-ng + after: [fwts] +################################################################################ + acpi-tools: + plugin: nil + stage-packages: + - acpica-tools + after: [stress-ng] +################################################################################ + checkbox-support: + plugin: python + source: checkbox-support + source-type: local + stage-packages: + # actual requirements + - python3-bluez + - python3-pyparsing + - python3-requests-unixsocket + - python3-systemd + # added to stage python: + - libpython3-stdlib + - libpython3.12-stdlib + - libpython3.12-minimal + - python3-pip + - python3-setuptools + - python3-wheel + - python3-venv + - python3-minimal + - python3-pkg-resources + - python3.12-minimal + build-packages: + - libbluetooth-dev + - python3-dev + python-packages: + - pynmea2 + after: [acpi-tools] + stage: + - -pyvenv.cfg + - -bin/activate* + - -**/RECORD + - -**/__pycache__ + - -debian + build-environment: + - C_INCLUDE_PATH: /usr/include/python3.12 + - PYTHONPATH: $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages:${PYTHONPATH:-} + - SETUPTOOLS_SCM_PRETEND_VERSION: "$(cat $CRAFT_STAGE/version.txt)" + override-build: | + craftctl default +################################################################################ + checkbox-ng: + plugin: python + source: checkbox-ng + source-type: local + build-packages: + - zlib1g-dev + - build-essential + stage-packages: + - perl + - python3-markupsafe + - python3-jinja2 + - python3-packaging + - python3-padme + - python3-requests-oauthlib + - python3-urwid + - python3-xlsxwriter + # added to stage python: + - libpython3-stdlib + - libpython3.12-stdlib + - libpython3.12-minimal + - python3-pip + - python3-setuptools + - python3-wheel + - python3-venv + - python3-minimal + - python3-pkg-resources + - python3.12-minimal + python-packages: + - tqdm + - picamera # p-p-c dep that wouldnt install in another part + after: [checkbox-support] + stage: + - -pyvenv.cfg + - -bin/activate* + - -**/RECORD + - -**/__pycache__ + - -debian + build-environment: + - PYTHONPATH: $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages:${PYTHONPATH:-} + - READTHEDOCS: 'True' # simplifies picamera install + - SETUPTOOLS_SCM_PRETEND_VERSION: "$(cat $CRAFT_STAGE/version.txt)" + override-build: | + craftctl default +################################################################################ + checkbox-provider-resource: + plugin: dump + source: providers/resource + source-type: local + stage-packages: + - cpu-checker + - dpkg + - dmidecode + - libjson-xs-perl + - pciutils + - python3-requests-unixsocket + - smartmontools + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + cd src && autoreconf -i && cd - + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-resource --root="$CRAFT_PART_INSTALL" + build-packages: + - autoconf + - automake + - libnl-3-dev + - libnl-genl-3-dev + - pkg-config + after: [checkbox-ng] +################################################################################ + checkbox-provider-base: + plugin: dump + source: providers/base + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-base --root="$CRAFT_PART_INSTALL" + override-prime: | + craftctl default + # needed because else this will trigger the store autoreviewer and be autorejected + # cleaning this bit should not cause any issue but if it does do not only remove this line + # contact also the store/update the package because else this will always trigger + # a manual review + [ -f usr/lib/x86_64-linux-gnu/libamdhip64.so.5.2.* ] && execstack --clear-execstack usr/lib/x86_64-linux-gnu/libamdhip64.so.5.2.* || true + stage-packages: + - execstack # needed to clear the execstack + - python3-opencv + - bc + - bonnie++ + - cryptsetup-bin + - dbus + - debsums + - dmidecode + - dmsetup + - efibootmgr + - ethtool + - freeipmi-tools + - fswebcam + - gir1.2-cheese-3.0 + - gir1.2-clutter-1.0 + - gir1.2-gst-plugins-base-1.0 + - gir1.2-gudev-1.0 + - glmark2-es2 + - gnome-screenshot + - gstreamer1.0-tools + - gstreamer1.0-pulseaudio + - on amd64: [hdapsd] # optional as not available for arm + - hdparm + - i2c-tools + - ipmitool + - iperf + - iperf3 + - iw + - jq + - kmod + - libasound2 + - libcap2-bin + - libfdt1 + - libsvm3 + - lsb-release + - lshw + - mesa-utils + - mokutil + - net-tools + - nmap + - nux-tools + - nvme-cli + - obexftp + - parted + - pciutils + - pulseaudio-utils + - pyotherside-doc + - pyotherside-tests + - qml-module-io-thp-pyotherside + - qml6-module-io-thp-pyotherside + - python3-dbus + - python3-evdev + - python3-gi + - python3-natsort + - python3-pil + - python3-psutil + - python3-pyqrcode + - python3-serial + - python3-yaml + - python3-zbar + - qml-module-qtquick-controls + - qml-module-qtquick-layouts + - qmlscene + - smartmontools + - usbutils + - util-linux + - uuid-runtime + - wget + - wmctrl + - xz-utils + - rt-tests # For realtime performance test + - mdadm + - on armhf: + - python3-rpi.gpio # only in focal + - on arm64: + - python3-rpi.gpio # only in focal + build-packages: + - libasound2-dev + - libcap-dev + organize: + usr/lib/lib*.so*: usr/lib/$CRAFT_ARCH_TRIPLET/ + after: [checkbox-provider-resource] +################################################################################ + checkbox-provider-docker: + plugin: dump + source: providers/docker + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-docker --root="$CRAFT_PART_INSTALL" + stage-packages: + - apache2-utils + after: [checkbox-provider-base] +################################################################################ + checkbox-provider-tpm2: + plugin: dump + source: providers/tpm2 + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-tpm2 --root="$CRAFT_PART_INSTALL" + stage-packages: + - clevis-tpm2 + after: [checkbox-provider-docker] +################################################################################ + checkbox-provider-iiotg: + plugin: dump + source: providers/iiotg + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-iiotg --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-tpm2] +################################################################################ + checkbox-provider-sru: + plugin: dump + source: providers/sru + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-sru --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-iiotg] +################################################################################ + checkbox-provider-gpgpu: + plugin: dump + source: providers/gpgpu + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-gpgpu --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-sru] +################################################################################ + checkbox-provider-certification-client: + plugin: dump + source: providers/certification-client + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-certification-client --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-gpgpu] +################################################################################ + checkbox-provider-certification-server: + plugin: dump + source: providers/certification-server + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-certification-server --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-certification-client] +################################################################################ + checkbox-provider-tutorial: + plugin: dump + source: providers/tutorial + source-type: local + build-environment: + - PYTHONPYCACHEPREFIX: "/tmp" + override-build: | + export PYTHONPATH=$CRAFT_STAGE/lib/python3.12/site-packages:$SNAPCRAFT_STAGE/usr/lib/python3/dist-packages + for path in $(find "$CRAFT_STAGE/providers/" -mindepth 1 -maxdepth 1 -type d); do export PROVIDERPATH=$path${PROVIDERPATH:+:$PROVIDERPATH}; done + python3 manage.py validate + python3 manage.py build + python3 manage.py install --layout=relocatable --prefix=/providers/checkbox-provider-tutorial --root="$CRAFT_PART_INSTALL" + after: [checkbox-provider-base] +################################################################################ + gnome-randr: + source: https://github.com/maxwellainatchi/gnome-randr-rust.git + plugin: rust + build-packages: + - libdbus-1-dev + after: [rust-deps] +################################################################################ + rust-deps: + plugin: nil + build-packages: + - wget + override-pull: | + # Do not use rustup to work around https://forum.snapcraft.io/t/armhf-builds-on-launchpad-timing-out/31008 + REQUIRED_RUST_VERSION=nightly + ROOT=https://static.rust-lang.org/dist/rust-$REQUIRED_RUST_VERSION + if [ $CRAFT_TARGET_ARCH = "amd64" ]; then + BINARIES_SUFFIX=x86_64-unknown-linux-gnu + elif [ $CRAFT_TARGET_ARCH = "armhf" ]; then + BINARIES_SUFFIX=armv7-unknown-linux-gnueabihf + elif [ $CRAFT_TARGET_ARCH = "arm64" ]; then + BINARIES_SUFFIX=aarch64-unknown-linux-gnu + fi + wget -O - $ROOT-$BINARIES_SUFFIX.tar.gz | tar -x -z --strip-components=1 + ./install.sh --prefix=/usr --destdir=$CRAFT_STAGE +################################################################################ + rpi-support-binaries: + plugin: nil + stage-packages: + - on armhf: + - libraspberrypi0 + - on arm64: + - libraspberrypi0 + organize: + usr/lib/lib*.so: usr/lib/$CRAFT_ARCH_TRIPLET/ +################################################################################ + lk-boot-env: + plugin: nil + source: . + override-pull: | + craftctl default + wget https://raw.githubusercontent.com/snapcore/snapd/master/include/lk/snappy_boot_common.h + wget https://raw.githubusercontent.com/snapcore/snapd/master/include/lk/snappy_boot_v2.h + wget https://raw.githubusercontent.com/kubiko/dragonboard-gadget/20-lk/snap-boot-sel/lk-boot-env.c + build-packages: + - wget + - on amd64 to armhf: + - gcc-arm-linux-gnueabihf:amd64 + - on amd64 to arm64: + - gcc-aarch64-linux-gnu:amd64 + override-build: | + mkdir -p ${CRAFT_PART_INSTALL}/bin + if [ "${CRAFT_ARCH_TRIPLET}" = "arm-linux-gnueabihf" ]; then + arm-linux-gnueabihf-gcc lk-boot-env.c -I/usr/include/ -Iapp/aboot -o ${CRAFT_PART_INSTALL}/bin/lk-boot-env + elif [ "${CRAFT_ARCH_TRIPLET}" = "aarch64-linux-gnu" ]; then + aarch64-linux-gnu-gcc lk-boot-env.c -I/usr/include/ -Iapp/aboot -o ${CRAFT_PART_INSTALL}/bin/lk-boot-env + else + # native build + gcc lk-boot-env.c -I/usr/include/ -Iapp/aboot -o ${CRAFT_PART_INSTALL}/bin/lk-boot-env + fi +################################################################################ + parts-meta-info: + plugin: nil + build-environment: + - RUNTIME_VERSION: "$(cat $CRAFT_STAGE/version.txt)" + override-build: | + craftctl default + echo "checkbox-runtime:" >> $CRAFT_PART_INSTALL/parts_meta_info + echo "$RUNTIME_VERSION" >> $CRAFT_PART_INSTALL/parts_meta_info + after: [checkbox-provider-certification-server] +################################################################################ + common-config: + plugin: dump + source: config/ diff --git a/checkbox-snap/series_classic24/.gitignore b/checkbox-snap/series_classic24/.gitignore new file mode 100644 index 0000000000..7876785d74 --- /dev/null +++ b/checkbox-snap/series_classic24/.gitignore @@ -0,0 +1,18 @@ +*.pyc +*.snap +__pycache__ +build/mo/* +dist/*.tar.gz +parts/ +snap/.snapcraft +snap/gui/ +stage/ +prime/ + +# following files are populated by the prepare.sh script and should be ignored +launchers/checkbox-cli-wrapper +launchers/shell-wrapper +launchers/sru +snap/hooks/install +snap/hooks/remove +version.txt diff --git a/checkbox-snap/series_classic24/config_vars b/checkbox-snap/series_classic24/config_vars new file mode 100644 index 0000000000..b6596b3bfe --- /dev/null +++ b/checkbox-snap/series_classic24/config_vars @@ -0,0 +1,38 @@ +# follow KEY=value syntax +WIFI_INTERFACE=mlan0 +WATCHDOG_KERNEL_MOD=iTCO_wdt +ALSADEVICE=hw:CARD=bytrt5660,DEV=0 +NET_DEVICE_INFO=ven_rsi_sdio ven_rsi_91x +OPEN_N_SSID=ubuntu-cert-n-open +OPEN_BG_SSID=ubuntu-cert-bg-open +OPEN_AC_SSID=ubuntu-cert-ac-open +OPEN_AX_SSID=ubuntu-cert-ax-open +WPA_N_SSID=ubuntu-cert-n-wpa +WPA_BG_SSID=ubuntu-cert-bg-wpa +WPA_AC_SSID=ubuntu-cert-ac-wpa +WPA_AX_SSID=ubuntu-cert-ax-wpa +WPA3_AX_SSID=ubuntu-cert-ax-wpa3 +WPA_N_PSK=insecure +WPA_BG_PSK=insecure +WPA_AC_PSK=insecure +WPA_AX_PSK=insecure +WPA3_AX_PSK=insecure +OBEX_TARGET=00:02:72:C5:F9:1F +WWAN_APN=internet +WWAN_NET_IF=ppp0 +WWAN_CONTROL_IF=ttyACM3 +STRESS_BOOT_ITERATIONS=100 +STRESS_S3_ITERATIONS=100 +STRESS_S4_ITERATIONS=100 +TEST_TARGET_IPERF=10.101.47.93 +STRESS_S4_WAIT_DELAY=120 +STRESS_S4_SLEEP_DELAY=60 +STRESS_S3_SLEEP_DELAY=60 +STRESS_BOOT_WAKEUP_DELAY=60 +STRESS_S3_WAIT_DELAY=120 +STRESS_BOOT_WAIT_DELAY=120 +WIFI_AP_SETUPTIME=30 +WWAN_SETUPTIME=30 +TPM2TOOLS_TCTI_NAME=device +TPM2TOOLS_DEVICE_FILE=/dev/tpm0 +MODEL_GRADE=signed diff --git a/checkbox-snap/series_classic24/launchers/client-cert-iot-server b/checkbox-snap/series_classic24/launchers/client-cert-iot-server new file mode 100755 index 0000000000..ac56236bd2 --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/client-cert-iot-server @@ -0,0 +1,18 @@ +#!/usr/bin/env checkbox-cli-wrapper +[launcher] +app_id = com.canonical.certification:checkbox +launcher_version = 1 +stock_reports = text, submission_files + +[test plan] +unit = com.canonical.certification::client-cert-iot-server-22-04-automated +forced = yes + +[test selection] +forced = yes + +[ui] +type = silent +auto_retry = yes +max_attempts = 4 +delay_before_retry = 30 diff --git a/checkbox-snap/series_classic24/launchers/configure b/checkbox-snap/series_classic24/launchers/configure new file mode 100755 index 0000000000..36d6204d1b --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/configure @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# Copyright 2018-2022 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Maciej Kisielewski +# Sylvain Pineau +import os +import re +import sys + +sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages")) +sitepkgpath = "$SNAP/lib/python3.12/site-packages" +sys.path.append(os.path.expandvars(sitepkgpath)) + +sys.path.append(os.path.expandvars( + "/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 update_configuration + from checkbox_support.snap_utils.config import print_checkbox_conf +except ImportError: + msg = """ +checkbox-support not found! +You need to install the checkbox24 snap: + +snap install checkbox24 + """ + print(os.path.expandvars(msg), file=sys.stderr) + sys.exit(1) + + +def main(): + # we need run as root to be able to write to /var/snap/... + if os.geteuid() != 0: + print('You have to run this command with sudo') + return + + if len(sys.argv) > 1 and sys.argv[1] == '-l': + print_checkbox_conf() + return + + key_re = re.compile(r"^(?:[A-Z0-9]+_?)*[A-Z](?:_?[A-Z0-9])*$") + vars_to_set = dict() + for pair in sys.argv[1:]: + k, _, v = pair.partition('=') + if not key_re.match(k) or not v: + raise SystemExit("'%s' is not a valid configuration entry. " + "Should be KEY=val" % pair) + k = k.replace('_', '-').lower() + vars_to_set[k] = v + update_configuration(vars_to_set) + + +if __name__ == '__main__': + main() diff --git a/checkbox-snap/series_classic24/launchers/odm-certification b/checkbox-snap/series_classic24/launchers/odm-certification new file mode 100644 index 0000000000..f685fdeb3c --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/odm-certification @@ -0,0 +1,16 @@ +[launcher] +app_id = com.canonical.certification:checkbox +launcher_version = 1 +stock_reports = text, submission_files + +[test plan] +unit = com.canonical.certification::client-cert-odm-desktop-22-04-manual +filter = com.canonical.certification::client-cert-odm-desktop-22-04-* + com.canonical.certification::client-cert-odm-desktop-20-04-* + com.canonical.certification::client-cert-odm-desktop-18-04-* + com.canonical.certification::client-cert-odm-server-22-04-* + com.canonical.certification::client-cert-odm-server-20-04-* + com.canonical.certification::client-cert-odm-server-18-04-* + com.canonical.certification::client-cert-odm-ubuntucore-22-* + com.canonical.certification::client-cert-odm-ubuntucore-20-* + com.canonical.certification::client-cert-odm-ubuntucore-18-* diff --git a/checkbox-snap/series_classic24/launchers/odm-certification-app b/checkbox-snap/series_classic24/launchers/odm-certification-app new file mode 100755 index 0000000000..3c68c29c12 --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/odm-certification-app @@ -0,0 +1,24 @@ +#!/bin/sh + +print_usage() { + echo "Usage:" + echo " checkbox.odm-certification IP" + echo "" + echo " IP Provide IP address of the System Under Test" + echo "" + exit 1 +} + +if [ $# -ne 1 ]; then + print_usage +fi + +if expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then + true +elif [ "$1" = "localhost" ]; then + true +else + print_usage +fi + +exec checkbox-cli control "$1" "$SNAP"/bin/odm-certification diff --git a/checkbox-snap/series_classic24/launchers/test-runner b/checkbox-snap/series_classic24/launchers/test-runner new file mode 100755 index 0000000000..0dd6f14b3c --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/test-runner @@ -0,0 +1,9 @@ +#!/usr/bin/env checkbox-cli-wrapper +[launcher] +app_id = com.canonical.certification:checkbox +api_flags = restartable +launcher_version = 1 +stock_reports = text, submission_files, certification + +[test plan] +filter = com.canonical.certification::client-cert-iot-server-22-04-* diff --git a/checkbox-snap/series_classic24/launchers/wrapper_local b/checkbox-snap/series_classic24/launchers/wrapper_local new file mode 100755 index 0000000000..de47d1872b --- /dev/null +++ b/checkbox-snap/series_classic24/launchers/wrapper_local @@ -0,0 +1,45 @@ +#!/bin/bash + +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" + ;; +esac + +################################################ +# Launcher common exports for any checkbox app # +################################################ + +RUNTIME=/snap/checkbox24/current +if [ ! -d "$RUNTIME" ]; then + echo "You need to install the checkbox24 snap." + echo "" + echo "You can do this with this command:" + echo "snap install checkbox24" + exit 1 +fi + +export LC_ALL=C.UTF-8 +PERL_VERSION=$(perl -e '$^V=~/^v(\d+\.\d+)/;print $1') +export PERL5LIB="$PERL5LIB:$SNAP/usr/lib/$ARCH/perl/$PERL_VERSION:$SNAP/usr/lib/$ARCH/perl5/$PERL_VERSION:$SNAP/usr/share/perl/$PERL_VERSION:$SNAP/usr/share/perl5" +export GI_TYPELIB_PATH=$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0 +export PATH="$SNAP/usr/sbin:$SNAP/sbin:$SNAP/usr/bin:$SNAP/bin:/snap/bin:$PATH" +export ALSA_CONFIG_PATH=$SNAP/usr/share/alsa/alsa.conf:$SNAP/usr/share/alsa/pcm/default.conf +export PYTHONPATH="$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH" + +if [ -e $RUNTIME/wrapper_common_classic ]; then + . $RUNTIME/wrapper_common_classic +else + echo "ERROR: no $RUNTIME/wrapper_common_classic found" + exit 1 +fi + +exec "$@" diff --git a/checkbox-snap/series_classic24/snap/hooks/configure b/checkbox-snap/series_classic24/snap/hooks/configure new file mode 100755 index 0000000000..84abb4053b --- /dev/null +++ b/checkbox-snap/series_classic24/snap/hooks/configure @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# Copyright 2021-2022 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Sylvain Pineau +""" +This hook reads `config_vars` file from the root of a snap and reenters this +configuration using snapd's config facilities and rewrites the file to a +checkbox config format in `$SNAP_DATA/checkbox.conf`. + +config_vars should list all the configuration variables in a `key=value` +syntax. The line can list variable name only, if the variable should not have a +default value. All keys should comprise of CAPS, numbers and undescores (_). +E.g.: + +OPEN_N_SSID +OPEN_BG_SSID +STRESS_S3_WAIT_DELAY=60 + +To change those values use the configure launcher. +E.g. + $ checkbox.configure OPEN_N_SSID=my-wifi + +If you __really__ need to change those values using `snap set` command, +you need to change CAPS to lowercase and underscores to dashes (-). + +E.g. + $ snap set checkbox open-n-ssid=my-wifi +""" + +import os +import sys + +sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages")) +sitepkgpath = "$SNAP/lib/python3.12/site-packages" +sys.path.append(os.path.expandvars(sitepkgpath)) + +sys.path.append(os.path.expandvars( + "/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 checkbox24 snap: + +snap install checkbox24 + """ + print(os.path.expandvars(msg), file=sys.stderr) + sys.exit(1) +refresh_configuration() diff --git a/checkbox-snap/series_classic24/snap/snapcraft.yaml b/checkbox-snap/series_classic24/snap/snapcraft.yaml new file mode 100644 index 0000000000..7f9e90dcb2 --- /dev/null +++ b/checkbox-snap/series_classic24/snap/snapcraft.yaml @@ -0,0 +1,81 @@ +name: checkbox +summary: Checkbox test runner +description: | + Checkbox is a flexible test automation software. + It’s the main tool used in Ubuntu Certification program. +adopt-info: version-calculator +grade: devel +confinement: classic + +base: core24 +build-base: devel + +apps: + checkbox-cli: + command-chain: [bin/wrapper_local] + command: bin/checkbox-cli-wrapper + test-runner: + command-chain: [bin/wrapper_local] + command: bin/test-runner + sru: + command-chain: [bin/wrapper_local] + command: bin/sru + client-cert-iot-server: + command-chain: [bin/wrapper_local] + command: bin/client-cert-iot-server + odm-certification: + command-chain: [bin/wrapper_local] + command: bin/odm-certification-app + configure: + command: bin/configure + agent: + command-chain: [bin/wrapper_local] + command: bin/checkbox-cli-wrapper run-agent + daemon: simple + restart-condition: always + restart-delay: 1s + shell: + command-chain: [bin/wrapper_local] + command: bin/shell-wrapper + +passthrough: + hooks: + configure: + command-chain: [bin/wrapper_local] + +parts: + version-calculator: + plugin: dump + source: . + override-pull: | + snapcraftctl pull + # version.txt created by prepare.sh + export version=`cat $SNAPCRAFT_PART_SRC/version.txt` + [ $version ] || exit 1 + snapcraftctl set-version $version + stage: + - version.txt + launchers: + plugin: dump + source: launchers/ + build-attributes: [no-patchelf] + organize: + '*': bin/ + config-variables: + plugin: dump + source: . + build-attributes: [no-patchelf] + stage: [config_vars] + workaround-automated-review-issue: + plugin: nil + override-build: | + # This is a workaround for an upstream bug in the automated snap review tool + # remove this once this issue is resolved: + # https://bugs.launchpad.net/review-tools/+bug/2049093 + # Note: this cats /dev/urandom because the squashfs will collapse any + # predictable output to less than the desired size making this + # ineffective + echo "This file is a workaround for a bug in the automated snap review tool" > $SNAPCRAFT_PART_INSTALL/size_workaround + echo "this only contains random bytes to pad the snap to 16kb" >> $SNAPCRAFT_PART_INSTALL/size_workaround + echo "see: https://bugs.launchpad.net/review-tools/+bug/2049093" >> $SNAPCRAFT_PART_INSTALL/size_workaround + head -c 16384 /dev/urandom >> $SNAPCRAFT_PART_INSTALL/size_workaround diff --git a/checkbox-snap/series_uc24/.gitignore b/checkbox-snap/series_uc24/.gitignore new file mode 100644 index 0000000000..a4811de6a9 --- /dev/null +++ b/checkbox-snap/series_uc24/.gitignore @@ -0,0 +1,10 @@ +*.pyc +*.snap +__pycache__ +build/mo/* +dist/*.tar.gz +parts/ +snap/.snapcraft +snap/gui/ +stage/ +prime/ diff --git a/checkbox-snap/series_uc24/config_vars b/checkbox-snap/series_uc24/config_vars new file mode 100644 index 0000000000..b6596b3bfe --- /dev/null +++ b/checkbox-snap/series_uc24/config_vars @@ -0,0 +1,38 @@ +# follow KEY=value syntax +WIFI_INTERFACE=mlan0 +WATCHDOG_KERNEL_MOD=iTCO_wdt +ALSADEVICE=hw:CARD=bytrt5660,DEV=0 +NET_DEVICE_INFO=ven_rsi_sdio ven_rsi_91x +OPEN_N_SSID=ubuntu-cert-n-open +OPEN_BG_SSID=ubuntu-cert-bg-open +OPEN_AC_SSID=ubuntu-cert-ac-open +OPEN_AX_SSID=ubuntu-cert-ax-open +WPA_N_SSID=ubuntu-cert-n-wpa +WPA_BG_SSID=ubuntu-cert-bg-wpa +WPA_AC_SSID=ubuntu-cert-ac-wpa +WPA_AX_SSID=ubuntu-cert-ax-wpa +WPA3_AX_SSID=ubuntu-cert-ax-wpa3 +WPA_N_PSK=insecure +WPA_BG_PSK=insecure +WPA_AC_PSK=insecure +WPA_AX_PSK=insecure +WPA3_AX_PSK=insecure +OBEX_TARGET=00:02:72:C5:F9:1F +WWAN_APN=internet +WWAN_NET_IF=ppp0 +WWAN_CONTROL_IF=ttyACM3 +STRESS_BOOT_ITERATIONS=100 +STRESS_S3_ITERATIONS=100 +STRESS_S4_ITERATIONS=100 +TEST_TARGET_IPERF=10.101.47.93 +STRESS_S4_WAIT_DELAY=120 +STRESS_S4_SLEEP_DELAY=60 +STRESS_S3_SLEEP_DELAY=60 +STRESS_BOOT_WAKEUP_DELAY=60 +STRESS_S3_WAIT_DELAY=120 +STRESS_BOOT_WAIT_DELAY=120 +WIFI_AP_SETUPTIME=30 +WWAN_SETUPTIME=30 +TPM2TOOLS_TCTI_NAME=device +TPM2TOOLS_DEVICE_FILE=/dev/tpm0 +MODEL_GRADE=signed diff --git a/checkbox-snap/series_uc24/launchers/checkbox-cli-wrapper b/checkbox-snap/series_uc24/launchers/checkbox-cli-wrapper new file mode 100755 index 0000000000..aff044783e --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/checkbox-cli-wrapper @@ -0,0 +1,3 @@ +#!/bin/sh + +exec checkbox-cli "$@" diff --git a/checkbox-snap/series_uc24/launchers/client-cert-iot-ubuntucore b/checkbox-snap/series_uc24/launchers/client-cert-iot-ubuntucore new file mode 100755 index 0000000000..1b70d7306e --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/client-cert-iot-ubuntucore @@ -0,0 +1,18 @@ +#!/usr/bin/env checkbox-cli-wrapper +[launcher] +app_id = com.canonical.certification:checkbox +launcher_version = 1 +stock_reports = text, submission_files + +[test plan] +unit = com.canonical.certification::client-cert-iot-ubuntucore-22-automated +forced = yes + +[test selection] +forced = yes + +[ui] +type = silent +auto_retry = yes +max_attempts = 4 +delay_before_retry = 30 diff --git a/checkbox-snap/series_uc24/launchers/configure b/checkbox-snap/series_uc24/launchers/configure new file mode 100755 index 0000000000..6a576bc0f1 --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/configure @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# Copyright 2018-2022 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Maciej Kisielewski +# Sylvain Pineau +import os +import re +import sys + +sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages")) +sitepkgpath = "$SNAP/lib/python{}.{}/site-packages".format( + sys.version_info[0], sys.version_info[1]) +sys.path.append(os.path.expandvars(sitepkgpath)) + +sys.path.append(os.path.expandvars( + "$SNAP/checkbox-runtime/usr/lib/python3/dist-packages")) +runtimepath = "$SNAP/checkbox-runtime/lib/python{}.{}/site-packages".format( + sys.version_info[0], sys.version_info[1]) +sys.path.append(os.path.expandvars(runtimepath)) + +try: + from checkbox_support.snap_utils.config import update_configuration + from checkbox_support.snap_utils.config import print_checkbox_conf +except ImportError: + msg = """ +checkbox-support not found! +You need to connect this snap to the checkbox24 snap. + +You can do this with those commands: + +snap connect $SNAP_NAME:checkbox-runtime checkbox24:checkbox-runtime +snap connect $SNAP_NAME:provider-resource checkbox24:provider-resource +snap connect $SNAP_NAME:provider-checkbox checkbox24:provider-checkbox +snap connect $SNAP_NAME:provider-docker checkbox24:provider-docker +snap connect $SNAP_NAME:provider-tpm2 checkbox24:provider-tpm2 +snap connect $SNAP_NAME:provider-sru checkbox24:provider-sru + """ + print(os.path.expandvars(msg), file=sys.stderr) + sys.exit(1) + + +def main(): + # we need run as root to be able to write to /var/snap/... + if os.geteuid() != 0: + print('You have to run this command with sudo') + return + + if len(sys.argv) > 1 and sys.argv[1] == '-l': + print_checkbox_conf() + return + + key_re = re.compile(r"^(?:[A-Z0-9]+_?)*[A-Z](?:_?[A-Z0-9])*$") + vars_to_set = dict() + for pair in sys.argv[1:]: + k, _, v = pair.partition('=') + if not key_re.match(k) or not v: + raise SystemExit("'%s' is not a valid configuration entry. " + "Should be KEY=val" % pair) + k = k.replace('_', '-').lower() + vars_to_set[k] = v + update_configuration(vars_to_set) + + +if __name__ == '__main__': + main() diff --git a/checkbox-snap/series_uc24/launchers/odm-certification b/checkbox-snap/series_uc24/launchers/odm-certification new file mode 100644 index 0000000000..32085a3e6c --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/odm-certification @@ -0,0 +1,16 @@ +[launcher] +app_id = com.canonical.certification:checkbox +launcher_version = 1 +stock_reports = text, submission_files + +[test plan] +unit = com.canonical.certification::client-cert-odm-ubuntucore-22-manual +filter = com.canonical.certification::client-cert-odm-desktop-22-04-* + com.canonical.certification::client-cert-odm-desktop-20-04-* + com.canonical.certification::client-cert-odm-desktop-18-04-* + com.canonical.certification::client-cert-odm-server-22-04-* + com.canonical.certification::client-cert-odm-server-20-04-* + com.canonical.certification::client-cert-odm-server-18-04-* + com.canonical.certification::client-cert-odm-ubuntucore-22-* + com.canonical.certification::client-cert-odm-ubuntucore-20-* + com.canonical.certification::client-cert-odm-ubuntucore-18-* diff --git a/checkbox-snap/series_uc24/launchers/odm-certification-app b/checkbox-snap/series_uc24/launchers/odm-certification-app new file mode 100755 index 0000000000..3c68c29c12 --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/odm-certification-app @@ -0,0 +1,24 @@ +#!/bin/sh + +print_usage() { + echo "Usage:" + echo " checkbox.odm-certification IP" + echo "" + echo " IP Provide IP address of the System Under Test" + echo "" + exit 1 +} + +if [ $# -ne 1 ]; then + print_usage +fi + +if expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then + true +elif [ "$1" = "localhost" ]; then + true +else + print_usage +fi + +exec checkbox-cli control "$1" "$SNAP"/bin/odm-certification diff --git a/checkbox-snap/series_uc24/launchers/shell-wrapper b/checkbox-snap/series_uc24/launchers/shell-wrapper new file mode 100755 index 0000000000..ffbca8f954 --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/shell-wrapper @@ -0,0 +1,6 @@ +#!/bin/bash + +. $(dirname "$(realpath $BASH_SOURCE)")/wrapper_local + +echo "$SNAP_NAME runtime shell, type 'exit' to quit the session" +exec bash --rcfile <(cat ~/.bashrc; echo 'PS1="(checkbox-shell) $PS1"') \ No newline at end of file diff --git a/checkbox-snap/series_uc24/launchers/sru b/checkbox-snap/series_uc24/launchers/sru new file mode 100755 index 0000000000..da9df67322 --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/sru @@ -0,0 +1,16 @@ +#!/usr/bin/env checkbox-cli-wrapper +[launcher] +app_id = com.canonical.certification:checkbox +api_flags = restartable +launcher_version = 1 +stock_reports = text, submission_files + +[test plan] +unit = com.canonical.certification::sru-ubuntucore +forced = yes + +[test selection] +forced = yes + +[ui] +type = silent diff --git a/checkbox-snap/series_uc24/launchers/test-runner b/checkbox-snap/series_uc24/launchers/test-runner new file mode 100755 index 0000000000..c1fd48472f --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/test-runner @@ -0,0 +1,9 @@ +#!/usr/bin/env checkbox-cli-wrapper +[launcher] +app_id = com.canonical.certification:checkbox +api_flags = restartable +launcher_version = 1 +stock_reports = text, submission_files, certification + +[test plan] +filter = com.canonical.certification::client-cert-iot-ubuntucore-20-* diff --git a/checkbox-snap/series_uc24/launchers/wrapper_local b/checkbox-snap/series_uc24/launchers/wrapper_local new file mode 100755 index 0000000000..9988ef2d42 --- /dev/null +++ b/checkbox-snap/series_uc24/launchers/wrapper_local @@ -0,0 +1,52 @@ +#!/bin/bash + +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" + ;; +esac + +################################################ +# Launcher common exports for any checkbox app # +################################################ + +if [ -d $SNAP/checkbox-runtime ]; then + RUNTIME=$SNAP/checkbox-runtime + if [ ! -d $RUNTIME/usr ]; then + echo "You need to connect this snap to the checkbox24 snap." + echo "" + echo "You can do this with those commands:" + echo "snap install checkbox24" + echo "snap connect $SNAP_NAME:checkbox-runtime checkbox24:checkbox-runtime" + exit 1 + fi +fi + +export LC_ALL=C.UTF-8 +PERL_VERSION=$(perl -e '$^V=~/^v(\d+\.\d+)/;print $1') +export PERL5LIB="$PERL5LIB:$SNAP/usr/lib/$ARCH/perl/$PERL_VERSION:$SNAP/usr/lib/$ARCH/perl5/$PERL_VERSION:$SNAP/usr/share/perl/$PERL_VERSION:$SNAP/usr/share/perl5" +export GI_TYPELIB_PATH=$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0 +export PATH="$PATH:$SNAP/usr/sbin:$SNAP/sbin:/snap/bin" +export PYTHONPATH="$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH" + +if [ -e $RUNTIME/wrapper_common ]; then + . $RUNTIME/wrapper_common +else + CGROUP_NAME=$(cat /proc/self/cgroup | grep -e "^1:name") + if [[ "$CGROUP_NAME" == *"hook.configure"* ]]; then + echo "Running in configure hook, wrapper_common not required" + else + echo "ERROR: no $RUNTIME/wrapper_common found" + exit 0 + fi +fi + +exec "$@" diff --git a/checkbox-snap/series_uc24/snap/hooks/configure b/checkbox-snap/series_uc24/snap/hooks/configure new file mode 100755 index 0000000000..b9473bd8b3 --- /dev/null +++ b/checkbox-snap/series_uc24/snap/hooks/configure @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# Copyright 2021-2022 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Sylvain Pineau +""" +This hook reads `config_vars` file from the root of a snap and reenters this +configuration using snapd's config facilities and rewrites the file to a +checkbox config format in `$SNAP_DATA/checkbox.conf`. + +config_vars should list all the configuration variables in a `key=value` +syntax. The line can list variable name only, if the variable should not have a +default value. All keys should comprise of CAPS, numbers and undescores (_). +E.g.: + +OPEN_N_SSID +OPEN_BG_SSID +STRESS_S3_WAIT_DELAY=60 + +To change those values use the configure launcher. +E.g. + $ checkbox.configure OPEN_N_SSID=my-wifi + +If you __really__ need to change those values using `snap set` command, +you need to change CAPS to lowercase and underscores to dashes (-). + +E.g. + $ snap set checkbox open-n-ssid=my-wifi +""" + +import os +import sys + +sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages")) +sitepkgpath = "$SNAP/lib/python{}.{}/site-packages".format( + sys.version_info[0], sys.version_info[1]) +sys.path.append(os.path.expandvars(sitepkgpath)) + +sys.path.append(os.path.expandvars( + "$SNAP/checkbox-runtime/usr/lib/python3/dist-packages")) +runtimepath = "$SNAP/checkbox-runtime/lib/python{}.{}/site-packages".format( + sys.version_info[0], sys.version_info[1]) +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 connect this snap to the checkbox24 snap. + +You can do this with those commands: + +snap connect $SNAP_NAME:checkbox-runtime checkbox24:checkbox-runtime +snap connect $SNAP_NAME:provider-resource checkbox24:provider-resource +snap connect $SNAP_NAME:provider-checkbox checkbox24:provider-checkbox +snap connect $SNAP_NAME:provider-docker checkbox24:provider-docker +snap connect $SNAP_NAME:provider-tpm2 checkbox24:provider-tpm2 +snap connect $SNAP_NAME:provider-sru checkbox24:provider-sru +snap connect $SNAP_NAME:provider-certification-client checkbox24:provider-certification-client + """ + print(os.path.expandvars(msg), file=sys.stderr) + sys.exit(0) +refresh_configuration() diff --git a/checkbox-snap/series_uc24/snap/snapcraft.yaml b/checkbox-snap/series_uc24/snap/snapcraft.yaml new file mode 100644 index 0000000000..a12529543f --- /dev/null +++ b/checkbox-snap/series_uc24/snap/snapcraft.yaml @@ -0,0 +1,123 @@ +name: checkbox +summary: Checkbox test runner +description: | + Checkbox is a flexible test automation software. + It’s the main tool used in Ubuntu Certification program. +adopt-info: version-calculator +grade: devel +confinement: strict + +base: core24 +build-base: devel + +plugs: + checkbox-runtime: + interface: content + target: $SNAP/checkbox-runtime + provider-resource: + interface: content + target: $SNAP/providers/checkbox-provider-resource + provider-checkbox: + interface: content + target: $SNAP/providers/checkbox-provider-checkbox + provider-docker: + interface: content + target: $SNAP/providers/checkbox-provider-docker + provider-tpm2: + interface: content + target: $SNAP/providers/checkbox-provider-tpm2 + provider-sru: + interface: content + target: $SNAP/providers/checkbox-provider-sru + provider-gpgpu: + interface: content + target: $SNAP/providers/checkbox-provider-gpgpu + provider-certification-client: + interface: content + target: $SNAP/providers/checkbox-provider-certification-client + provider-certification-server: + interface: content + target: $SNAP/providers/checkbox-provider-certification-server + +apps: + checkbox-cli: + command-chain: [bin/wrapper_local] + command: bin/checkbox-cli-wrapper + plugs: &standard [home, network-bind, hardware-observe, bluez, bluetooth-control, + gpio, modem-manager, mount-observe, network-manager, pulseaudio, serial-port, + system-observe, tpm, udisks2] + test-runner: + command-chain: [bin/wrapper_local] + command: bin/test-runner + plugs: *standard + sru: + command-chain: [bin/wrapper_local] + command: bin/sru + plugs: *standard + client-cert-iot-ubuntucore: + command-chain: [bin/wrapper_local] + command: bin/client-cert-iot-ubuntucore + plugs: *standard + odm-certification: + command-chain: [bin/wrapper_local] + command: bin/odm-certification-app + plugs: *standard + configure: + command: bin/configure + agent: + command-chain: [bin/wrapper_local] + command: bin/checkbox-cli-wrapper run-agent + daemon: simple + restart-condition: always + restart-delay: 1s + plugs: *standard + shell: + command-chain: [bin/wrapper_local] + command: bin/shell-wrapper + plugs: *standard + +passthrough: + hooks: + configure: + command-chain: [bin/wrapper_local] + +parts: + version-calculator: + plugin: dump + source: . + override-pull: | + snapcraftctl pull + # version.txt created by prepare.sh + export version=`cat $SNAPCRAFT_PART_SRC/version.txt` + [ $version ] || exit 1 + snapcraftctl set-version $version + stage: + - version.txt + launchers: + plugin: dump + source: launchers/ + build-attributes: [no-patchelf] + organize: + '*': bin/ + config-variables: + plugin: dump + source: . + build-attributes: [no-patchelf] + stage: [config_vars] + workaround-automated-review-issue: + plugin: nil + override-build: | + # This is a workaround for an upstream bug in the automated snap review tool + # remove this once this issue is resolved: + # https://bugs.launchpad.net/review-tools/+bug/2049093 + # Note: this cats /dev/urandom because the squashfs will collapse any + # predictable output to less than the desired size making this + # ineffective + echo "This file is a workaround for a bug in the automated snap review tool" > $SNAPCRAFT_PART_INSTALL/size_workaround + echo "this only contains random bytes to pad the snap to 16kb" >> $SNAPCRAFT_PART_INSTALL/size_workaround + echo "see: https://bugs.launchpad.net/review-tools/+bug/2049093" >> $SNAPCRAFT_PART_INSTALL/size_workaround + head -c 16384 /dev/urandom >> $SNAPCRAFT_PART_INSTALL/size_workaround + install_perl: + plugin: nil + stage-packages: + - perl