Skip to content

Commit

Permalink
tests: test all archive templates
Browse files Browse the repository at this point in the history
This adds the tests for all the archive templates, including literal %.
  • Loading branch information
gportay committed Feb 17, 2025
1 parent ff4e87f commit 4c48621
Showing 1 changed file with 87 additions and 1 deletion.
88 changes: 87 additions & 1 deletion tests/06-cqfd_release
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rm -rf "${tmp_dir}"
################################################################################
# Now test adding an archive filename template to the config
################################################################################
jtest_prepare "build.archive can template filenames"
jtest_prepare "build.archive can template filenames (RFC3339 date)"

export CTEST=foobar
d3=$(date --rfc-3339='date')
Expand All @@ -132,6 +132,92 @@ else
fi
rm -f cqfd-$d3-foobar.tar.xz

jtest_prepare "build.archive can template filenames (git short hash of last commit)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%Gh-$CTEST.tar.xz!' .cqfdrc

if $cqfd release &&
ls -1 cqfd-*-foobar.tar.xz | grep -q "^cqfd-[[:xdigit:]]\{4,40\}-foobar.tar.xz$" &&
tar tf cqfd-*-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-*-foobar.tar.xz

jtest_prepare "build.archive can template filenames (git long hash of last commit)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%GH-$CTEST.tar.xz!' .cqfdrc

if $cqfd release &&
ls -1 cqfd-*-foobar.tar.xz | grep -q "^cqfd-[[:xdigit:]]\{40\}-foobar.tar.xz$" &&
tar tf cqfd-*-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-*-foobar.tar.xz

jtest_prepare "build.archive can template filenames (Unix timestamp)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%Du-$CTEST.tar.xz!' .cqfdrc

if $cqfd release &&
ls -1 cqfd-*-foobar.tar.xz | grep -q "^cqfd-[[:digit:]]\{1,20\}-foobar.tar.xz$" &&
tar tf cqfd-*-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-*-foobar.tar.xz

jtest_prepare "build.archive can template filenames (current cqfd flavor name unset)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%Cf-$CTEST.tar.xz!' .cqfdrc

if $cqfd release && tar tf cqfd--foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd--foobar.tar.xz

jtest_prepare "build.archive can template filenames (current cqfd flavor name set)"
#sed -i -e '$ s!^archive=.*!archive=cqfd-%Cf-$CTEST.tar.xz!' .cqfdrc

if $cqfd -b foo release && tar tf cqfd-foo.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-foo.tar.xz

jtest_prepare "build.archive can template filenames (value of the project.org configuration key)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%Po-$CTEST.tar.xz!' .cqfdrc

if $cqfd release && tar tf cqfd-cqfd-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-cqfd-foobar.tar.xz

jtest_prepare "build.archive can template filenames (value of the project.name configuration key)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%Pn-$CTEST.tar.xz!' .cqfdrc

if $cqfd release && tar tf cqfd-test-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-test-foobar.tar.xz

jtest_prepare "build.archive can template filenames (litteral '%' sign)"
sed -i -e '$ s!^archive=.*!archive=cqfd-%%-$CTEST.tar.xz!' .cqfdrc

if $cqfd release && tar tf cqfd-%-foobar.tar.xz >/dev/null 2>&1; then
jtest_result pass
else
jtest_result fail
fi
rm -f cqfd-%-foobar.tar.xz

################################################################################
# Now test generation of .tar.gz archives
################################################################################
Expand Down

0 comments on commit 4c48621

Please sign in to comment.