diff --git a/Makesurefile b/Makesurefile index e75e542..ec4b0b0 100644 --- a/Makesurefile +++ b/Makesurefile @@ -57,7 +57,7 @@ @goal prepared4tests @private @depends_on tush_installed debug -@goal_glob tests/*.tush @private +@goal @glob tests/*.tush @private @depends_on prepared4tests f="$ITEM" diff --git a/makesure.awk b/makesure.awk index e646cdf..80b4d6e 100755 --- a/makesure.awk +++ b/makesure.awk @@ -36,6 +36,7 @@ BEGIN { "@doc" == $1 { handleDoc(); next } "@depends_on" == $1 { handleDependsOn(); next } "@reached_if" == $1 { handleReachedIf(); next } +$1 ~ /^@/ { addError("Unknown directive: " $1); next } { handleCodeLine($0); next } END { if (!Died) doWork() } diff --git a/makesure_stable b/makesure_stable index a50c603..c19bcee 100755 --- a/makesure_stable +++ b/makesure_stable @@ -26,6 +26,7 @@ BEGIN { split("",Doc) # name -> doc str split("",ReachedIf) # name -> condition line split("",GlobFiles) # list + split("",GlobGoals) # list Mode = "prelude" # prelude/goal/goal_glob srand() prepareArgs() @@ -36,11 +37,11 @@ BEGIN { "@options" == $1 { handleOptions(); next } "@define" == $1 { handleDefine(); next } "@shell" == $1 { handleShell(); next } -"@goal" == $1 { handleGoal(); next } -"@goal_glob" == $1 { handleGoalGlob(); next } +"@goal" == $1 { if ("@glob" == $2 || "@glob" == $3) handleGoalGlob(); else handleGoal(); next } "@doc" == $1 { handleDoc(); next } "@depends_on" == $1 { handleDependsOn(); next } "@reached_if" == $1 { handleReachedIf(); next } +$1 ~ /^@/ { addError("Unknown directive: " $1); next } { handleCodeLine($0); next } END { if (!Died) doWork() } @@ -176,12 +177,14 @@ function registerGoal(goal_name, priv) { GoalsByName[goal_name] = priv } -function calcGlob(pattern, script, file) { +function calcGlob(goal_name, pattern, script, file) { + split("",GlobGoals) split("",GlobFiles) script = MyDirScript ";for f in ./" pattern ";do test -e \"$f\" && echo \"$f\";done" while ((script | getline file)>0) { file = substr(file, 3) arrPush(GlobFiles,file) + arrPush(GlobGoals,(goal_name ? goal_name "@" : "") file) } close(script) } @@ -198,9 +201,13 @@ function parseGoalLine( priv) { function handleGoalGlob( goal_name,priv,i) { started("goal_glob") priv = parseGoalLine() - calcGlob(trim($0)) - for (i=0; i