[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGadb5c23f8c0d: [test] Exit with an error if no tests are run. 
(authored by rupprecht).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

Thanks for the quick review!

I have a few more boring changes coming up, but hopefully some interesting ones 
after that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht updated this revision to Diff 282759.
rupprecht added a comment.

- Use logging.error
- Remove trailing stop
- Edit message to indicate that matching tests weren't found (user error)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

MaskRay wrote:
> JDevlieghere wrote:
> > Maybe `did not discover any (matching) tests` to make it clear that this 
> > might be the result of user input?
> `sys.stderr.write` or `print(..., file=sys.stderr)` (which appends a newline)
> 
> Trailing full stops are not recommended for error messages if the project 
> does not already have the convention 
> http://llvm.org/docs/CodingStandards.html#error-and-warning-messages
> 
> Looking around, several messages do not have a full stop.
Let's use `logging.error` like the other error messages if we want this to go 
to stderr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

JDevlieghere wrote:
> Maybe `did not discover any (matching) tests` to make it clear that this 
> might be the result of user input?
`sys.stderr.write` or `print(..., file=sys.stderr)` (which appends a newline)

Trailing full stops are not recommended for error messages if the project does 
not already have the convention 
http://llvm.org/docs/CodingStandards.html#error-and-warning-messages

Looking around, several messages do not have a full stop.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

Maybe `did not discover any (matching) tests` to make it clear that this might 
be the result of user input?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85169/new/

https://reviews.llvm.org/D85169

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
rupprecht requested review of this revision.
Herald added a subscriber: JDevlieghere.

If the test suite is misconfigured when it's run (a bad regexp, wrong test 
directory, etc.), the test suite may not discover any tests. When this happens, 
the test runner exits happily because no tests failed:

  Ran 0 tests in 0.000s
  RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected 
failures, 0 unexpected successes)

Change this to return an error so the misconfiguration can be more easily 
detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits