summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2022-04-20 21:47:07 +0200
committerGitHub <noreply@github.com>2022-04-20 21:47:07 +0200
commitf579b163fe7ccdb0f713001d4253c5d68a3b8280 (patch)
treea085ae1b5080f292d6b469d1080d4546b348978e /test
parent1ca7b38f3c174a95e391b4251eebfc98ca66fd17 (diff)
downloadflac-f579b163fe7ccdb0f713001d4253c5d68a3b8280.tar.gz
Add git commit tag, hash and date to vendor string when available
In some circles (Hydrogenaud.io for example) people share binaries compiled from git, i.e. inbetween official releases. Files created with these binaries cannot be discerned from others. To improve troubleshooting, compiles from a git repository are marked with the commit hash and date when configured with autotools or CMake
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/common.sh.in1
-rwxr-xr-xtest/test_metaflac.sh6
3 files changed, 10 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 5935c5d5..6c80f763 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -30,6 +30,10 @@ endif()
set(top_srcdir "${PROJECT_SOURCE_DIR}")
set(top_builddir "${PROJECT_BINARY_DIR}")
+if(NOT GIT_COMMIT_TAG AND GIT_COMMIT_HASH AND GIT_COMMIT_DATE)
+ set(GIT_COMMIT_VERSION_HASH yes)
+endif()
+
configure_file(common.sh.in common.sh @ONLY)
set(ALL_TESTS libFLAC grabbag flac metaflac replaygain seeking streams compression)
diff --git a/test/common.sh.in b/test/common.sh.in
index 3184cc30..335f8409 100644
--- a/test/common.sh.in
+++ b/test/common.sh.in
@@ -52,6 +52,7 @@ EXE=@EXEEXT@
# and build products in the $top_builddir tree.
top_srcdir=@top_srcdir@
top_builddir=@top_builddir@
+git_commit_version_hash=@GIT_COMMIT_VERSION_HASH@
# Set `is_win` variable which is used in other scripts that source this one.
if test $(env | grep -ic '^comspec=') != 0 ; then
diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh
index 3df56a4e..28e4dbf5 100755
--- a/test/test_metaflac.sh
+++ b/test/test_metaflac.sh
@@ -147,7 +147,11 @@ run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile
check_flac
metaflac_test case06 "--set-tag=TITLE" "--list"
-metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST"
+if [ ! $git_commit_version_hash ] ; then
+ metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST"
+else
+ echo "test case07 is skipped because version is taken from git"
+fi
run_metaflac --remove-first-tag=ARTIST $flacfile
check_flac