| 1 |
# Praat script test/runAllTests_batch.praat |
| 2 |
# Paul Boersma 2020-04-18 |
| 3 |
# 2024-12-01 writing settings to UTF-8 for Praat 7 |
| 4 |
# 2025-08-16 make more reproducible |
| 5 |
# |
| 6 |
# This script runs all Praat scripts in its subdirectories. |
| 7 |
# This script is to be called from the command line: |
| 8 |
# praat --run runAllTests_batch.praat |
| 9 |
# |
| 10 |
# Scripts containing `_GUI_` in their names are ignored. |
| 11 |
# |
| 12 |
|
| 13 |
# |
| 14 |
# Some tests require standard settings for the text input encoding: |
| 15 |
# files in UTF-8 format should always be readable. |
| 16 |
# |
| 17 |
Text writing preferences: "UTF-8" |
| 18 |
if macintosh |
| 19 |
Text reading preferences: "try UTF-8, then MacRoman" |
| 20 |
elif windows |
| 21 |
Text reading preferences: "try UTF-8, then Windows Latin-1" |
| 22 |
elif unix |
| 23 |
Text reading preferences: "try UTF-8, then ISO Latin-1" |
| 24 |
else |
| 25 |
exitScript: "Unknown operating system." |
| 26 |
endif |
| 27 |
|
| 28 |
writeInfoLine: "Running all tests..." |
| 29 |
|
| 30 |
files = Create Strings as file list: "files", "*.praat" |
| 31 |
numberOfFiles = Get number of strings |
| 32 |
for file to numberOfFiles |
| 33 |
selectObject: files |
| 34 |
file$ = Get string: file |
| 35 |
if not index (file$, "runAllTests") and not index (file$, "_GUI_") |
| 36 |
appendInfoLine: "### executing ", file$, ":" |
| 37 |
# |
| 38 |
# The following two lines aim at making the test reproducible. |
| 39 |
# That is, the test should give the same result on different |
| 40 |
# computers and different platforms and at different times. |
| 41 |
# The random seed is allowed to change with the Praat release; |
| 42 |
# just run all the tests if you change the random seed, |
| 43 |
# even if there was no change in the Praat source code. |
| 44 |
# This is because the success of some precision tests |
| 45 |
# has been reported (by maintainers) to depend on the random state. |
| 46 |
# Also make sure that the random seed is the same |
| 47 |
# for the other two "runAlltests" scripts. |
| 48 |
# |
| 49 |
random_initializeWithSeedUnsafelyButPredictably (5489) |
| 50 |
Debug multi-threading: "yes", 8, 0, "no" |
| 51 |
runScript: file$ |
| 52 |
endif |
| 53 |
endfor |
| 54 |
removeObject: files |
| 55 |
endif |
| 56 |
random_initializeSafelyAndUnpredictably() |
| 57 |
Debug multi-threading: "yes", 0, 0, "no" |
| 58 |
|
| 59 |
writeInfoLine: " ALL PRAAT TESTS WENT OK" |
| 60 |
appendInfoLine: "" |
| 61 |
line$ [5] = " ##### ##### ##### #####" |
| 62 |
line$ [8] = " ##### ##### #######" |
| 63 |
line$ [1] = " ###### ##### #####" |
| 64 |
line$ [2] = " ############## ##### #####" |
| 65 |
line$ [4] = " ##### ##### ##### #####" |
| 66 |
line$ [7] = " ##### ##### #########" |
| 67 |
line$ [9] = " ##### ##### #####" |
| 68 |
line$ [3] = " ##### ##### ##### #####" |
| 69 |
line$ [6] = " ##### ##### ##### #####" |
| 70 |
for line from 1 to 9 |
| 71 |
appendInfoLine: line$ [line] |
| 72 |
endfor |
| 73 |
for line from 1 to 8 |
| 74 |
appendInfoLine: line$ [9 - line] |
| 75 |
endfor |