From 578fda0e90877da6db83ad8005b9cce9842c0540 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Sun, 10 Dec 2023 03:58:38 +0100 Subject: [PATCH] packages: Add target to test the release. This makes sure that the release at least has all the expected files. Signed-off-by: Denis 'GNUtoo' Carikli Acked-by: Adrien 'neox' Bourmault --- Makefile | 1 + build | 1 + resources/packages/release/test | 110 ++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100755 resources/packages/release/test diff --git a/Makefile b/Makefile index 049c16e..24eac4f 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ release: ./build release roms ./build release website ./build release gnuboot-source + ./build test release clean: ./build clean cbutils diff --git a/build b/build index a6c56a3..94e70ff 100755 --- a/build +++ b/build @@ -41,6 +41,7 @@ tasks="\ module \ payload \ release \ + test \ " list_tasks() { diff --git a/resources/packages/release/test b/resources/packages/release/test new file mode 100755 index 0000000..ba23c5d --- /dev/null +++ b/resources/packages/release/test @@ -0,0 +1,110 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 Denis 'GNUtoo' Carikli +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. resources/scripts/misc/sysexits.sh + +progname="resources/packages/tests/test-release" + +usage() +{ + progname="$1" + + printf "Usage: %s [options]\n\n" "${progname}" + printf "Available options:\n" + printf "\t-h, --help\n" + printf "\t\tDisplay this help and exit.\n" +} + +test_file() +{ + path="$1" + + test -f "${path}" ; ret=$? + + if [ ${ret} -eq 0 ] ; then + echo "[ OK ] ${path}" + else + echo "[ !! ] ${path} is missing" + exit ${ret} + fi +} + +test_release() +{ + version="$(git --no-pager describe --tags HEAD)" + + dir="release" + + targets="\ + d510mo \ + d510mo_16mb \ + kfsn4-dre_2mb \ + kgpe-d16-rdimm_16mb \ + kgpe-d16-rdimm_2mb \ + kgpe-d16-udimm_16mb \ + kgpe-d16-udimm_2mb \ + macbook11 \ + macbook11_16mb \ + macbook21 \ + macbook21_16mb \ + qemu-pc_2mb \ + r400_16mb \ + r400_4mb \ + r400_8mb \ + r500_4mb \ + t400_16mb \ + t400_4mb \ + t400_8mb \ + t500_16mb \ + t500_4mb \ + t500_8mb \ + t60_16mb_intelgpu \ + t60_intelgpu \ + w500_16mb \ + w500_4mb \ + w500_8mb \ + x200_16mb \ + x200_4mb \ + x200_8mb \ + x301_16mb \ + x301_4mb \ + x301_8mb \ + x60 \ + x60_16mb \ + " + + for target in ${targets} ; do + test_file "${dir}"/roms/gnuboot-"${version}"_"${target}".tar.xz + done + + test_file "${dir}"/gnuboot-"${version}"_src.tar.xz + + test_file "${dir}"/gnuboot-source-"${version}".bundle + + test_file "${dir}"/untitled-"${version}".bundle + + test_file "${dir}"/gnuboot-website-"${version}".tar.gz +} + +if [ $# -eq 1 ] && { [ "$1" = "-h" ] || [ "$1" == "--help" ] ;} ; then + usage "${progname}" + exit 0 +elif [ $# -eq 0 ] ; then + test_release +else + usage "${progname}" + exit ${EX_USAGE} +fi