| 1 |
# Praat script runAllTests.praat |
| 2 |
# Paul Boersma 2020-12-28 |
| 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 |
|
| 8 |
askForTrust() |
| 9 |
|
| 10 |
Text writing settings: "UTF-8" |
| 11 |
if macintosh |
| 12 |
Text reading settings: "try UTF-8, then MacRoman" |
| 13 |
elif windows |
| 14 |
Text reading settings: "try UTF-8, then Windows Latin-1" |
| 15 |
elif unix |
| 16 |
Text reading settings: "try UTF-8, then ISO Latin-1" |
| 17 |
else |
| 18 |
exitScript: "Unknown operating system." |
| 19 |
endif |
| 20 |
|
| 21 |
writeInfoLine: "Running all tests..." |
| 22 |
|
| 23 |
memoryReport$ = Report memory use |
| 24 |
strings_before = extractNumber (memoryReport$, "Strings:") |
| 25 |
arrays_before = extractNumber (memoryReport$, "Arrays:") |
| 26 |
things_before = extractNumber (memoryReport$, "Things:") |
| 27 |
other_before = extractNumber (memoryReport$, "Other:") |
| 28 |
|
| 29 |
topPath$ = "." |
| 30 |
topFolderNames$# = folderNames$# (topPath$) |
| 31 |
for topFolder to size (topFolderNames$#) |
| 32 |
topFolderName$ = topFolderNames$# [topFolder] |
| 33 |
if topFolderName$ <> "manually" and topFolderName$ <> "speed" |
| 34 |
topFolderPath$ = topPath$ + "/" + topFolderName$ |
| 35 |
@runFilesInFolder: topFolderPath$ |
| 36 |
subfolderNames$# = folderNames$# (topFolderPath$ + "/*") |
| 37 |
for subfolder to size (subfolderNames$#) |
| 38 |
subFolderPath$ = topFolderPath$ + "/" + subfolderNames$# [subfolder] |
| 39 |
@runFilesInFolder: subFolderPath$ |
| 40 |
endfor |
| 41 |
endif |
| 42 |
endfor |
| 43 |
|
| 44 |
procedure runFilesInFolder: .folderPath$ |
| 45 |
.fileNames$# = fileNames$# (.folderPath$ + "/*.praat") |
| 46 |
for .file to size (.fileNames$#) |
| 47 |
.filePath$ = .folderPath$ + "/" + .fileNames$# [.file] |
| 48 |
appendInfoLine: "### executing ", .filePath$, ":" |
| 49 |
# |
| 50 |
# The following two lines aim at making the test reproducible. |
| 51 |
# That is, the test should give the same result on different |
| 52 |
# computers and different platforms and at different times. |
| 53 |
# The random seed is allowed to change with the Praat release; |
| 54 |
# just run all the tests if you change the random seed, |
| 55 |
# even if there was no change in the Praat source code. |
| 56 |
# This is because the success of some precision tests |
| 57 |
# has been reported (by maintainers) to depend on the random state. |
| 58 |
# Also make sure that the random seed is the same |
| 59 |
# for the other two "runAlltests" scripts. |
| 60 |
# |
| 61 |
random_initializeWithSeedUnsafelyButPredictably (5489) |
| 62 |
Debug multi-threading: "yes", 8, 0, "no" ; eight threads for everybody |
| 63 |
runScript: .filePath$ |
| 64 |
endfor |
| 65 |
random_initializeSafelyAndUnpredictably() |
| 66 |
Debug multi-threading: "yes", 0, 0, "no" |
| 67 |
endproc |
| 68 |
|
| 69 |
writeInfoLine: " ALL PRAAT TESTS WENT OK" |
| 70 |
appendInfoLine: "" |
| 71 |
line$ [5] = " ##### ##### ##### #####" |
| 72 |
line$ [8] = " ##### ##### #######" |
| 73 |
line$ [1] = " ###### ##### #####" |
| 74 |
line$ [2] = " ############## ##### #####" |
| 75 |
line$ [4] = " ##### ##### ##### #####" |
| 76 |
line$ [7] = " ##### ##### #########" |
| 77 |
line$ [9] = " ##### ##### #####" |
| 78 |
line$ [3] = " ##### ##### ##### #####" |
| 79 |
line$ [6] = " ##### ##### ##### #####" |
| 80 |
for line from 1 to 9 |
| 81 |
appendInfoLine: line$ [line] |
| 82 |
endfor |
| 83 |
for line from 1 to 8 |
| 84 |
appendInfoLine: line$ [9 - line] |
| 85 |
endfor |
| 86 |
|
| 87 |
memoryReport$ = Report memory use |
| 88 |
strings_after = extractNumber (memoryReport$, "Strings:") |
| 89 |
arrays_after = extractNumber (memoryReport$, "Arrays:") |
| 90 |
things_after = extractNumber (memoryReport$, "Things:") |
| 91 |
other_after = extractNumber (memoryReport$, "Other:") |
| 92 |
|
| 93 |
appendInfoLine () |
| 94 |
appendInfoLine: "Leaking:" |
| 95 |
appendInfoLine: " Strings: ", strings_after - strings_before |
| 96 |
appendInfoLine: " Arrays: ", arrays_after - arrays_before |
| 97 |
appendInfoLine: " Things: ", things_after - things_before |
| 98 |
appendInfoLine: " Other: ", other_after - other_before |
| 99 |
|