Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Makesurefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@define NEXT_VERSION '0.9.26'
@define GOAWK_VERSION '1.31.0' # https://github.com/benhoyt/goawk/releases
@define JUST_VERSION '1.3.0' # https://github.com/casey/just/releases
@define FHTAGN_VERSION 'v0.2.1' # https://github.com/xonixx/fhtagn/releases
@define FHTAGN_VERSION 'v0.3.0' # https://github.com/xonixx/fhtagn/releases
@define MDBOOK_VERSION 'v0.5.2' # https://github.com/rust-lang/mdBook/releases
@define MDBOOK_LINKCHECK_VERSION 'v0.7.7' # https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases
@define MDBOOKER_VERSION '11572b1' # https://github.com/xonixx/mdbooker/releases
Expand Down Expand Up @@ -86,13 +86,14 @@
@lib testing
run_tush_file() {
local f="$1"
local MAKESURE="$2"

[[ "$OSTYPE" == "linux-gnu"* ]] && [[ -d /dev/shm ]] && export TMPDIR="/dev/shm"

if [[ "$f" == *"[wget]"* ]] && ! command -v wget >/dev/null
then
echo "TESTS SKIPPED: $f"
elif "$FHTAGN" "$f"
elif "$FHTAGN" "$f" MAKESURE="$MAKESURE"
then
echo "TESTS PASSED : $f"
else
Expand All @@ -119,7 +120,7 @@
awk_ver 'MAKESURE_AWK' "$MAKESURE_AWK"
[[ $EXE_NAME == "gawk"* ]] && export MAKESURE_AWKLIBPATH="$(pwd)/soft/${EXE_NAME}_libs"
[[ "$OSTYPE" == "linux-gnu"* ]] && [[ -d /dev/shm ]] && export TMPDIR="/dev/shm"
MAKESURE=makesure_dev ALL=1 "$FHTAGN" tests/*.tush
ALL=1 "$FHTAGN" tests/*.tush MAKESURE=makesure_dev

# The idea of having this here (not using a named glob goal) is to be able
# to run `./makesure tests/test.tush` instead of `./makesure tested@tests/test.tush`
Expand All @@ -134,15 +135,13 @@
[[ -n $MAKESURE_AWK ]] && MAKESURE_AWK="$(realpath $MAKESURE_AWK)"
export MAKESURE_AWK
export MAKESURE_AWK_OPTS
MAKESURE=makesure_dev \
run_tush_file "$ITEM"
run_tush_file "$ITEM" makesure_dev

@goal tested_candidate @glob 'tests/*.tush' @private
@depends_on tested
@depends_on candidate_version_prepared
@use_lib testing
MAKESURE=makesure_candidate \
run_tush_file "$ITEM"
run_tush_file "$ITEM" makesure_candidate

@define COVERPROFILE '/tmp/cov.txt'

Expand Down
14 changes: 7 additions & 7 deletions tests/0_basic.tush
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

$ ./$MAKESURE -v | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
$ ./{{MAKESURE}} -v | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
| XXX

$ ./$MAKESURE --version | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
$ ./{{MAKESURE}} --version | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
| XXX

$ cd "tests/emptydir"; ../../$MAKESURE -v | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
$ cd "tests/emptydir"; ../../{{MAKESURE}} -v | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
| XXX

$ cd "tests/emptydir"; ../../$MAKESURE -h | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
$ cd "tests/emptydir"; ../../{{MAKESURE}} -h | awk -v "v=$NEXT_VERSION" '{ sub(v,"XXX") } 1'
| makesure ver. XXX
| Usage: makesure [options...] [-f buildfile] [goals...]
| -f,--file buildfile
Expand All @@ -25,14 +25,14 @@ $ cd "tests/emptydir"; ../../$MAKESURE -h | awk -v "v=$NEXT_VERSION" '{ sub(v,"X
| -h,--help print help and exit
| -U,--selfupdate update makesure to latest version

$ ./$MAKESURE -f non-existent-file
$ ./{{MAKESURE}} -f non-existent-file
@ makesure file not found: non-existent-file
? 1

$ cd "tests/emptydir"; ../../$MAKESURE
$ cd "tests/emptydir"; ../../{{MAKESURE}}
@ makesure file not found: Makesurefile
? 1

$ ./$MAKESURE -f tests/dir
$ ./{{MAKESURE}} -f tests/dir
| goal 'default' ...
| test
34 changes: 17 additions & 17 deletions tests/10_define.tush
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@

$ ./$MAKESURE -f tests/10_define.sh testA
$ ./{{MAKESURE}} -f tests/10_define.sh testA
| goal 'testA' ...
| A=aaa

$ ./$MAKESURE -f tests/10_define.sh testA -D A="val with spaces\"'"
$ ./{{MAKESURE}} -f tests/10_define.sh testA -D A="val with spaces\"'"
| goal 'testA' ...
| A=val with spaces"'

$ ./$MAKESURE -f tests/10_define.sh testB
$ ./{{MAKESURE}} -f tests/10_define.sh testB
| goal 'testB' ...
| B=aaabbb

$ ./$MAKESURE -f tests/10_define.sh -D B=xxx testB
$ ./{{MAKESURE}} -f tests/10_define.sh -D B=xxx testB
| goal 'testB' ...
| B=xxx

$ ./$MAKESURE -f tests/10_define.sh -D A=yyy testB
$ ./{{MAKESURE}} -f tests/10_define.sh -D A=yyy testB
| goal 'testB' ...
| B=yyybbb

$ ./$MAKESURE -f tests/10_define.sh testC
$ ./{{MAKESURE}} -f tests/10_define.sh testC
| goal 'testC' ...
| C=

$ ./$MAKESURE -f tests/10_define.sh testABC
$ ./{{MAKESURE}} -f tests/10_define.sh testABC
| goal 'testA' ...
| A=aaa
| goal 'testB' ...
Expand All @@ -32,7 +32,7 @@ $ ./$MAKESURE -f tests/10_define.sh testABC
| C=
| goal 'testABC' [empty].

$ ./$MAKESURE -f tests/10_define.sh testABC --define A=111 -D "B=222" --define 'C=333'
$ ./{{MAKESURE}} -f tests/10_define.sh testABC --define A=111 -D "B=222" --define 'C=333'
| goal 'testA' ...
| A=111
| goal 'testB' ...
Expand All @@ -41,13 +41,13 @@ $ ./$MAKESURE -f tests/10_define.sh testABC --define A=111 -D "B=222" --define '
| C=333
| goal 'testABC' [empty].

$ ./$MAKESURE -f tests/10_define.sh must_be_reached1
$ ./{{MAKESURE}} -f tests/10_define.sh must_be_reached1
| goal 'must_be_reached1' [already satisfied].

$ ./$MAKESURE -f tests/10_define.sh must_be_reached2
$ ./{{MAKESURE}} -f tests/10_define.sh must_be_reached2
| goal 'must_be_reached2' [already satisfied].

$ ./$MAKESURE -f tests/10_define.sh children_reached_or_not
$ ./{{MAKESURE}} -f tests/10_define.sh children_reached_or_not
| goal 'must_be_reached1' [already satisfied].
| goal 'must_be_reached2' [already satisfied].
| goal 'other_goal_2' ...
Expand All @@ -56,31 +56,31 @@ $ ./$MAKESURE -f tests/10_define.sh children_reached_or_not
| should show
| goal 'children_reached_or_not' [empty].

$ ./$MAKESURE -f tests/10_define.sh is_not_reached
$ ./{{MAKESURE}} -f tests/10_define.sh is_not_reached
| goal 'other_goal_2' ...
| other goal 2
| goal 'is_not_reached' ...
| should show

$ ./$MAKESURE -f tests/10_define.sh children_reached_or_not -d
$ ./{{MAKESURE}} -f tests/10_define.sh children_reached_or_not -d
| Resolved goals to reach for 'children_reached_or_not':
| other_goal_2
| is_not_reached

$ ./$MAKESURE -f tests/10_define.sh test_commented_define
$ ./{{MAKESURE}} -f tests/10_define.sh test_commented_define
| goal 'test_commented_define' ...
| in goal: value
| in child process: value

$ ./$MAKESURE -f tests/10_define.sh echo
$ ./{{MAKESURE}} -f tests/10_define.sh echo
| goal 'echo' ...
| Hello

$ ./$MAKESURE -f tests/10_define_in_goal.sh
$ ./{{MAKESURE}} -f tests/10_define_in_goal.sh
@ Shell code is not allowed outside goals/libs:
@ tests/10_define_in_goal.sh:4: echo "$0"
? 1

$ ./$MAKESURE -f tests/10_define_issue_142.sh issue142
$ ./{{MAKESURE}} -f tests/10_define_issue_142.sh issue142
| goal 'issue142' ...
| a b
16 changes: 8 additions & 8 deletions tests/11_goal_glob.tush
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

$ ./$MAKESURE -f tests/11_goal_glob.sh -l
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh -l
| Available goals:
| 'glob/file*.txt' : test goal_glob
| 'non-existent-glob*'
| test1
| test2
| glob_goal_name

$ ./$MAKESURE -f tests/11_goal_glob.sh -la
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh -la
| Available goals:
| glob/file_1.txt : test goal_glob
| glob/file_2.txt : test goal_glob
Expand All @@ -23,13 +23,13 @@ $ ./$MAKESURE -f tests/11_goal_glob.sh -la
| glob_goal_name@glob/file_10.txt
| glob_goal_name

$ ./$MAKESURE -f tests/11_goal_glob.sh -d 'glob/file*.txt'
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh -d 'glob/file*.txt'
| Resolved goals to reach for 'glob/file*.txt':
| glob/file_1.txt
| glob/file_3.txt
| glob/file_10.txt

$ ./$MAKESURE -f tests/11_goal_glob.sh test1
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh test1
| goal 'glob/file_1.txt' ...
| glob/file_1.txt :: 0 :: 4
| content 111
Expand All @@ -39,14 +39,14 @@ $ ./$MAKESURE -f tests/11_goal_glob.sh test1
| content 333
| goal 'test1' [empty].

$ ./$MAKESURE -f tests/11_goal_glob.sh test2
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh test2
| goal 'glob_goal_name@glob/file_2.txt' ...
| glob_goal_name ::: glob/file_2.txt :: 1 :: 4
| goal 'glob_goal_name@glob/file_3.txt' ...
| glob_goal_name ::: glob/file_3.txt :: 2 :: 4
| goal 'test2' [empty].

$ ./$MAKESURE -f tests/11_goal_glob.sh glob_goal_name
$ ./{{MAKESURE}} -f tests/11_goal_glob.sh glob_goal_name
| goal 'glob_goal_name@glob/file_1.txt' ...
| glob_goal_name ::: glob/file_1.txt :: 0 :: 4
| goal 'glob_goal_name@glob/file_2.txt' ...
Expand All @@ -57,7 +57,7 @@ $ ./$MAKESURE -f tests/11_goal_glob.sh glob_goal_name
| glob_goal_name ::: glob/file_10.txt :: 3 :: 4
| goal 'glob_goal_name' [empty].

$ ./$MAKESURE -f tests/11_goal_glob_lib.sh 'glob/file*.txt'
$ ./{{MAKESURE}} -f tests/11_goal_glob_lib.sh 'glob/file*.txt'
| goal 'glob/file_1.txt' ...
| Unnamed lib ::: glob/file_1.txt :: 0 :: 4
| @glob ::: glob/file_1.txt :: 0 :: 4
Expand All @@ -72,7 +72,7 @@ $ ./$MAKESURE -f tests/11_goal_glob_lib.sh 'glob/file*.txt'
| @glob ::: glob/file_10.txt :: 3 :: 4
| goal 'glob/file*.txt' [empty].

$ ./$MAKESURE -f tests/11_goal_glob_lib.sh glob_goal_name
$ ./{{MAKESURE}} -f tests/11_goal_glob_lib.sh glob_goal_name
| goal 'glob_goal_name@glob/file_1.txt' ...
| lib lib_name ::: glob/file_1.txt :: 0 :: 4
| glob_goal_name ::: glob/file_1.txt :: 0 :: 4
Expand Down
2 changes: 1 addition & 1 deletion tests/12_errors.tush
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

$ ./$MAKESURE -f tests/12_errors.sh
$ ./{{MAKESURE}} -f tests/12_errors.sh
@ Shell code is not allowed outside goals/libs:
@ tests/12_errors.sh:2: echo 'code in prelude'
@ Only use @reached_if in @goal:
Expand Down
6 changes: 3 additions & 3 deletions tests/13_doc.tush
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@


$ ./$MAKESURE -f tests/13_doc_multi1.sh
$ ./{{MAKESURE}} -f tests/13_doc_multi1.sh
@ Multiple @doc not allowed for a goal:
@ tests/13_doc_multi1.sh:4: @doc d2
? 1

$ ./$MAKESURE -f tests/13_doc_multi2.sh -l
$ ./{{MAKESURE}} -f tests/13_doc_multi2.sh -l
@ Multiple @doc not allowed for a goal:
@ tests/13_doc_multi2.sh:4: @doc d2
? 1

$ ./$MAKESURE -f tests/13_doc.sh -l
$ ./{{MAKESURE}} -f tests/13_doc.sh -l
| Available goals:
| a : doc for a
| b : doc for b
Expand Down
4 changes: 2 additions & 2 deletions tests/14_private.tush
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@


$ ./$MAKESURE -f tests/14_private.sh -l
$ ./{{MAKESURE}} -f tests/14_private.sh -l
| Available goals:
| a
| 14_private.sh

$ ./$MAKESURE -f tests/14_private.sh --list-all
$ ./{{MAKESURE}} -f tests/14_private.sh --list-all
| Available goals:
| a
| b
Expand Down
12 changes: 6 additions & 6 deletions tests/15_lib.tush
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@


$ ./$MAKESURE -f tests/15_lib.sh -l
$ ./{{MAKESURE}} -f tests/15_lib.sh -l
| Available goals:
| g1
| g2
| g3
| g4

$ ./$MAKESURE -f tests/15_lib.sh g1
$ ./{{MAKESURE}} -f tests/15_lib.sh g1
| goal 'g1' ...
| Hello World

$ ./$MAKESURE -f tests/15_lib.sh g2
$ ./{{MAKESURE}} -f tests/15_lib.sh g2
| goal 'g2' ...
| Hello lib_name World

$ ./$MAKESURE -f tests/15_lib.sh g3
$ ./{{MAKESURE}} -f tests/15_lib.sh g3
| goal 'g3' [already satisfied].

$ ./$MAKESURE -f tests/15_lib.sh g4
$ ./{{MAKESURE}} -f tests/15_lib.sh g4
| goal 'g4' ...
| Should see this

$ ./$MAKESURE -f tests/15_lib_unknown.sh g3
$ ./{{MAKESURE}} -f tests/15_lib_unknown.sh g3
@ Goal 'g3' uses unknown lib 'unknown':
@ tests/15_lib_unknown.sh:3: @use_lib unknown
? 1
4 changes: 2 additions & 2 deletions tests/16_define_validation.tush
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

$ ./$MAKESURE -f tests/16_define_validation_pass.sh
$ ./{{MAKESURE}} -f tests/16_define_validation_pass.sh
| goal 'default' ...
| EMPTY=
| EMPTY1=
Expand Down Expand Up @@ -31,7 +31,7 @@ $ ./$MAKESURE -f tests/16_define_validation_pass.sh
| LC1=aaabbb bbbcc'c cc'ca b ceee eee
| IL5=a-b

$ ./$MAKESURE -f tests/16_define_validation_error.sh
$ ./{{MAKESURE}} -f tests/16_define_validation_error.sh
@ Invalid @define syntax, should be @define VAR_NAME 'value':
@ tests/16_define_validation_error.sh:2: @define echo
@ Syntax error: wrong unquoted: 'echo;':
Expand Down
2 changes: 1 addition & 1 deletion tests/17_empty_prelude.tush
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

$ PATH=tests/wrapper/bash:$PATH ./$MAKESURE -f tests/17_empty_prelude.sh
$ PATH=tests/wrapper/bash:$PATH ./{{MAKESURE}} -f tests/17_empty_prelude.sh
| goal 'default' ...
| running bash
| hello
Loading
Loading