From ecd9b1103eccc8a514dac75076b8de6533d3a2cc Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 1 Jan 2025 11:12:27 -0800
Subject: [PATCH] Updated test-versioning.sh for SDL2 branch
---
build-scripts/test-versioning.sh | 49 +++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 17 deletions(-)
diff --git a/build-scripts/test-versioning.sh b/build-scripts/test-versioning.sh
index a477669..7328fbc 100755
--- a/build-scripts/test-versioning.sh
+++ b/build-scripts/test-versioning.sh
@@ -9,11 +9,11 @@ cd `dirname $0`/..
# Needed so sed doesn't report illegal byte sequences on macOS
export LC_CTYPE=C
-ref_major=$(sed -ne 's/^#define SDL_NET_MAJOR_VERSION *//p' include/SDL_net.h)
-ref_minor=$(sed -ne 's/^#define SDL_NET_MINOR_VERSION *//p' include/SDL_net.h)
-ref_micro=$(sed -ne 's/^#define SDL_NET_PATCHLEVEL *//p' include/SDL_net.h)
+header=include/SDL_net.h
+ref_major=$(sed -ne 's/^#define SDL_NET_MAJOR_VERSION *//p' $header)
+ref_minor=$(sed -ne 's/^#define SDL_NET_MINOR_VERSION *//p' $header)
+ref_micro=$(sed -ne 's/^#define SDL_NET_PATCHLEVEL *//p' $header)
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
-ref_sdl_req=$(sed -ne 's/^SDL_VERSION=//p' configure.ac)
tests=0
failed=0
@@ -33,11 +33,12 @@ major=$(sed -Ene 's/^m4_define\(\[MAJOR_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' c
minor=$(sed -Ene 's/^m4_define\(\[MINOR_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' configure.ac)
micro=$(sed -Ene 's/^m4_define\(\[MICRO_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' configure.ac)
version="${major}.${minor}.${micro}"
+ref_sdl_req=$(sed -ne 's/^SDL_VERSION=//p' configure.ac)
if [ "$ref_version" = "$version" ]; then
ok "configure.ac $version"
else
- not_ok "configure.ac $version disagrees with SDL_net.h $ref_version"
+ not_ok "configure.ac $version disagrees with $header $ref_version"
fi
major=$(sed -ne 's/^MAJOR_VERSION=//p' configure)
@@ -48,7 +49,7 @@ version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "configure $version"
else
- not_ok "configure $version disagrees with SDL_net.h $ref_version"
+ not_ok "configure $version disagrees with $header $ref_version"
fi
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
@@ -60,11 +61,11 @@ version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "CMakeLists.txt $version"
else
- not_ok "CMakeLists.txt $version disagrees with SDL_net.h $ref_version"
+ not_ok "CMakeLists.txt $version disagrees with $header $ref_version"
fi
if [ "$ref_sdl_req" = "$sdl_req" ]; then
- ok "CMakeLists.txt SDL_REQUIRED_VERSION is consistent"
+ ok "CMakeLists.txt $sdl_req"
else
not_ok "CMakeLists.txt SDL_REQUIRED_VERSION=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
fi
@@ -77,7 +78,7 @@ version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "Makefile.os2 $version"
else
- not_ok "Makefile.os2 $version disagrees with SDL_net.h $ref_version"
+ not_ok "Makefile.os2 $version disagrees with $header $ref_version"
fi
for rcfile in src/version.rc VisualC/Version.rc; do
@@ -87,7 +88,7 @@ for rcfile in src/version.rc VisualC/Version.rc; do
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile FILEVERSION $tuple"
else
- not_ok "$rcfile FILEVERSION $tuple disagrees with SDL_net.h $ref_tuple"
+ not_ok "$rcfile FILEVERSION $tuple disagrees with $header $ref_tuple"
fi
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r')
@@ -95,24 +96,24 @@ for rcfile in src/version.rc VisualC/Version.rc; do
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile PRODUCTVERSION $tuple"
else
- not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_net.h $ref_tuple"
+ not_ok "$rcfile PRODUCTVERSION $tuple disagrees with $header $ref_tuple"
fi
- tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]+)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
+ tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile FileVersion $tuple"
else
- not_ok "$rcfile FileVersion $tuple disagrees with SDL_net.h $ref_tuple"
+ not_ok "$rcfile FileVersion $tuple disagrees with $header $ref_tuple"
fi
- tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]+)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
+ tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile ProductVersion $tuple"
else
- not_ok "$rcfile ProductVersion $tuple disagrees with SDL_net.h $ref_tuple"
+ not_ok "$rcfile ProductVersion $tuple disagrees with $header $ref_tuple"
fi
done
@@ -121,7 +122,7 @@ version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleShortVersionString $version"
else
- not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_net.h $ref_version"
+ not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with $header $ref_version"
fi
version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
@@ -129,7 +130,7 @@ version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcod
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleVersion $version"
else
- not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_net.h $ref_version"
+ not_ok "Info-Framework.plist CFBundleVersion $version disagrees with $header $ref_version"
fi
# For simplicity this assumes we'll never break ABI before SDL 3.
@@ -177,5 +178,19 @@ else
not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
fi
+######
+if false; then
+
+sdl_req=$(sed -ne 's/\$sdl2_version = "\([0-9.]*\)"$/\1/p' .github/fetch_sdl_vc.ps1)
+
+if [ "$ref_sdl_req" = "$sdl_req" ]; then
+ ok ".github/fetch_sdl_vc.ps1 $sdl_req"
+else
+ not_ok ".github/fetch_sdl_vc.ps1 sdl2_version=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
+fi
+
+fi # false
+######
+
echo "1..$tests"
exit "$failed"