1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-05-17 08:28:42 +03:00
inform7/inform7/Tests/inform7.intest
2019-03-16 13:12:11 +00:00

392 lines
14 KiB
Plaintext

-if osx -set hash_utility 'md5'
-if gnome -set hash_utility 'md5'
-if linux -set hash_utility 'md5'
-set extensions_testing_area 'inform7/Tests/Test Extensions'
-set hash_cache 'inform7/Tests/hashes.intest'
-cases [Main] 'inform7/Tests/Test Cases'
! -cases [Inter] 'inform7/Tests/Test Inter'
-if osx -cases [Index] 'inform7/Tests/Test Index'
-if osx -cases [Map] 'inform7/Tests/Test Maps'
-if osx -cases [Release] 'inform7/Tests/Test Releases'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Complex Listing.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Locksmith.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Punctuation Removal.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Skeleton Keys.i7x'
-extensions [Main] 'inform7/Internal/Extensions/Graham Nelson'
-examples [Main] Documentation/Examples
-problems [Main] 'inform7/Tests/Test Problems'
-recipe [Main]
set: $I6 = inform6/Tangled/inform6
set: $I7 = inform7/Tangled/inform7
set: $INTERNAL = inform7/Internal
set: $WORKSPACE = intest/Workspace
set: $ZINT = inform6/Tests/Assistants/dumb-frotz/dumb-frotz
set: $GINT = inform6/Tests/Assistants/dumb-glulx/glulxe/glulxe
! First we decide whether to compile it for the Z-machine or Glulx.
set: $VM = Z
if: $CASE %c*-G
set: $VM = G
endif
if: $CASE %c*Metric%c*Units%c*
set: $VM = G
endif
! On the basis of which:
if: $VM G
set: $FORMAT = ulx
set: $I6OPTIONS = -E2SDwGx
set: $INT = $GINT
set: $INTNAME = dumb-glulxe
set: $INTOPTIONS = -u
else
set: $FORMAT = z8
set: $I6OPTIONS = -E2SDwv8x
set: $INT = $ZINT
set: $INTNAME = dumb-frotz
set: $INTOPTIONS = -w 1000
endif
! Now we extract the source text from whatever file originated the test
! case: this is a non-trivial operation when the file is an Extension or
! an example, but is a simple copy operation otherwise.
extract: $WORK/Example.inform/Source/story.ni $VM
! Test cases from map indexing problem messages require ni to get as far as
! indexing, so the -noindex option mustn't be used in this case.
mkdir: $WORK/Transient
step: find $WORK/Transient -mindepth 1 -delete
mkdir: $PATH/_Results_Actual
mkdir: $PATH/_Results_Ideal
if: $CASE PM_Map%c*
set: $I7OPTIONS = -format=$FORMAT -noprogress -fixtime -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -internal $INTERNAL
else
set: $I7OPTIONS = -format=$FORMAT -noprogress -fixtime -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -noindex -internal $INTERNAL
endif
if: $VM G
set: $SRINTERB = inform7/Internal/I6T/sr-G.interb
else
set: $SRINTERB = inform7/Internal/I6T/sr-Z.interb
endif
! if: $CASE Imp_%c*
! set: $INTERCHAIN = import:$SRINTERB,link:Output.i6t,parse-linked-matter,resolve-conditional-compilation,assimilate,make-identifiers-unique,reconcile-verbs,generate-inter:haha.txt,generate-i6:*
! set: $IMPORT = -import $SRINTERB
! else
! set: $INTERCHAIN = import:$SRINTERB,link:Output.i6t,parse-linked-matter,resolve-conditional-compilation,assimilate,make-identifiers-unique,reconcile-verbs,generate-inter:haha.txt,generate-i6:*
! set: $IMPORT = -import $SRINTERB
! endif
set: $INTERCHAIN = link:Output.i6t,parse-linked-matter,resolve-conditional-compilation,assimilate,make-identifiers-unique,reconcile-verbs,generate-inter:haha.txt,generate-i6:*
! First, problem message cases, where we require ni to fail and with the
! correct output.
if: $TYPE problem
set: $A = $PATH/_Results_Actual/$CASE.txt
set: $I = $PATH/_Results_Ideal/$CASE.txt
! fail step: $I7 `$I7OPTIONS -require-problem $CASE -project $WORK/Example.inform -import $SRINTERB -inter $INTERCHAIN >$A 2>&1
fail step: $I7 `$I7OPTIONS -require-problem $CASE -project $WORK/Example.inform -inter $INTERCHAIN >$A 2>&1
or: 'failed to produce its namesake Problem message' $A
show: $A
exists: $I
or: 'produced Problem(s), but no ideal transcript existed'
match problem: $A $I
or: 'produced the wrong Problem message(s)'
pass: 'passed'
endif
! And then the general case.
set: $I7CONSOLE = $WORK/Example.inform/Build/i7_output.txt
! step: $I7 `$I7OPTIONS -format=$FORMAT -project $WORK/Example.inform -import $SRINTERB -inter $INTERCHAIN >$I7CONSOLE 2>&1
step: $I7 `$I7OPTIONS -format=$FORMAT -project $WORK/Example.inform -inter $INTERCHAIN >$I7CONSOLE 2>&1
or: 'failed with Problem message(s)' $I7CONSOLE
show: $I7CONSOLE
set: $I6SOURCE = $WORK/Example.inform/Build/auto.inf
hash: $I6SOURCE $WORK/Example.inform/Build/checksum.txt
or: 'passed (matching cached I6 known to work)'
set: $I6CONSOLE = $WORK/Example.inform/Build/i6_output.txt
set: $STORYFILE = $WORK/Example.inform/Build/output.$FORMAT
step: $I6 `$I6OPTIONS $I6SOURCE $STORYFILE >$I6CONSOLE 2>&1
or: 'failed to pass through Inform 6' $I6CONSOLE
show i6: $I6CONSOLE
set: $A = $PATH/_Results_Actual/$CASE.txt
set: $I = $PATH/_Results_Ideal/$CASE.txt
step: $INT `$INTOPTIONS $STORYFILE <$SCRIPT >$A 2>&1
or: 'unable to run $INTNAME (do you need to make interpreters?)'
exists: $I
or: 'translated successfully but no ideal transcript existed'
if: $VM G
match glulxe transcript: $A $I
or: 'played incorrectly'
else
match frotz transcript: $A $I
or: 'played incorrectly'
endif
pass: 'passed'
-end
-recipe [Index]
set: $I7 = inform7/Tangled/inform7
set: $INTERNAL = inform7/Internal
set: $WORKSPACE = intest/Workspace
! This recipe is for testing that the index in a sample project is correct.
set: $VM = G
extract: $WORK/Example.inform/Source/story.ni $VM
set: $I7OPTIONS = -fixtime -format=ulx -noprogress -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -internal $INTERNAL
set: $I7CONSOLE = $WORK/Example.inform/Build/i7_output.txt
mkdir: $WORK/Transient
step: find $WORK/Transient -mindepth 1 -delete
mkdir: $PATH/_Indices_Actual
mkdir: $PATH/_Indices_Ideal
step: $I7 `$I7OPTIONS -project $WORK/Example.inform >$I7CONSOLE 2>&1
or: 'failed with Problem message(s)' $I7CONSOLE
set: $A = $PATH/_Indices_Actual/$CASE
set: $I = $PATH/_Indices_Ideal/$CASE
mkdir: $A
mkdir: $I
copy: $WORK/Transient/Documentation/Extensions.html $A/Extensions.html
copy: $WORK/Transient/Documentation/ExtIndex.html $A/ExtIndex.html
copy: '$WORK/Transient/Documentation/Extensions/Graham Nelson/Metric Units.html' $A/Metric.html
copy: $WORK/Transient/Documentation/Census/Dictionary.txt $A/Dictionary.txt
copy: $WORK/Example.inform/Index/Actions.html $A/Actions.html
copy: $WORK/Example.inform/Index/Contents.html $A/Contents.html
copy: $WORK/Example.inform/Index/Kinds.html $A/Kinds.html
copy: $WORK/Example.inform/Index/Phrasebook.html $A/Phrasebook.html
copy: $WORK/Example.inform/Index/Rules.html $A/Rules.html
copy: $WORK/Example.inform/Index/Scenes.html $A/Scenes.html
copy: $WORK/Example.inform/Index/Welcome.html $A/Welcome.html
copy: $WORK/Example.inform/Index/World.html $A/World.html
exists: $I/Extensions.html
or: 'no ideal Extensions.html exists'
step: diff $A/Extensions.html $I/Extensions.html >$WORK/diff_output.txt
or: 'produced the wrong Extensions.html' $WORK/diff_output.txt
exists: $I/Metric.html
or: 'no ideal Metric.html exists'
step: diff $A/Metric.html $I/Metric.html >$WORK/diff_output.txt
or: 'produced the wrong Metric.html' $WORK/diff_output.txt
exists: $I/Dictionary.txt
or: 'no ideal Dictionary.txt exists'
step: diff $A/Dictionary.txt $I/Dictionary.txt >$WORK/diff_output.txt
or: 'produced the wrong Dictionary.txt' $WORK/diff_output.txt
exists: $I/ExtIndex.html
or: 'no ideal ExtIndex.html exists'
step: diff $A/ExtIndex.html $I/ExtIndex.html >$WORK/diff_output.txt
or: 'produced the wrong ExtIndex.html' $WORK/diff_output.txt
exists: $I/Actions.html
or: 'no ideal Actions.html exists'
step: diff $A/Actions.html $I/Actions.html >$WORK/diff_output.txt
or: 'produced the wrong Actions.html' $WORK/diff_output.txt
exists: $I/Contents.html
or: 'no ideal Contents.html exists'
step: diff $A/Contents.html $I/Contents.html >$WORK/diff_output.txt
or: 'produced the wrong Contents.html' $WORK/diff_output.txt
exists: $I/Kinds.html
or: 'no ideal Kinds.html exists'
step: diff $A/Kinds.html $I/Kinds.html >$WORK/diff_output.txt
or: 'produced the wrong Kinds.html' $WORK/diff_output.txt
exists: $I/Phrasebook.html
or: 'no ideal Phrasebook.html exists'
step: diff $A/Phrasebook.html $I/Phrasebook.html >$WORK/diff_output.txt
or: 'produced the wrong Phrasebook.html' $WORK/diff_output.txt
exists: $I/Rules.html
or: 'no ideal Rules.html exists'
step: diff $A/Rules.html $I/Rules.html >$WORK/diff_output.txt
or: 'produced the wrong Rules.html' $WORK/diff_output.txt
exists: $I/Scenes.html
or: 'no ideal Scenes.html exists'
step: diff $A/Scenes.html $I/Scenes.html >$WORK/diff_output.txt
or: 'produced the wrong Scenes.html' $WORK/diff_output.txt
exists: $I/Welcome.html
or: 'no ideal Welcome.html exists'
step: diff $A/Welcome.html $I/Welcome.html >$WORK/diff_output.txt
or: 'produced the wrong Welcome.html' $WORK/diff_output.txt
exists: $I/World.html
or: 'no ideal World.html exists'
step: diff $A/World.html $I/World.html >$WORK/diff_output.txt
or: 'produced the wrong World.html' $WORK/diff_output.txt
pass: 'passed'
-end
-recipe [Map]
set: $I7 = inform7/Tangled/inform7
set: $INTERNAL = inform7/Internal
set: $WORKSPACE = intest/Workspace
set: $VM = G
extract: $WORK/Example.inform/Source/story.ni $VM
mkdir: $WORK/Transient
step: find $WORK/Transient -mindepth 1 -delete
mkdir: $PATH/_Maps_Actual
mkdir: $PATH/_Maps_Ideal
set: $I7OPTIONS = -format=ulx -noprogress -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -internal $INTERNAL
set: $I7CONSOLE = $WORK/Example.inform/Build/i7_output.txt
step: $I7 `$I7OPTIONS -project $WORK/Example.inform >$I7CONSOLE 2>&1
or: 'failed with Problem message(s)' $I7CONSOLE
set: $A = $PATH/_Maps_Actual/$CASE.html
set: $I = $PATH/_Maps_Ideal/$CASE.html
copy: $WORK/Example.inform/Index/World.html $A
exists: $I
or: 'translated successfully but no ideal map existed'
step: diff $A $I >$WORK/diff.txt
or: 'produced the wrong map' $WORK/diff.txt
pass: 'passed'
-end
-recipe [Inter]
set: $I7 = inform7/Tangled/inform7
set: $INTER = inter/Tangled/inter
set: $INTERNAL = inform7/Internal
set: $WORKSPACE = intest/Workspace
! First we decide whether to compile it for the Z-machine or Glulx.
set: $VM = Z
if: $CASE %c*-G
set: $VM = G
endif
if: $CASE %c*Metric%c*Units%c*
set: $VM = G
endif
! On the basis of which:
if: $VM G
set: $FORMAT = ulx
else
set: $FORMAT = z8
endif
mkdir: $PATH/_Inter_Binary
mkdir: $PATH/_Inter_Textual
mkdir: $PATH/_Inter_Actual
mkdir: $PATH/_Inter_Ideal
! Now we extract the source text from whatever file originated the test
! case: this is a non-trivial operation when the file is an Extension or
! an example, but is a simple copy operation otherwise.
extract: $WORK/Example.inform/Source/story.ni $VM
set: $I7OPTIONS = -format=$FORMAT -noprogress -fixtime -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -noindex -internal $INTERNAL
set: $INTERB = $PATH/_Inter_Binary/$CASE.interb
set: $INTERT = $PATH/_Inter_Textual/$CASE.intert
set: $INTERCHAIN = generate-inter:$INTERT,generate-inter-binary:$INTERB
set: $I7CONSOLE = $WORK/Example.inform/Build/i7_output.txt
step: $I7 `$I7OPTIONS -format=$FORMAT -project $WORK/Example.inform -inter $INTERCHAIN >$I7CONSOLE 2>&1
or: 'failed with Problem message(s)' $I7CONSOLE
set: $INTERA = $PATH/_Inter_Actual/$CASE.intert
set: $INTERI = $PATH/_Inter_Ideal/$CASE.intert
set: $INTERCONSOLE = $WORK/Example.inform/Build/inter_output.txt
step: $INTER $INTERB -textual $INTERA >$INTERCONSOLE 2>&1
or: 'failed to read inter' $INTERCONSOLE
show: $INTERCONSOLE
match text: $INTERA $INTERI
or: 'produced the wrong inter code'
show: $INTERA
pass: 'passed'
-end
-recipe [Release]
set: $I7 = inform7/Tangled/inform7
set: $INTERNAL = inform7/Internal
set: $WORKSPACE = intest/Workspace
set: $VM = G
if: $CASE %c*-Z
set: $VM = Z
endif
if: $VM G
set: $FORMAT = ulx
else
set: $FORMAT = z8
endif
extract: $WORK/Example.inform/Source/story.ni $VM
if: $CASE Audiovisual
copy: $WORKSPACE/Samples/Cover.png $WORK/Example.materials/Cover.png
copy: '$WORKSPACE/Samples/Small Cover.png' '$WORK/Example.materials/Small Cover.png'
mkdir: $WORK/Example.materials
mkdir: $WORK/Example.materials/Figures
copy: $WORKSPACE/Samples/Shuttle.jpg $WORK/Example.materials/Figures/Shuttle.jpg
copy: $WORKSPACE/Samples/Triangle.png $WORK/Example.materials/Figures/Triangle.png
mkdir: $WORK/Example.materials/Sounds
copy: $WORKSPACE/Samples/Bach.ogg $WORK/Example.materials/Sounds/Bach.ogg
copy: $WORKSPACE/Samples/Passacaglia.mid $WORK/Example.materials/Sounds/Passacaglia.mid
copy: $WORKSPACE/Samples/Powermac.aiff $WORK/Example.materials/Sounds/Powermac.aiff
endif
set: $I7OPTIONS = -fixtime -format=$FORMAT -noprogress -rng -sigils -clock -log nothing -external inform7/Tests -transient $WORK/Transient -noindex -internal $INTERNAL -release
mkdir: $WORK/Transient
step: find $WORK/Transient -mindepth 1 -delete
set: $I7CONSOLE = $WORK/Example.inform/Build/i7_output.txt
step: $I7 `$I7OPTIONS -project $WORK/Example.inform >$I7CONSOLE 2>&1
or: 'failed with Problem message(s)' $I7CONSOLE
match text: $WORK/Example.inform/Release.blurb $PATH/_Blurb_Ideal/$CASE.blurb
or: 'produced the wrong release blurb'
show: $WORK/Example.inform/Release.blurb
match text: $WORK/Example.inform/Metadata.iFiction $PATH/_Metadata_Ideal/$CASE.iFiction
or: 'produced the wrong iFiction metadata'
show: $WORK/Example.inform/Metadata.iFiction
pass: 'passed'
-end