Skip to content

Commit

Permalink
rm unused and undocumented global variable MYDIR #178
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 31, 2024
1 parent 6c65204 commit 8e36673
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 65 deletions.
2 changes: 1 addition & 1 deletion makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BEGIN {
Mode = "prelude" # prelude|define|goal|goal_glob|lib
srand()
prepareArgs()
MyDirScript = "MYDIR=" quoteArg(getMyDir(ARGV[1])) ";export MYDIR;cd \"$MYDIR\""
MyDirScript = "cd " quoteArg(getMyDir(ARGV[1]))
Error = ""
makesure()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/200_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@lib
function prepare_makesure() {
awk -v X="$(cd "$MYDIR/.."; pwd)" '/AWK_DIR=/{ $0 = "AWK_DIR=" X } 1' "../$MAKESURE" > "$D/$MAKESURE"
awk -v X="$(cd ..; pwd)" '/AWK_DIR=/{ $0 = "AWK_DIR=" X } 1' "../$MAKESURE" > "$D/$MAKESURE"
chmod +x "$D/$MAKESURE"
}
function run_selfupdate() {
Expand Down
17 changes: 2 additions & 15 deletions tests/2_mydir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
@goal mydir_2
cat ./2_mydir.txt

@goal mydir_3
cat "$MYDIR/2_mydir.txt"

@goal mydir_in_reached_if_1
@reached_if [[ -f 2_mydir.txt ]]
echo "should not show"
Expand All @@ -17,10 +14,6 @@
@reached_if [[ -f ./2_mydir.txt ]]
echo "should not show"

@goal mydir_in_reached_if_3
@reached_if [[ -f "$MYDIR/2_mydir.txt" ]]
echo "should not show"

@goal mydir_in_reached_if_4
@reached_if [[ ! -f 2_mydir.txt ]]
echo "should show"
Expand All @@ -29,10 +22,6 @@
@reached_if [[ ! -f ./2_mydir.txt ]]
echo "should show"

@goal mydir_in_reached_if_6
@reached_if [[ ! -f "$MYDIR/2_mydir.txt" ]]
echo "should show"

@goal mydir_in_reached_if_of_dep_1
@depends_on dep_1
echo "should show"
Expand All @@ -43,14 +32,12 @@

@goal dep_1
@depends_on dep_3
#@reached_if echo "#$MYDIR#"; [[ -f "$MYDIR/2_mydir.txt" ]]
@reached_if [[ -f "$MYDIR/2_mydir.txt" ]]
@reached_if [[ -f "./2_mydir.txt" ]]
echo "should not show"

@goal dep_2
@depends_on dep_3
#@reached_if echo "#$MYDIR#"; [[ ! -f "$MYDIR/2_mydir.txt" ]]
@reached_if [[ ! -f "$MYDIR/2_mydir.txt" ]]
@reached_if [[ ! -f "./2_mydir.txt" ]]
echo "should show"

@goal dep_3
Expand Down
13 changes: 1 addition & 12 deletions tests/2_mydir.tush
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ $ ./$MAKESURE -f tests/2_mydir.sh mydir_2
| goal 'mydir_2' ...
| mydir

$ ./$MAKESURE -f tests/2_mydir.sh mydir_3
| goal 'mydir_3' ...
| mydir

$ ./$MAKESURE -f tests/dir\ with\ spaces/2_mydir.sh
| goal 'default' ...
| mydir

$ cd "$MYDIR/tests/dir with spaces"; ../../$MAKESURE -f 2_mydir.sh
$ cd "tests/dir with spaces"; ../../$MAKESURE -f 2_mydir.sh
| goal 'default' ...
| mydir

Expand All @@ -25,9 +21,6 @@ $ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_1
$ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_2
| goal 'mydir_in_reached_if_2' [already satisfied].

$ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_3
| goal 'mydir_in_reached_if_3' [already satisfied].

$ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_4
| goal 'mydir_in_reached_if_4' ...
| should show
Expand All @@ -36,10 +29,6 @@ $ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_5
| goal 'mydir_in_reached_if_5' ...
| should show

$ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_6
| goal 'mydir_in_reached_if_6' ...
| should show

$ ./$MAKESURE -f tests/2_mydir.sh mydir_in_reached_if_of_dep_1
| goal 'dep_1' [already satisfied].
| goal 'mydir_in_reached_if_of_dep_1' ...
Expand Down
32 changes: 0 additions & 32 deletions tests/4_trace.tush
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,21 @@ $ ./$MAKESURE -f tests/4_trace.sh -x 2>&1 | awk -f tests/unify_tracing_o
| goal 'default' ...
| A=aaa
@ + : default@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + [[ 1 -eq 2 ]]
@ + : goal2@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + true
@ + : goal1
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + echo goal1
@ + : default
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
Expand All @@ -48,29 +40,21 @@ $ ./$MAKESURE -f tests/4_trace.sh --tracing 2>&1 | awk -f tests/unify_tracing_o
| goal 'default' ...
| A=aaa
@ + : default@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + [[ 1 -eq 2 ]]
@ + : goal2@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + true
@ + : goal1
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + echo goal1
@ + : default
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
Expand All @@ -91,29 +75,21 @@ $ ./$MAKESURE -f tests/4_trace_shell_sh.sh -x 2>&1 | awk -f tests/unify_
| goal 'default' ...
| A=aaa
@ + : default@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + [ 1 -eq 2 ]
@ + : goal2@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + true
@ + : goal1
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + echo goal1
@ + : default
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
Expand All @@ -126,29 +102,21 @@ $ ./$MAKESURE -f tests/4_trace_shell_sh.sh --tracing 2>&1 | awk -f tests/unify_
| goal 'default' ...
| A=aaa
@ + : default@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + [ 1 -eq 2 ]
@ + : goal2@reached_if
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + true
@ + : goal1
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
@ + echo goal1
@ + : default
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + A=aaa
@ + export A
Expand Down
2 changes: 0 additions & 2 deletions tests/7_options.tush
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ $ ./$MAKESURE -f tests/7_options_tracing.sh 2>&1 | awk -f tests/unify_tracing_
| goal 'default' ...
| test
@ + : default
@ + MYDIR=/some/path/tests
@ + export MYDIR
@ + cd /some/path/tests
@ + echo test
2 changes: 1 addition & 1 deletion tests/dir with spaces/2_mydir.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

@goal default
cat "$MYDIR/2_mydir.txt"
cat 2_mydir.txt
2 changes: 1 addition & 1 deletion tests/unify_tracing_output.awk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
sub(ENVIRON["MYDIR"],"/some/path")
sub(/cd .+\/tests/,"cd /some/path/tests") # my dir
sub(/'\['/,"[")
sub(/'\]'/,"]")
sub(/echo 'A=aaa'/,"echo A=aaa")
Expand Down

0 comments on commit 8e36673

Please sign in to comment.