Debian Codegraph @

test/runAllTests_batch.praat

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