Skip to content

Commit

Permalink
selfupdate is broken #174 : adjust/fix selfupdate test
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 24, 2024
1 parent bdb9259 commit 05ae458
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 44 deletions.
6 changes: 5 additions & 1 deletion Makesurefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 0 additions & 29 deletions tests/200_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 0 additions & 14 deletions tests/200_update.tush
Original file line number Diff line number Diff line change
Expand Up @@ -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' ...
Expand Down
14 changes: 14 additions & 0 deletions tests/201_update_[wget].tush
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 05ae458

Please sign in to comment.