Avoid running version test when git describe fails

Can happen when not enough history has been fetched, notably in our CI
This commit is contained in:
ISSOtm
2020-12-10 13:43:22 +01:00
parent 2b6d9cd1e0
commit bdfce25db0
3 changed files with 22 additions and 15 deletions

5
test/asm/.gitignore vendored
View File

@@ -1,2 +1,3 @@
quote\"file.* /quote\"file.*
version.out /version.asm
/version.out

View File

@@ -2,18 +2,19 @@
export LC_ALL=C export LC_ALL=C
o=$(mktemp) o="$(mktemp)"
gb=$(mktemp) gb="$(mktemp)"
input=$(mktemp) input="$(mktemp)"
output=$(mktemp) output="$(mktemp)"
errput=$(mktemp) errput="$(mktemp)"
rc=0 rc=0
bold=$(tput bold) bold="$(tput bold)"
resbold=$(tput sgr0) resbold="$(tput sgr0)"
red=$(tput setaf 1) red="$(tput setaf 1)"
green=$(tput setaf 2) green="$(tput setaf 2)"
rescolors=$(tput op) orange="$(tput setaf 3)"
rescolors="$(tput op)"
tryDiff () { tryDiff () {
diff -u --strip-trailing-cr $1 $2 || (echo "${bold}${red}${i%.asm}${variant}.$3 mismatch!${rescolors}${resbold}"; false) diff -u --strip-trailing-cr $1 $2 || (echo "${bold}${red}${i%.asm}${variant}.$3 mismatch!${rescolors}${resbold}"; false)
} }
@@ -23,7 +24,13 @@ tryCmp () {
} }
# Add the version constants test, outputting the closest tag to the HEAD # Add the version constants test, outputting the closest tag to the HEAD
git describe --tags --abbrev=0 > version.out if git describe --tags --abbrev=0 > version.out; then
cat > version.asm <<EOF
PRINTT "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}\n"
EOF
else
echo "${bold}${orange}Warning: cannot run version test!${rescolors}${resbold}"
fi
# Add the quote test, except on Windows # Add the quote test, except on Windows
if uname | grep -viq mingw; then if uname | grep -viq mingw; then
@@ -40,7 +47,7 @@ fi
for i in *.asm; do for i in *.asm; do
for variant in '' '.pipe'; do for variant in '' '.pipe'; do
echo -e "${bold}${green}${i%.asm}${variant}...${rescolors}${resbold}" echo "${bold}${green}${i%.asm}${variant}...${rescolors}${resbold}"
if [ -z "$variant" ]; then if [ -z "$variant" ]; then
../../rgbasm -Weverything -o $o $i > $output 2> $errput ../../rgbasm -Weverything -o $o $i > $output 2> $errput
desired_output=${i%.asm}.out desired_output=${i%.asm}.out

View File

@@ -1 +0,0 @@
PRINTT "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}\n"