Skip to content

Commit

Permalink
fix: epel9 tests (#30)
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT authored Jan 22, 2024
1 parent 5d8159e commit eac47a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions test/DynamicVersion/test_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rlJournalStart
[[ -n "$CMakeExtraUtils_ROOT" ]] && rlRun "base_configure_args=\"\${base_configure_args} -DCMakeExtraUtils_ROOT=\${CMakeExtraUtils_ROOT}\"" 0 "Add CMakeExtraUtils_ROOT"
rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes"
rlRun "set -o pipefail"
rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\"" 0 "Workaround for hatch/setuptools_scm issue"
rlPhaseEnd

for mode in DEV POST; do
Expand Down Expand Up @@ -58,7 +59,8 @@ rlJournalStart
rlRun "distance=0 && echo \${distance}" 0 "Extract git distance"
rlRun "git archive HEAD --prefix=${archive_name}/ -o ${archive_name}.tar.gz" 0 "Git archive"
rlRun "tar -xf ${archive_name}.tar.gz" 0 "Extract archive"
rlRun "version_full=\$(cd ${archive_name} && hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlIsCentOS && rlRun "echo \$(cd ${archive_name} && hatch version)" 0 "Setup hatch environment"
rlRun "version_full=\$(cd ${archive_name} && hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun -s "cmake -S ${archive_name} ${configure_args}" 0 "CMake configure"
rlAssertGrep "^\[TestProject\] version: ${tag_version}\$" $rlRun_LOG
rlAssertGrep "^\[TestProject\] version-full: ${version_full}\$" $rlRun_LOG
Expand Down Expand Up @@ -93,7 +95,8 @@ rlJournalStart
rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance"
rlRun "git archive HEAD --prefix=${archive_name}/ -o ${archive_name}.tar.gz" 0 "Git archive"
rlRun "tar -xf ${archive_name}.tar.gz" 0 "Extract archive"
rlRun "version_full=\$(cd ${archive_name} && hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlIsCentOS && rlRun "echo \$(cd ${archive_name} && hatch version)" 0 "Setup hatch environment"
rlRun "version_full=\$(cd ${archive_name} && hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version"
rlRun -s "cmake -S ${archive_name} ${configure_args}" 0 "CMake configure"
rlAssertGrep "^\[TestProject\] version: ${version}\$" $rlRun_LOG
Expand Down
7 changes: 4 additions & 3 deletions test/DynamicVersion/test_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rlJournalStart
rlRun "configure_args=\"-B \${build_dir} \${base_configure_args}\" && echo \${configure_args}" 0 "Set temporary configure_args"
rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes"
rlRun "set -o pipefail"
rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\" && hatch version || true" 0 "Workaround for hatch/setuptools_scm issue"
rlPhaseEnd

rlPhaseStartTest "Not a git repo not an archive: Should fail"
Expand Down Expand Up @@ -59,7 +60,7 @@ rlJournalStart
rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash"
rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe"
rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance"
rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun -s "cmake ${configure_args}" 0 "CMake configure"
rlAssertGrep "^\[TestProject\] version: ${tag_version}\$" $rlRun_LOG
rlAssertGrep "^\[TestProject\] version-full: ${version_full}\$" $rlRun_LOG
Expand Down Expand Up @@ -109,7 +110,7 @@ rlJournalStart
rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash"
rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe"
rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance"
rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version"
# Check if it re-configured due to version change
rlRun -s "cmake ${build_args} -t version" 0 "CMake build (version) 1st"
Expand Down Expand Up @@ -163,7 +164,7 @@ rlJournalStart
rlRun "git tag v\${tag_version}" 0 "Tag commit"
rlRun "describe=\$(git describe --tags --long) && echo \${describe}" 0 "Get git describe"
rlRun "distance=\$(echo \${describe} | sed -E 's/.*-([0-9]+)-.*/\1/') && echo \${distance}" 0 "Extract git distance"
rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
# Commit did not change, it should not re-configure
rlRun -s "cmake ${build_args} -t commit" 0 "CMake build (commit) 1st"
rlAssertNotGrep "Re-running CMake" $rlRun_LOG
Expand Down
5 changes: 3 additions & 2 deletions test/DynamicVersion/test_sdist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rlJournalStart
[[ -n "$CMakeExtraUtils_ROOT" ]] && rlRun "base_configure_args=\"\${base_configure_args} -DCMakeExtraUtils_ROOT=\${CMakeExtraUtils_ROOT}\"" 0 "Add CMakeExtraUtils_ROOT"
rlRun "echo '.git_archival.txt export-subst' > .gitattributes" 0 "Configure .gitattributes"
rlRun "set -o pipefail"
rlIsCentOS && rlRun "export PYTHONWARNINGS=\"ignore::RuntimeWarning\" && hatch_args=\"2>&1\" && hatch version || true" 0 "Workaround for hatch/setuptools_scm issue"
rlPhaseEnd

for mode in DEV POST; do
Expand Down Expand Up @@ -41,7 +42,7 @@ rlJournalStart
rlRun "rm -rf ${build_dir} dist testproject-*" 0 "Clean the build, dist, extracted directory"
rlRun "tag_version=0.0.0" 0 "Set tag_version"
rlRun "git tag v\${tag_version}" 0 "Tag git commit"
rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "commit=\$(git rev-parse HEAD) && echo \${commit}" 0 "Get git commit"
rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash"
rlRun "describe=\$(git describe --tags) && echo \${describe}" 0 "Get git describe"
Expand Down Expand Up @@ -76,7 +77,7 @@ rlJournalStart
rlRun "touch ./random_file" 0 "Create a random file"
rlRun "git add random_file" 0 "Git add the random file"
rlRun "git commit -m 'Moved commit'" 0 "Git commit (off-tag)"
rlRun "version_full=\$(hatch version) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version_full=\$(hatch version ${hatch_args:-""}) && echo \${version_full}" 0 "Get setuptools_scm version"
rlRun "version=\$(echo \${version_full} | sed -E 's/([0-9\.]*)\.[a-z].*/\1/') && echo \${version}" 0 "Strip version"
rlRun "commit=\$(git rev-parse HEAD) && echo \${commit}" 0 "Get git commit"
rlRun "short_hash=\$(git rev-parse --short HEAD) && echo \${short_hash}" 0 "Get git short-hash"
Expand Down

0 comments on commit eac47a4

Please sign in to comment.