From 05ae458a33c6d71cbcc74f937e7800e6a391375d Mon Sep 17 00:00:00 2001 From: xonixx Date: Wed, 25 Dec 2024 00:33:28 +0200 Subject: [PATCH] selfupdate is broken #174 : adjust/fix selfupdate test --- Makesurefile | 6 +++++- tests/200_update.sh | 29 ----------------------------- tests/200_update.tush | 14 -------------- tests/201_update_[wget].tush | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 44 deletions(-) create mode 100644 tests/201_update_[wget].tush diff --git a/Makesurefile b/Makesurefile index 865592a..9e36693 100644 --- a/Makesurefile +++ b/Makesurefile @@ -87,7 +87,11 @@ local f="$1" [[ "$OSTYPE" == "linux-gnu"* ]] && [[ -d /dev/shm ]] && export TMPDIR="/dev/shm" - if "$FHTAGN" "$f" + + if [[ "$f" == *"[wget]"* ]] && ! command -v wget >/dev/null + then + echo "TESTS SKIPPED: $f" + elif "$FHTAGN" "$f" then echo "TESTS PASSED : $f" else diff --git a/tests/200_update.sh b/tests/200_update.sh index 92a96c4..a90c75d 100644 --- a/tests/200_update.sh +++ b/tests/200_update.sh @@ -8,16 +8,6 @@ @goal env_prepared [[ -d "$D" ]] && rm -r "$D" mkdir "$D" -# cat "$D/$MAKESURE"; exit - -# export NEXT_VERSION=0.9.22 # TODO calc by subtracting 1 -# if [[ "$("$D/$MAKESURE" --version)" != "$NEXT_VERSION" ]] -# then -# # this is compiled version -# awk '/^exec/ { sub(/Version=[0-9.]+/,"Version=XXX") } 1' "$D/$MAKESURE" > "$D/$MAKESURE"_1 -# cat "$D/$MAKESURE"_1 > "$D/$MAKESURE" -# rm "$D/$MAKESURE"_1 -# fi for cmd in awk mktemp rm cp dirname cat chmod do @@ -72,25 +62,6 @@ @use_lib run_selfupdate -# TODO is it possible to test via native wget if available? -#@goal wget_prepared -#@depends_on env_prepared -# cmd="wget" -# -# echo $'#!/bin/sh -#echo "running wget" -## fake wget with curl -#exec awk -v CURL="'$(command -v curl)$'" -v a1="$1" -v a2="$2" -v a3="$3" \' -#BEGIN { -#sub(/-q/,"-s",a1) -#sub(/-O/,"-o",a3) -##print(CURL " " a1 " " a2 " " a3) -#system(CURL " " a1 " " a2 " " a3) -#}\' -#' > "$D/$cmd" -# -# chmod +x "$D/$cmd" - @goal wget_prepared @depends_on env_prepared cmd="wget" diff --git a/tests/200_update.tush b/tests/200_update.tush index 84c531b..6fdde23 100644 --- a/tests/200_update.tush +++ b/tests/200_update.tush @@ -9,20 +9,6 @@ $ { ./$MAKESURE -f tests/200_update.sh test_err; echo 'exit_code '$?; } | awk '/ @ Please use manual update: https://makesure.dev/Installation.html ? 1 -$ ./$MAKESURE -f tests/200_update.sh test_wget | awk '{ gsub(/[0-9][0-9.]+/,"VER") } 1' -| goal 'env_prepared' ... -| goal 'wget_prepared' ... -| goal 'test_wget' ... -| VER -| selfupdate 1 -| running wget -| running wget -| updated VER -> VER -| selfupdate 2 -| running wget -| you have latest version VER installed -| VER - $ ./$MAKESURE -f tests/200_update.sh test_curl | awk '{ gsub(/[0-9][0-9.]+/,"VER") } 1' | goal 'env_prepared' ... | goal 'curl_prepared' ... diff --git a/tests/201_update_[wget].tush b/tests/201_update_[wget].tush new file mode 100644 index 0000000..151d490 --- /dev/null +++ b/tests/201_update_[wget].tush @@ -0,0 +1,14 @@ + +$ ./$MAKESURE -f tests/200_update.sh test_wget | awk '{ gsub(/[0-9][0-9.]+/,"VER") } 1' +| goal 'env_prepared' ... +| goal 'wget_prepared' ... +| goal 'test_wget' ... +| VER +| selfupdate 1 +| running wget +| running wget +| updated VER -> VER +| selfupdate 2 +| running wget +| you have latest version VER installed +| VER