[Lldb-commits] [PATCH] D19215: normalize test file extension for test filenames

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 18 09:59:15 PDT 2016


tfiala added a comment.

> I was able to replicate just prior to applying the change, but I'll double check.


Yeah that change didn't cover all the cases.  The test_filename that comes from this call stack (in startTest), originating within the unittest2 framework, has the .pyc (assuming this patch here, modifying the call to inspect.getfile() to inspect.getsource()):

  Traceback (most recent call last):
    File "test/dotest.py", line 7, in <module>
      lldbsuite.test.run_suite()
    File "/Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/dotest.py", line 1083, in run_suite
      resultclass=test_result.LLDBTestResult).run(configuration.suite)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/runner.py", line 162, in run
      test(result)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/suite.py", line 65, in __call__
      return self.run(*args, **kwds)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/suite.py", line 85, in run
      self._wrapped_run(result)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/suite.py", line 115, in _wrapped_run
      test._wrapped_run(result, debug)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/suite.py", line 117, in _wrapped_run
      test(result)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/case.py", line 433, in __call__
      return self.run(*args, **kwds)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/third_party/Python/module/unittest2/unittest2/case.py", line 338, in run
      result.startTest(self)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/test_result.py", line 133, in startTest
      EventBuilder.event_for_start(test))
    File "/Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/result_formatter.py", line 366, in event_for_start
      test, EventBuilder.TYPE_TEST_START)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/result_formatter.py", line 269, in _event_dictionary_common
      test_filename = EventBuilder._normalize_test_filename(test.test_filename)
    File "/Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/result_formatter.py", line 249, in _normalize_test_filename
      raise Exception("filename ends in .pyc: {}".format(test_filename))
  Exception: filename ends in .pyc: /Volumes/Data/src/lldb-llvm.org/lldb/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.pyc

So we still want this I think.  I also disagree about it being a sledgehammer - it is ensuring that input parameters that come from several different sources all follow the protocol of being .py files.  That's just verifying input parameters.  If they all came from the same place, I'd consider it an error to correct, but when they come from places like unittest2 that we don't need/want to change, this seems like fair game.


http://reviews.llvm.org/D19215





More information about the lldb-commits mailing list