runAllPraatTests.praat 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Praat script runAllPraatTests.praat
  2. # Paul Boersma 2018-08-30
  3. #
  4. # This script runs all Praat scripts in its subdirectories.
  5. Text writing preferences: "try ASCII, then UTF-16"
  6. if macintosh
  7. Text reading preferences: "try UTF-8, then MacRoman"
  8. elif windows
  9. Text reading preferences: "try UTF-8, then Windows Latin-1"
  10. elif unix
  11. Text reading preferences: "try UTF-8, then ISO Latin-1"
  12. else
  13. exitScript: "Unknown operating system."
  14. endif
  15. writeInfoLine: "Running all tests..."
  16. memoryReport$ = Report memory use
  17. strings_before = extractNumber (memoryReport$, "Strings:")
  18. arrays_before = extractNumber (memoryReport$, "Arrays:")
  19. things_before = extractNumber (memoryReport$, "Things:")
  20. other_before = extractNumber (memoryReport$, "Other:")
  21. directories = Create Strings as directory list: "directories", "."
  22. numberOfDirectories = Get number of strings
  23. for directory to numberOfDirectories
  24. selectObject: directories
  25. directory$ = Get string: directory
  26. if directory$ <> "manually" and directory$ <> "speed"
  27. files = Create Strings as file list: "files", directory$ + "/*.praat"
  28. numberOfFiles = Get number of strings
  29. for file to numberOfFiles
  30. selectObject: files
  31. file$ = Get string: file
  32. path$ = directory$ + "/" + file$
  33. appendInfoLine: "### executing ", path$, ":"
  34. runScript: path$
  35. endfor
  36. removeObject: files
  37. endif
  38. endfor
  39. removeObject: directories
  40. directories1 = Create Strings as directory list: "directories1", "."
  41. numberOfDirectories1 = Get number of strings
  42. for directory1 to numberOfDirectories1
  43. selectObject: directories1
  44. directory1$ = Get string: directory1
  45. if directory1$ <> "manually" and directory$ <> "speed"
  46. directories2 = Create Strings as directory list: "directories2", directory1$ + "/*"
  47. numberOfDirectories2 = Get number of strings
  48. for directory2 to numberOfDirectories2
  49. selectObject: directories2
  50. directory2$ = Get string: directory2
  51. files = Create Strings as file list: "files", directory1$ + "/" + directory2$ + "/*.praat"
  52. numberOfFiles = Get number of strings
  53. for file to numberOfFiles
  54. selectObject: files
  55. file$ = Get string: file
  56. path$ = directory1$ + "/" + directory2$ + "/" + file$
  57. appendInfoLine: "### executing ", path$, ":"
  58. runScript: path$
  59. endfor
  60. removeObject: files
  61. endfor
  62. removeObject: directories2
  63. endif
  64. endfor
  65. removeObject: directories1
  66. writeInfoLine: " ALL PRAAT TESTS WENT OK"
  67. appendInfoLine: ""
  68. line$ [5] = " ##### ##### ##### #####"
  69. line$ [8] = " ##### ##### #######"
  70. line$ [1] = " ###### ##### #####"
  71. line$ [2] = " ############## ##### #####"
  72. line$ [4] = " ##### ##### ##### #####"
  73. line$ [7] = " ##### ##### #########"
  74. line$ [9] = " ##### ##### #####"
  75. line$ [3] = " ##### ##### ##### #####"
  76. line$ [6] = " ##### ##### ##### #####"
  77. for line from 1 to 9
  78. appendInfoLine: line$ [line]
  79. endfor
  80. for line from 1 to 8
  81. appendInfoLine: line$ [9 - line]
  82. endfor
  83. memoryReport$ = Report memory use
  84. strings_after = extractNumber (memoryReport$, "Strings:")
  85. arrays_after = extractNumber (memoryReport$, "Arrays:")
  86. things_after = extractNumber (memoryReport$, "Things:")
  87. other_after = extractNumber (memoryReport$, "Other:")
  88. appendInfoLine ()
  89. appendInfoLine: "Leaking:"
  90. appendInfoLine: " Strings: ", strings_after - strings_before
  91. appendInfoLine: " Arrays: ", arrays_after - arrays_before
  92. appendInfoLine: " Things: ", things_after - things_before
  93. appendInfoLine: " Other: ", other_after - other_before