From 5d8fcdae0e1de62ed7908003377e67984f4fc3a2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Jul 2019 21:16:38 +1000 Subject: [PATCH] data: add two tests that files are in git and added to meson Signed-off-by: Peter Hutterer --- data/check-files-in-git.sh | 26 ++++++++++++++++++++++++++ data/check-svg-in-meson.build.sh | 5 +++++ data/meson.build | 21 ++++++++++++++++----- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 data/check-files-in-git.sh create mode 100755 data/check-svg-in-meson.build.sh diff --git a/data/check-files-in-git.sh b/data/check-files-in-git.sh new file mode 100644 index 0000000..85eafd0 --- /dev/null +++ b/data/check-files-in-git.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Usage: check-files-in-git.sh /path/to/piper/ + +if [ -z "$top_srcdir" ]; then + top_srcdir="$1" +fi +if [ -z "$top_srcdir" ]; then + echo "Usage: `basename $0` /path/to/piper" + exit 1 +fi + +export GIT_DIR="$top_srcdir/.git"; +if ! git ls-files >& /dev/null; then + echo "Not a git tree. Skipping" + exit 77 +fi + +pushd "$top_srcdir" > /dev/null +for file in data/svgs/*.svg; do + git ls-files --error-unmatch "$file" &> /dev/null || ( + echo "ERROR: File $file is not in git" && test); + rc="$(($rc + $?))"; +done +popd > /dev/null +exit $rc diff --git a/data/check-svg-in-meson.build.sh b/data/check-svg-in-meson.build.sh new file mode 100755 index 0000000..11ca8e2 --- /dev/null +++ b/data/check-svg-in-meson.build.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +pushd "$1" > /dev/null +diff -u1 <(grep -o 'svgs/.*\.svg' data/meson.build) <(cd data; ls -v svgs/*.svg) +popd > /dev/null diff --git a/data/meson.build b/data/meson.build index 6a95dbf..51674fb 100644 --- a/data/meson.build +++ b/data/meson.build @@ -41,31 +41,31 @@ i18n.merge_file(input: appdata, svgs = [ 'svgs/fallback.svg', + 'svgs/logitech-g9.svg', 'svgs/logitech-g102-g203.svg', 'svgs/logitech-g300.svg', 'svgs/logitech-g303.svg', 'svgs/logitech-g402.svg', 'svgs/logitech-g403.svg', - 'svgs/logitech-g500s.svg', 'svgs/logitech-g500.svg', + 'svgs/logitech-g500s.svg', 'svgs/logitech-g502.svg', 'svgs/logitech-g600.svg', 'svgs/logitech-g603.svg', 'svgs/logitech-g700.svg', 'svgs/logitech-g703.svg', 'svgs/logitech-g900.svg', - 'svgs/logitech-g9.svg', 'svgs/logitech-g-pro.svg', 'svgs/logitech-g-pro-wireless.svg', - 'svgs/logitech-mx-anywhere2s.svg', 'svgs/logitech-mx-anywhere2.svg', - 'svgs/logitech-mx-master-2s.svg', + 'svgs/logitech-mx-anywhere2s.svg', 'svgs/logitech-mx-master.svg', + 'svgs/logitech-mx-master-2s.svg', 'svgs/roccat-kone-xtd.svg', 'svgs/steelseries-kinzu-v2.svg', + 'svgs/steelseries-rival.svg', 'svgs/steelseries-rival310.svg', 'svgs/steelseries-rival600.svg', - 'svgs/steelseries-rival.svg', 'svgs/steelseries-sensei310.svg', 'svgs/steelseries-senseiraw.svg', ] @@ -83,7 +83,18 @@ test('svg-lookup-check', svg_mapping, join_paths(meson.source_root(), 'data/svgs/') ], + ) +# meson requires that we specify all files one-by-one, so let's add a test +# that we can't forget about that. +test('svg-files-in-meson.build', + find_program('check-svg-in-meson.build.sh'), + args: [meson.source_root()], + suite: ['all']) +test('files-in-git', + find_program('check-files-in-git.sh'), + args: [meson.source_root()], + suite: ['all']) gresource = configure_file(input: 'piper.gresource.xml.in', output: 'piper.gresource.xml',