/3rd_party/llvm/utils/lit/TODO

https://code.google.com/p/softart/ · #! · 166 lines · 123 code · 43 blank · 0 comment · 0 complexity · 3336e00e31f323a8f4ad8588a601e23a MD5 · raw file

  1. ================
  2. lit TODO Items
  3. ================
  4. Infrastructure
  5. ==============
  6. 1. Change to always load suites, then resolve command line arguments?
  7. Currently we expect each input argument to be a path on disk; we do a
  8. recursive search to find the test suite for each item, but then we only do a
  9. local search based at the input path to find tests. Additionally, for any path
  10. that matches a file on disk we explicitly construct a test instance (bypassing
  11. the formats on discovery implementation).
  12. This has a couple problems:
  13. * The test format doesn't have control over the test instances that result
  14. from file paths.
  15. * It isn't possible to specify virtual tests as inputs. For example, it is not
  16. possible to specify an individual subtest to run with the googletest format.
  17. * The test format doesn't have full control over the discovery of tests in
  18. subdirectories.
  19. Instead, we should move to a model whereby first all of the input specifiers
  20. are resolved to test suites, and then the resolution of the input specifier is
  21. delegated to each test suite. This could take a couple forms:
  22. * We could resolve to test suites, then fully load each test suite, then have
  23. a fixed process to map input specifiers to tests in the test suite
  24. (presumably based on path-in-suite derivations). This has the benefit of
  25. being consistent across all test formats, but the downside of requiring
  26. loading the entire test suite.
  27. * We could delegate all of the resolution of specifiers to the test
  28. suite. This would allow formats that anticipate large test suites to manage
  29. their own resolution for better performance. We could provide a default
  30. resolution strategy that was similar to what we do now (start at subpaths
  31. for directories, but allow the test format control over what happens for
  32. individual tests).
  33. 2. Consider move to identifying all tests by path-to-test-suite and then path to
  34. subtest, and don't use test suite names.
  35. Currently the test suite name is presented as part of test names, but it has
  36. no other useful function, and it is something that has to be skipped over to
  37. cut-and-paste a name to subsequently use to rerun a test. If we just
  38. represented each test suite by the path to its suite, then it would allow more
  39. easy cut-and-paste of the test output lines. This has the downside that the
  40. lines might get rather long.
  41. 3. Allow 'lit' driver to cooperate with test formats and suites to add options
  42. (or at least sanitize accepted params).
  43. We have started to use the --params method more and more extensively, and it is
  44. cumbersome and error prone. Additionally, there are currently various options
  45. ``lit`` honors that should more correctly be specified as belonging to the
  46. ShTest test format.
  47. It would be really nice if we could allow test formats and test suites to add
  48. their own options to be parsed. The difficulty here, of course, is that we
  49. don't know what test formats or test suites are in use until we have parsed the
  50. input specifiers. For test formats we could ostensibly require all the possible
  51. formats to be registered in order to have options, but for test suites we would
  52. certainly have to load the suite before we can query it for what options it
  53. understands.
  54. That leaves us with the following options:
  55. * Currently we could almost get away with parsing the input specifiers without
  56. having done option parsing first (the exception is ``--config-prefix``) but
  57. that isn't a very extensible design.
  58. * We could make a distinction in the command line syntax for test format and
  59. test suite options. For example, we could require something like::
  60. lit -j 1 -sv input-specifier -- --some-format-option
  61. which would be relatively easy to implement with optparser (I think).
  62. * We could allow fully interspersed arguments by first extracting the options
  63. lit knows about and parsing them, then dispatching the remainder to the
  64. formats. This seems the most convenient for users, who are unlikely to care
  65. about (or even be aware of) the distinction between the generic lit
  66. infrastructure and format or suite specific options.
  67. 4. Eliminate duplicate execution models for ShTest tests.
  68. Currently, the ShTest format uses tests written with shell-script like syntax,
  69. and executes them in one of two ways. The first way is by converting them into
  70. a bash script and literally executing externally them using bash. The second
  71. way is through the use of an internal shell parser and shell execution code
  72. (built on the subprocess module). The external execution mode is used on most
  73. Unix systems that have bash, the internal execution mode is used on Windows.
  74. Having two ways to do the same thing is error prone and leads to unnecessary
  75. complexity in the testing environment. Additionally, because the mode that
  76. converts scripts to bash doesn't try and validate the syntax, it is possible
  77. to write tests that use bash shell features unsupported by the internal
  78. shell. Such tests won't work on Windows but this may not be obvious to the
  79. developer writing the test.
  80. Another limitation is that when executing the scripts externally, the ShTest
  81. format has no idea which commands fail, or what output comes from which
  82. commands, so this limits how convenient the output of ShTest failures can be
  83. and limits other features (for example, knowing what temporary files were
  84. written).
  85. We should eliminate having two ways of executing the same tests to reduce
  86. platform differences and make it easier to develop new features in the ShTest
  87. module. This is currently blocked on:
  88. * The external execution mode is faster in some situations, because it avoids
  89. being bottlenecked on the GIL. This can hopefully be obviated simply by
  90. using --use-processes.
  91. * Some tests in LLVM/Clang are explicitly disabled with the internal shell
  92. (because they use features specific to bash). We would need to rewrite these
  93. tests, or add additional features to the internal shell handling to allow
  94. them to pass.
  95. 5. Consider changing core to support setup vs. execute distinction.
  96. Many of the existing test formats are cleanly divided into two phases, once
  97. parses the test format and extracts XFAIL and REQUIRES information, etc., and
  98. the other code actually executes the test.
  99. We could make this distinction part of the core infrastructure and that would
  100. enable a couple things:
  101. * The REQUIREs handling could be lifted to the core, which is nice.
  102. * This would provide a clear place to insert subtest support, because the
  103. setup phase could be responsible for providing subtests back to the
  104. core. That would provide part of the infrastructure to parallelize them, for
  105. example, and would probably interact well with other possible features like
  106. parameterized tests.
  107. * This affords a clean implementation of --no-execute.
  108. * One possible downside could be for test formats that cannot determine their
  109. subtests without having executed the test. Supporting such formats would
  110. either force the test to actually be executed in the setup stage (which
  111. might be ok, as long as the API was explicitly phrased to support that), or
  112. would mean we are forced into supporting subtests as return values from the
  113. execute phase.
  114. Any format can just keep all of its code in execute, presumably, so the only
  115. cost of implementing this is its impact on the API and futures changes.
  116. Miscellaneous
  117. =============
  118. * Move temp directory name into local test config.
  119. * Add --show-unsupported, don't show by default?
  120. * Support valgrind in all configs, and LLVM style valgrind.
  121. * Support a timeout / ulimit.
  122. * Create an explicit test suite object (instead of using the top-level
  123. TestingConfig object).