Commit Graph

339 Commits

Author SHA1 Message Date
Daniel Dunbar b8a82c295d [lit] Add --version option.
llvm-svn: 203496
2014-03-10 21:57:48 +00:00
Alp Toker 749971901a lit: Provide source locations in cfg files with older Python versions
This commit prospectively brings the benefits of r198766 to older supported
Python versions (2.5+).

Tested with Python 2.6, 2.7, 3.1 and 3.3 (!)

llvm-svn: 199009
2014-01-11 14:34:18 +00:00
Alp Toker f0a245944e lit: execfile() isn't present in Python 3.3
On the other hand, exec(compile()) doesn't work in older Python versions in the
2.x series.

This commit introduces exec(compile()) with a fallback to plain exec(). That'll
hopefully hit the sweet spot in terms of version support.

Followup to r198766 which added enhanced source locations for lit cfg parsing.

llvm-svn: 199006
2014-01-11 13:27:28 +00:00
Alp Toker 9e628916f6 lit: Provide file location in cfg error messages
Python doesn't do a good job at diagnosing string exec() so use execfile()
where available.

This should be a timesaver when trying to get to the bottom of build bot
failures.

Before:

    File "llvm/utils/lit/lit/TestingConfig.py", line 93, in load_from_path
      exec("exec data in cfg_globals")
    File "<string>", line 1, in <module>
    File "<string>", line 194, in <module>
  NameError: name 'typo' is not defined

After:

    File "llvm/utils/lit/lit/TestingConfig.py", line 95, in load_from_path
    execfile(path, cfg_globals)
    File "clang/test/lit.cfg", line 194, in <module>
      typo
      ^~~~
  NameError: name 'typo' is not defined

llvm-svn: 198766
2014-01-08 14:20:59 +00:00
Alp Toker e395023eab Python compatibility fix for r198150
Remove the stat call error reporting for now.

It wasn't essential so silent fallback should be fine here.

llvm-svn: 198155
2013-12-29 06:51:10 +00:00
Alp Toker 0324ee0a33 Prospective Python 3 fix for r198150
llvm-svn: 198152
2013-12-29 05:51:07 +00:00
Alp Toker fdef0e0d94 lit: Incremental test scheduling
Add option -i to prioritize test runs by source file modification time and
previous failure state.

This optimal scheduling reduces typical test-and-fix iteration times to a
matter of seconds by rapidly answering the questions:

  1) Did my recent change fix tests that were previously failing?
  2) Do the tests I just wrote / modified still work?

The current implementation requires write permissions to the source tree
because it uses mtimes to track failures.

llvm-svn: 198150
2013-12-29 05:09:05 +00:00
NAKAMURA Takumi b7bf04c02e Tweak lit/TestingConfig.py Py3-compatible. has_key is dead.
llvm-svn: 197462
2013-12-17 04:14:50 +00:00
Alp Toker d0cdc67caa lit: multiprocessing platform fix attempt
The error raised by Python varies by platform(!), so let's just catch any
exception and fall back.

Thanks to Sylvestre Ledru for noticing this on a Debian / Python 2.7 system
running code coverage.

llvm-svn: 193516
2013-10-28 10:26:13 +00:00
Alp Toker 31bd72fb22 Clarify the comment about BSD versions in r193465
llvm-svn: 193508
2013-10-27 20:49:19 +00:00
Joerg Sonnenberger 853b460e4f self.path may be empty or otherwise miss the normal system directories,
so try PATH next. Assume it is sane enough to cover the usual system
bash locations too, but the old list is not good enough for NetBSD.

llvm-svn: 193471
2013-10-26 13:25:45 +00:00
Alp Toker 54d210b205 lit: Issue a note when multiprocessing fails to load
If multiprocessing was requested, detected as available and subsequently failed
to initialize it's worth letting the user know about it before falling back to
threads.

This condition can arise in certain OpenBSD / FreeBSD Python versions.

llvm-svn: 193465
2013-10-26 09:29:58 +00:00
Alp Toker 6c5dbd7a0a Fix a referenced before assignment in r193463
Some versions of Python on the builders seem strict about this.

llvm-svn: 193464
2013-10-26 08:46:05 +00:00
Alp Toker 9ade45482a lit: handle late multiprocessing errors gracefully
This should be a better fix for lit multiprocessing failures, replacing the
OpenBSD and FreeBSD workarounds in r193413 and r193457.

Reference: http://bugs.python.org/issue3770
llvm-svn: 193463
2013-10-26 08:22:44 +00:00
Alp Toker 5853534b03 Attempt to fix the FreeBSD build, disable multiprocessing
Speculative quick fix based on clang-X86_64-freebsd output:

  File "/usr/local/lib/python2.6/multiprocessing/synchronize.py", line 33, in <module>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

llvm-svn: 193457
2013-10-26 02:43:08 +00:00
Rafael Espindola 5e82540d11 Try to fix the openbsd bot.
llvm-svn: 193413
2013-10-25 15:07:59 +00:00
Rafael Espindola f059064d95 Actually switch the default to use multiprocessing
llvm-svn: 193282
2013-10-23 22:32:53 +00:00
Daniel Dunbar cdca362e65 [lit] Stop hacking the GIL check interval.
- This was never a big win, and is irrelevant now that we commonly use
   multiprocessing based parallelism.

llvm-svn: 193280
2013-10-23 22:19:32 +00:00
Daniel Dunbar 1fc709cd3e [lit] Use multiprocessing based parallelism by default, on Unix.
llvm-svn: 193279
2013-10-23 22:19:07 +00:00
NAKAMURA Takumi 1c19a0f4a8 Lit: LIT_PRESERVES_TMP should be aware of TMPDIR, too.
TMPDIR is preferred in Unix.

llvm-svn: 192891
2013-10-17 13:11:13 +00:00
NAKAMURA Takumi 199f138a07 Lit: Introduce an environment variable, $LIT_PRESERVES_TMP, to preserve TMP (and TEMP).
This is intended to check how many temporary files would be generated in automated builders.

llvm-svn: 192887
2013-10-17 12:10:12 +00:00
Daniel Dunbar cd625f4e54 [lit] Add an --output option, for writing results in a machine readable form.
llvm-svn: 190738
2013-09-14 01:19:17 +00:00
Daniel Dunbar 9aeba4963a [lit] Add support for attach arbitrary metrics to test results.
- This is a work-in-progress and all details are subject to change, but I am
   trying to build up support for allowing lit to be used as a driver for
   performance tests (or other tests which might want to record information
   beyond simple PASS/FAIL).

llvm-svn: 190535
2013-09-11 17:45:11 +00:00
Daniel Dunbar dac381a323 [lit] Allow config files to pass arbitrary values to child configs.
- This aligns with how existing test suites end up wanting to use the local
   config files, conceptually it makes sense to consider them to be inherited.

llvm-svn: 189885
2013-09-03 23:32:55 +00:00
Daniel Dunbar 9d8271b351 [lit] [tests] Add missing test input file.
llvm-svn: 189561
2013-08-29 03:02:34 +00:00
Daniel Dunbar b8da61fd1b [lit] Fix internal shell's argv[0] handling.
- At least on OS X, it is important for correct behavior of /bin/[ that argv[0]
   is passed as written, and not as the full executable path.

llvm-svn: 189559
2013-08-29 02:52:10 +00:00
Daniel Dunbar 9a83a76b1b [lit] Add support for multiprocessing, under --use-processes for now.
llvm-svn: 189556
2013-08-29 00:54:23 +00:00
Daniel Dunbar b3954fa889 [lit] Implement --max-time support by using provider cancel method.
llvm-svn: 189555
2013-08-29 00:54:19 +00:00
Daniel Dunbar 57ab2df070 [lit] Refactor test execution logic into lit.run.Run.
llvm-svn: 189554
2013-08-29 00:54:15 +00:00
Daniel Dunbar eecb1c1d25 [lit] Put display lock inside the ThreadResultsConsumer.
llvm-svn: 189553
2013-08-29 00:54:09 +00:00
Daniel Dunbar 516dc8b9be [lit] Factor out a results consumer interface for test execution.
- Also, change TestProvider interface to operate on test indices.

llvm-svn: 189552
2013-08-29 00:54:02 +00:00
Daniel Dunbar 562b83a64c [lit] Move top-level execute code into Run object.
llvm-svn: 189551
2013-08-29 00:48:55 +00:00
Daniel Dunbar a1b1ca7a38 [lit] Factor out Run class to capture configuration + discovered tests.
llvm-svn: 189550
2013-08-29 00:48:45 +00:00
Daniel Dunbar d73eaabc8f [lit] Change lit.Test.ResultCode to be unique across pickling.
llvm-svn: 189549
2013-08-29 00:48:39 +00:00
Daniel Dunbar 89d0321774 [lit] Add a TODO.
llvm-svn: 189546
2013-08-29 00:41:15 +00:00
Daniel Dunbar bef5955e22 [lit] Update shtest format to return lit.Test.Result objects.
llvm-svn: 189545
2013-08-29 00:41:09 +00:00
Daniel Dunbar 71c06c0cc2 [lit] Update LitTestCase to support lit.Test.Result.
llvm-svn: 189544
2013-08-29 00:40:59 +00:00
Daniel Dunbar 39be0b4b4c [lit] Fix a couple lingering Py3 compat issues in ProgressBar.
llvm-svn: 188951
2013-08-21 22:26:47 +00:00
Daniel Dunbar 898d0d34a9 [lit] Lift XFAIL handling to core infrastructure.
llvm-svn: 188949
2013-08-21 22:26:42 +00:00
Daniel Dunbar 02ae385cac [lit] Allow formats to return lit.Test.Result instances directly.
llvm-svn: 188948
2013-08-21 22:26:40 +00:00
Daniel Dunbar 61821065a2 [lit] Factor out a separate Test.Result() object.
llvm-svn: 188947
2013-08-21 22:26:37 +00:00
Daniel Dunbar cf5599cc11 [lit] Simplify --time-tests code.
llvm-svn: 188946
2013-08-21 22:26:34 +00:00
Daniel Dunbar dd003d3332 [lit] Extract TestFormat base class, for future use.
llvm-svn: 188945
2013-08-21 22:26:26 +00:00
Daniel Dunbar 3f0ec8045c [lit] Rewrite TODO list, and elaborate on some things.
- If anyone is interested in lit's feature set, I'd appreciate any comments on
   the elaborated items.

llvm-svn: 188590
2013-08-16 23:30:23 +00:00
Daniel Dunbar 730dee40ca [lit] Remove some done TODOs.
llvm-svn: 188502
2013-08-15 22:52:20 +00:00
Daniel Dunbar 301d387929 [lit] Add test coverage of gtest format.
llvm-svn: 188417
2013-08-14 22:21:11 +00:00
Daniel Dunbar 54d613b97f [lit] Ensure test output is converted to strings where possible.
- This cleans up the text output of failing tests when run under PY3.

llvm-svn: 188416
2013-08-14 22:21:01 +00:00
Daniel Dunbar e469b981f3 [lit] Support parsing scripts with inconsistent or invalid encodings.
- For whatever reason, we have a lot of test files with bogus unicode
   characters. This patch allows those scripts to still be parsed on Python3 by
   changing the parsing logic to work on binary files, and only require the
   actual script commands to be convertible to ascii.

 - This patch has been tweaked to now ensure that the command strings are not of
   unicode type on Python 2.6-7.

llvm-svn: 188398
2013-08-14 18:22:41 +00:00
Daniel Dunbar 16b934d624 Revert r188376, "[lit] Support parsing scripts with inconsistent or invalid encodings.", this doesn't work yet for bots using the internal shell.
llvm-svn: 188379
2013-08-14 15:55:25 +00:00
Daniel Dunbar cf0702601a [lit] Support parsing scripts with inconsistent or invalid encodings.
- For whatever reason, we have a lot of test files with bogus unicode
   characters. This patch allows those scripts to still be parsed on Python3 by
   changing the parsing logic to work on binary files, and only require the
   actual script commands to be convertible to ascii.

llvm-svn: 188376
2013-08-14 15:24:58 +00:00
Daniel Dunbar b7b4c11c6a [lit] Fix a relative import issue I missed earlier.
llvm-svn: 188360
2013-08-14 05:07:16 +00:00
Daniel Dunbar abb0695237 [lit] Avoid StringIO.
- We barely used it, and it is very hard to use in a 2.5-3 compatible
   way because of changing expectations for its input types.

llvm-svn: 188359
2013-08-14 05:07:13 +00:00
Daniel Dunbar 6d0ed4cd16 [lit] Fix tests to execute lit with same python as invoked with.
llvm-svn: 188358
2013-08-14 05:07:09 +00:00
Daniel Dunbar 1ba25a1e56 [lit] Factor ShTest format script command parsing from other processing.
llvm-svn: 188357
2013-08-14 05:07:04 +00:00
Daniel Dunbar 0a4a23ebac [lit] Move executeCommand() into lit.util.
llvm-svn: 188356
2013-08-14 05:07:01 +00:00
Daniel Dunbar 962fdef115 [lit] Move formats into their own subpackage.
llvm-svn: 188355
2013-08-14 05:06:55 +00:00
NAKAMURA Takumi 8a3357d252 Lit: Introduce "%/[STpst] into parseIntegratedTestScript(), to normalize substitutions.
llvm-svn: 188348
2013-08-14 02:26:31 +00:00
Daniel Dunbar 1be0c73a94 [lit] Support use of setup.py from other directories.
llvm-svn: 188309
2013-08-13 19:08:48 +00:00
Daniel Dunbar 6dac00702c [lit] Remove old ExamplesTests directory.
- The actual tests have better coverage than those, and they weren't useful
   anymore.

llvm-svn: 188110
2013-08-09 21:39:36 +00:00
Daniel Dunbar ab320a673f [lit] Move ManyTests examples to lit/examples/many-tests.
llvm-svn: 188109
2013-08-09 21:39:28 +00:00
Daniel Dunbar c38c6f068b [lit] Drop deprecated aliases for lit and old module names.
llvm-svn: 188108
2013-08-09 21:39:24 +00:00
Daniel Dunbar 72868c74f3 [lit] Update lit's own tests to use lit_config and lit package, as appropriate.
llvm-svn: 188107
2013-08-09 21:39:17 +00:00
Daniel Dunbar 2fc495370a [lit] Fix typo.
- Noticed by edward-san (IRC).

llvm-svn: 188096
2013-08-09 19:39:42 +00:00
Daniel Dunbar 6465325e42 [lit] Rename lit.{TestFormats,Util} to their aliased names {formats,util}.
- With compatibility hack in lit.__init__, so this hopefully shouldn't break
   anything.

llvm-svn: 188040
2013-08-09 00:37:15 +00:00
Daniel Dunbar f511d30d8b [lit] Inject the lit specific config object as 'lit_config' when loading config files.
- Injecting it as 'lit' is gross, since that name should be used to refer to
   the actual package. For now both are available so it is possibly to cleanup
   test config files incrementally.

llvm-svn: 188039
2013-08-09 00:37:05 +00:00
Daniel Dunbar e97b673cf5 [lit] Split TestingConfig.frompath() into separate ctor and load methods.
llvm-svn: 188038
2013-08-09 00:36:58 +00:00
Daniel Dunbar 6928bb62ba [lit] Eliminate mustExist parameter from TestingConfig.frompath().
llvm-svn: 188034
2013-08-09 00:09:02 +00:00
Daniel Dunbar b963b0b51a [lit] Only create config copies when a local config file is present.
llvm-svn: 188033
2013-08-09 00:08:56 +00:00
Daniel Dunbar 5d8ab529c2 [lit] Eliminate parent argument from TestingConfig.frompath(), which is effectively unused.
llvm-svn: 188032
2013-08-09 00:08:46 +00:00
Daniel Dunbar c4477dfd92 [lit] Change --show-{tests,suites} to exit after printing.
- This is a more sensible behavior than printing and also running tests.

llvm-svn: 188009
2013-08-08 20:59:25 +00:00
Daniel Dunbar b647d5d21d [lit] Remove --repeat option, which wasn't that useful.
llvm-svn: 188008
2013-08-08 20:59:20 +00:00
Daniel Dunbar e7b9e5fcd0 [lit] Eliminate some nested imports.
llvm-svn: 188007
2013-08-08 20:59:16 +00:00
Daniel Dunbar 2d100cda0c [lit] Remove on_clone member, which is no longer used.
llvm-svn: 188006
2013-08-08 20:59:13 +00:00
Daniel Dunbar e80b42a838 [lit] Remove unnecessary list copy.
llvm-svn: 187934
2013-08-07 23:10:20 +00:00
Daniel Dunbar 403eeea0cf [lit] Always list individual UNRESOLVED tests.
llvm-svn: 187933
2013-08-07 23:10:05 +00:00
Daniel Dunbar 9ee3bb89c9 [lit] Explicitly convert dict items() result to a list.
llvm-svn: 187932
2013-08-07 23:10:01 +00:00
Daniel Dunbar 6468a5ccab [lit] Make string encoding issues explicit.
llvm-svn: 187931
2013-08-07 23:09:55 +00:00
Daniel Dunbar 16606887c4 [lit] Report the traceback when config import fails.
llvm-svn: 187920
2013-08-07 21:43:34 +00:00
Daniel Dunbar df1ed9b886 [lit] Avoid comparisons with None.
llvm-svn: 187919
2013-08-07 21:43:23 +00:00
Daniel Dunbar f6dc230bef [lit] Use list comprehensions instead of map().
llvm-svn: 187918
2013-08-07 21:43:17 +00:00
Daniel Dunbar 1047d9a412 [lit] Avoid deprecated dict.has_key() method.
llvm-svn: 187917
2013-08-07 21:43:12 +00:00
NAKAMURA Takumi 50985962d6 lit/LitConfig.py: Fixup for msys bash.
llvm-svn: 187896
2013-08-07 17:21:23 +00:00
NAKAMURA Takumi c97b753cf4 Lit: Fixup in r187886.
llvm-svn: 187887
2013-08-07 12:53:53 +00:00
NAKAMURA Takumi aa7cea9369 Lit: Resurrect --no-execute dropped in r187852.
For now, builders in bb.pgr.jp are using it.

llvm-svn: 187886
2013-08-07 12:44:29 +00:00
Daniel Dunbar 4e06f0d106 [lit] Use py2&3 compatible exec() syntax.
llvm-svn: 187862
2013-08-07 03:25:28 +00:00
Daniel Dunbar c9568b84b7 [lit] Use newer StringIO class.
llvm-svn: 187861
2013-08-07 03:24:20 +00:00
Daniel Dunbar 3957a8f07f [lit] Use modern absolute/relative import style.
llvm-svn: 187860
2013-08-07 03:23:12 +00:00
Daniel Dunbar 679a82023e [lit] Avoid __cmp__ and cmp().
llvm-svn: 187859
2013-08-07 03:22:02 +00:00
Daniel Dunbar 3a90aebd3a [lit] Avoid use of iterator .next() method.
llvm-svn: 187858
2013-08-07 03:20:54 +00:00
Daniel Dunbar a3ef2f2dd8 [lit] Use .write() methods instead of print statement.
llvm-svn: 187857
2013-08-07 03:19:45 +00:00
Daniel Dunbar bc2f287c63 [lit] Use dual-compatible print() syntax where possible.
llvm-svn: 187856
2013-08-07 03:18:36 +00:00
Daniel Dunbar 318e8976b6 [lit] Remove use of deprecated parameter tuple unpacking.
llvm-svn: 187855
2013-08-07 03:17:27 +00:00
Daniel Dunbar 7defa7a74c [lit] Remove uses of deprecated except syntax.
- Since we only have a few of these, use the cumbersome method of getting the
   exception object from 'sys' to retain the current pre-2.6 compatibility.

llvm-svn: 187854
2013-08-07 03:16:19 +00:00
Daniel Dunbar 5b09842179 [lit] Use more modern syntax for constructing exceptions.
llvm-svn: 187853
2013-08-07 03:15:10 +00:00
Daniel Dunbar a155dcd166 [lit] Drop --no-execute, which isn't generally useful.
llvm-svn: 187852
2013-08-07 03:14:00 +00:00
Daniel Dunbar 668c61f687 [lit] tests: Change discovery test to use --show-tests.
llvm-svn: 187851
2013-08-07 03:12:51 +00:00
Daniel Dunbar 2c687fe7b9 [lit] Add a --show-tests option.
llvm-svn: 187850
2013-08-07 03:11:42 +00:00
Daniel Dunbar 2a5c39de55 [lit] Remove dead ignoreStdError argument.
llvm-svn: 187849
2013-08-07 03:08:46 +00:00
Rafael Espindola 8e0f635fe8 Move the default back to pipefail. I accidentally reverted it before.
llvm-svn: 187271
2013-07-26 23:22:43 +00:00
Rafael Espindola 0fe236d873 Propagate pipefail when cloning.
llvm-svn: 187268
2013-07-26 23:17:38 +00:00