Commit Graph

45 Commits

Author SHA1 Message Date
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
Martin Duhem 5cce0e9d5d
Fix #5801: Remove duplicate TaskDefs in test agent
When forking, a test could be run as many times as its `TestDef` matched
`Fingerprint`s. When forking is disabled, sbt correctly runs the tests
only once.
2020-08-26 17:19:35 +02:00
Ethan Atkins cf745255e8 Apply javafmt in sbt project 2020-01-14 14:38:08 -08:00
Olafur Pall Geirsson fd658f38d3 Add library-friendly entrypoint for sbt.ForkMain
Previously, it was not possible to use `sbt.ForkMain` as a library since
* it called `System.exit`, shutting down the library client JVM process.
* it assumed that it was always running in the same classloader as where
  the test suites it was running causing "class not found: my.test.Suite"
  if the `ForkMain` class lives in a classloader above the test suite
  classes.
This commit adds a new `main(Array[String],ClassLoader])` entrypoint
that allows clients to call `ForkMain` as a library.
2019-12-17 10:51:10 +00:00
Eugene Yokota 4ff4f6e45e Update header 2018-09-14 04:53:36 -04:00
xuwei-k 6936ca024e use Java 7 and 8 features
- diamond operator
- lambda
2018-07-08 22:32:26 +09:00
Daniel Riquelme aee10cf036 Fix CTRL-C exception 2018-06-22 05:04:30 -04:00
Ethan Atkins 9b24e9f9eb Use ConcurrentLinkedDeque for EventHandler
ArrayList::add is not thread safe. I ran into cases where async tests
using utests would fail even when all of the individual tests passed.
This was because multiple threads called back into the handle method of
the handler instance variable, which just delegated to eventList::add.
When this happened, one of the events would get added to the list as a
null reference, which would manifest as an NPE upstream on the master
process. After this change, my tests stopped failing.
2018-03-21 10:50:30 -07:00
Dale Wijnand a41727fb17
Add, configure & enforce file headers 2017-10-05 09:03:40 +01:00
xuwei-k 5b00e7326b s/newInstance/getDeclaredConstructor().newInstance()
java.lang.Class#newInstance deprecated since Java 9

http://download.java.net/java/jdk9/docs/api/java/lang/Class.html#newInstance--

```
Deprecated. This method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. The Constructor.newInstance method avoids this problem by wrapping any exception thrown by the constructor in a (checked) InvocationTargetException.
The call

 clazz.newInstance()

can be replaced by

 clazz.getDeclaredConstructor().newInstance()

The latter sequence of calls is inferred to be able to throw the additional exception types InvocationTargetException and NoSuchMethodException. Both of these exception types are subclasses of ReflectiveOperationException.
Creates a new instance of the class represented by this Class object. The class is instantiated as if by a new expression with an empty argument list. The class is initialized if it has not already been initialized.
```
2017-03-15 11:53:49 +09:00
Dale Wijnand d77e769635 Cleanup testAgentProj 2016-07-07 01:40:01 +01:00
Kamil Kloch cd3af2f0cd Updated ForkError.getMessage() to include exception's original name. 2015-05-25 13:50:56 +02:00
Jean-Rémi Desjardins ca736e55d3 Minor code cleanup 2014-12-03 09:56:34 -08:00
Josh Suereth 0a8d844071 Fix merge conflicts in pulling doc fixes from 0.13.1 into 0.13 branch. 2014-03-06 10:10:38 -05:00
Bruno Bieth 5a88bd2302 Third draft to execute the forked tests in parallel.
This feature is not activated by default. To enable it set `testForkedParallel` to `true`.

The test-agent then executes the tests in a thread pool.
For now it has a fixed size set to the number of available processors.
The concurrent restrictions configuration should be used.
2013-11-21 08:20:43 -05:00
James Roper b337f3d9ac Flush ObjectOutputStreams after construction
This protects against deadlocks between the writing and reading end,
since the ObjectOutputStream constructor writes a header, but does not
flush, and the ObjectInputStream constructor reads the header, and
blocks until it's read.
2013-11-01 13:26:07 -04:00
Mark Harrah 277813dd0a Improve forked test debugging by listing tests run by sbt. Fixes #868.
This helps diagnosing issues on the sbt/framework border by verifying
that sbt is properly collecting and invoking tests.
2013-10-03 10:57:00 -04:00
Mark Harrah a1a00526ff properly wrap unknown test data structures in serializable ones 2013-06-28 12:12:58 -04:00
Mark Harrah 3e74b92bf8 TestFingerprintWrapper no longer necessary 2013-06-28 11:18:17 -04:00
Mark Harrah 301c11f9e0 Drop ForkTestDefinition in favor of TaskDef 2013-06-28 09:24:47 -04:00
Mark Harrah ba28e5b505 not necessary to rewrap TaskDef in FrameworkWrapper.createTask 2013-06-28 09:24:33 -04:00
Mark Harrah 019920c138 duration() is specified to return -1 when none exists 2013-06-28 09:09:46 -04:00
cheeseng 86f47bd67d Added explicitlySpecified and selectors field to ForkTestDefinition, and change ForkMain to use explicitlySpecified and selectors value sent from ForkTests. 2013-06-28 17:45:13 +08:00
cheeseng 5bb46359b5 Change to use test-interface-1.0-SNAP7, and use ScalaTest 2.0.M6-SNAP26 which implemented test-interface-1.0-SNAP7. 2013-06-28 17:18:38 +08:00
cheeseng a920c739d6 Added support of nested test tasks when tests are executed in SubProcess. 2013-04-25 00:06:52 +08:00
cheeseng a76523a5f6 Added >1 framework class per framework support, this enables sbt to support both old and new framework API at the same time. 2013-04-23 12:00:05 +08:00
cheeseng f38a244d0f Added code to call Runner's done() method in both InProcess and SubProcess cases. 2013-04-23 12:00:03 +08:00
cheeseng 244e65cd79 -Changed behavior so that only a single Runner instance is used to run tests in multiple test groups.
-Added code to support remoteArgs in test-interface 1.0.
2013-04-23 11:09:50 +08:00
cheeseng b2b9fb132a Made to ForkMain's write method synchronized, to ensure the output stream won't corrupt when test framework implementation uses multi-threads to write event back to sbt. 2013-04-23 11:09:49 +08:00
cheeseng 18bc8423b5 Initial version that uses new framework API in test-interface 1.0:
-Changed usages and implementations of interfaces in org.scalatools.testing._ to use/implement interfaces/classes in sbt.testing._ instead.
-Added sbt.testing to interfaceFilter in TestFramework.createTestLoader method to enable loading of classes in sbt.testing package.
-Added FrameworkWrapper.java to wrap old framework implementations.
-Added code in ForkMain.java to serialize Selectors.
2013-04-23 11:09:37 +08:00
Mark Harrah 9702d3d318 Handle exceptions not caught by the test framework when forking. Fixes #653. 2013-01-28 17:14:53 -05:00
Eugene Vigdorchik 960d17c358 Use java.lang.Throwable.setStackTrace. Proper fix for #543. 2012-11-15 10:14:59 -05:00
Eugene Vigdorchik 4bb5007282 Call System.exit after the main thread is finished. Closes #565. 2012-10-16 07:47:30 -04:00
Eugene Vigdorchik 88e8090d7a Abort running tests on the first failure to communicate results back to the main process. Closes #557. 2012-10-16 07:47:30 -04:00
Eugene Vigdorchik b8ef434ec1 When forking tests serialize Event.error as well. Closes #543. 2012-09-18 13:23:29 -04:00
Eugene Vigdorchik b4e64d37db Various fork in Test fixes. Closes #512 #515. 2012-08-25 07:15:23 -04:00
Eugene Vigdorchik 04d53c05d5 Modify forking tests based on Stefan's feedback. Should be ported to 0.12 2012-05-09 20:07:47 -04:00
Mark Harrah 75dfccf098 move ForkMain.Tags out to top-level ForkTags to make sxr happy 2012-04-06 23:29:48 -04:00
Eugene Vigdorchik b5766e4057 Fix newlines and indentation. 2012-04-04 09:30:46 +04:00
Eugene Vigdorchik 291db63af3 Fixes 2012-04-03 19:43:59 +04:00
Eugene Vigdorchik c4385adce0 Some more fixes. 2012-04-03 11:49:41 +04:00
Eugene Vigdorchik 4abefbd3b6 Remove redundant try/catch. 2012-04-02 23:56:42 +04:00
Eugene Vigdorchik 2741515d44 Fixes after review, take 3. 2012-04-02 16:05:56 +04:00
Eugene Vigdorchik 4d5effcb28 Fixes after review, take 2. 2012-04-02 12:08:18 +04:00
Eugene Vigdorchik 7afc9e77c6 \'fork in test\' initial implementation. 2012-04-01 11:44:05 +04:00