# helper for running TTXN test-suite on "mupdf" package
# without "installing" them

# Note that TTXN package should be placed under a standard tcl-library directory
# OR within this "test" directory

set thisDir [file dirname [file normalize [info script]]]
 # path for TTXN package
 # don't append it, prepend it !
set auto_path [linsert $auto_path 0 $thisDir]


 # default test-run on ...XBUILD/tclMuPDF
set targetDir [file join [file dirname $thisDir] XBUILD/tclMuPDF]

 #reset argc, argv, or they will interfere for tcltest
set argc 0
set argv {}

puts stderr "================================================================="
puts stderr "Testing MuPDF at $targetDir ..."
puts stderr "================================================================="


 # path for mupdf package (targetDir)
 # don't append it, prepend it !
set auto_path [linsert $auto_path 0 $targetDir]

foreach testFile [lsort [glob $thisDir/tclMuPdf/*.test]] {
	set interp [interp create] 
    $interp eval [list   set auto_path $auto_path]
    $interp eval [list   set tcl_interactive 1] ;# or tcltest will exit !!
	$interp eval [list set argv $argv]
    $interp eval [list   source $testFile]
    interp delete $interp
}
