Skip to content

Commit 4069eaa

Browse files
committed
Initial commit
0 parents  commit 4069eaa

1,680 files changed

Lines changed: 270115 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing to Randoop
2+
3+
Thank you for contributing to the Randoop! This project is a
4+
community effort of [more than 20
5+
developers](https://checkerframework.org/manual/#credits), plus countless
6+
more people who have contributed bug reports and feature suggestions. We
7+
couldn't do it without your help.
8+
9+
10+
## Reporting bugs
11+
12+
Please see the [bug
13+
reporting](https://randoop.github.io/randoop/manual/#bug-reporting) section of
14+
the Randoop manual.
15+
16+
If the documentation is incorrect, incomplete, or confusing, that is a
17+
bug, and we want to fix it. Please report it.
18+
19+
20+
## Submitting changes
21+
22+
Please make a [pull request](https://github.com/randoop/randoop/pulls). If
23+
you have not made a pull request before, please see ["How to create and
24+
review a GitHub pull
25+
request"](https://homes.cs.washington.edu/~mernst/advice/github-pull-request.html).
26+
27+
Do you want to contribute to the project, but you are not sure what issue
28+
to fix or what feature to add? Use the tool in your daily work, and when
29+
you encounter a limitation that bothers you, fix that one. The ["good
30+
first issue"](https://github.com/randoop/randoop/contribute)
31+
label marks issues that require less deep knowledge and may be appropriate
32+
for a newcomer to the codebase.
33+
34+
35+
## License
36+
37+
By contributing, you agree that your contributions will be licensed under the
38+
existing [license](LICENSE.txt), usually the MIT License.
39+
40+
41+
## Code of conduct
42+
43+
When interacting with other people, please abide by the [Contributor
44+
Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct).

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 University of Washington
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Randoop unit test generator for Java
2+
3+
Randoop is a unit test generator for Java.
4+
It automatically creates unit tests for your classes, in JUnit format.
5+
6+
## Learn about Randoop:
7+
8+
* [Randoop homepage](https://randoop.github.io/randoop/)
9+
* [Randoop manual](https://randoop.github.io/randoop/manual/index.html)
10+
* [Randoop release](https://github.com/randoop/randoop/releases/latest)
11+
* [Randoop developer's manual](https://randoop.github.io/randoop/manual/dev.html)
12+
* [Randoop Javadoc](https://randoop.github.io/randoop/api/)
13+
14+
## Directory structure
15+
16+
* `agent` - subprojects for Java agents (load-time bytecode rewriting)
17+
* `gradle` - the Gradle wrapper directory (*Should not be edited*)
18+
* `lib` - jar files for local copies of libraries not available via Maven
19+
* `scripts` - git hook scripts
20+
* `src` - source directories for Randoop, including
21+
* `coveredTest` - source for JUnit tests of the covered-class Java agent
22+
* `distribution` - resource files for creating the distribution zip file
23+
* `docs` - [documentation]("https://randoop.github.io/randoop/"), including the manual and resources
24+
* `javadoc` - resource files for creating [API documentation](https://randoop.github.io/randoop/api/)
25+
* `main` - Randoop source code
26+
* `replacecallTest` - source for JUnit tests of the replacecall Java agent
27+
* `systemTest` - source for Randoop system tests
28+
* `test` - source for JUnit tests of Randoop
29+
* `testInput` - source for libraries used in Randoop testing
30+
31+
The source directories follow the conventions of the Gradle Java plugin, where
32+
each directory has a _java_ subdirectory containing Java source, and,
33+
in some cases, a _resources_ subdirectory containing other files.

agent/README

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
This directory ('randoop/agent') holds subprojects for Java agents
2+
(load-time bytecode transformers) to be used with Randoop. Each
3+
subdirectory also occurs as a subproject name in 'randoop/settings.gradle',
4+
which includes the subproject into the Randoop build.
5+
6+
For a subproject named 'an-agent', the settings file contains a line
7+
`include 'an-agent'`, and assumes that the subproject occurs in the directory
8+
'randoop/agent/an-agent' and has a build script
9+
'randoop/agent/an-agent/an-agent.gradle'.
10+
The agent manifest is generated by the subproject build script.
11+
12+
Note that 'randoop/build.gradle' applies the Java plugin for all projects.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// this is a Java project
2+
3+
plugins {
4+
id 'java'
5+
id 'jacoco'
6+
}
7+
8+
description = 'covered-class instrumentation agent'
9+
10+
configurations {
11+
javassist
12+
implementation.extendsFrom javassist
13+
}
14+
15+
dependencies {
16+
javassist 'org.javassist:javassist:3.+'
17+
implementation project(path: ':', configuration: 'shadow')
18+
implementation project(path: ':')
19+
}
20+
21+
javadoc {
22+
options.addStringOption('Xwerror', '-Xdoclint:all,-missing')
23+
}
24+
25+
jar {
26+
manifest {
27+
attributes(
28+
'Premain-Class': 'randoop.instrument.CoveredClassAgent',
29+
'Can-Redefine-Classes': 'true'
30+
)
31+
}
32+
}
33+
34+
shadowJar {
35+
// Name the jar file covered-class-version.jar
36+
archiveClassifier = null
37+
38+
exclude '**/pom*'
39+
40+
relocate 'com.github.javaparser', 'coveredclass.org.github.javaparser'
41+
relocate 'com.google.common', 'coveredclass.com.google.common'
42+
relocate 'com.google.gson', 'coveredclass.com.google.gson'
43+
relocate 'com.google.thirdparty', 'coveredclass.com.google.thirdparty'
44+
relocate 'com.jcraft.jsch', 'coveredclass.com.jcraft.jsch'
45+
relocate 'com.sun.javadoc', 'coveredclass.com.sun.javadoc'
46+
relocate 'com.sun.jna', 'coveredclass.com.sun.jna'
47+
relocate 'com.trilead.ssh2', 'coveredclass.com.trilead.ssh2'
48+
relocate 'de.regnis.q.sequence', 'coveredclass.de.regnis.q.sequence'
49+
relocate 'javassist', 'coveredclass.javassist'
50+
relocate 'net.fortuna.ical4j', 'coveredclass.net.fortuna.ical4j'
51+
relocate 'nu.xom', 'coveredclass.nu.xom'
52+
relocate 'org.antlr', 'coveredclass.org.antlr'
53+
relocate 'org.apache', 'coveredclass.org.apache'
54+
relocate 'org.ccil.cowan.tagsoup', 'coveredclass.org.ccil.cowan.tagsoup'
55+
relocate 'org.checkerframework', 'coveredclass.org.checkerframework'
56+
relocate 'org.ini4j', 'coveredclass.org.ini4j'
57+
relocate 'org.slf4j', 'coveredclass.org.slf4j'
58+
relocate 'org.tigris.subversion', 'coveredclass.org.tigris.subversion'
59+
relocate 'org.tmatesoft', 'coveredclass.org.tmatesoft'
60+
}
61+
62+
apply from: rootProject.file('gradle-mvn-push.gradle')
63+
64+
final coveredClassPom(publication) {
65+
// Don't use publication.from components.java which would publish the skinny jar as randoop.jar.
66+
// Information that is in all pom files is configured in randoop/gradle-mvn-push.gradle.
67+
publication.pom {
68+
name = 'Randoop\'s covered-class agent'
69+
description = 'Requires Randoop\'s tests to execute (cover) certain classes'
70+
}
71+
}
72+
73+
publishing {
74+
publications {
75+
remote(MavenPublication) {
76+
coveredClassPom it
77+
artifact shadowJar
78+
artifact javadocJar
79+
artifact sourcesJar
80+
}
81+
82+
local(MavenPublication) {
83+
coveredClassPom it
84+
artifact shadowJar
85+
artifact javadocJar
86+
artifact sourcesJar
87+
}
88+
}
89+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package randoop.instrument;
2+
3+
import java.lang.instrument.Instrumentation;
4+
5+
/**
6+
* Defines the Java agent to instrument classes for covered-class filtering. Sets up {@code
7+
* Instrumentation} for JVM so that bytecode first passed through an {@link CoveredClassTransformer}
8+
* that performs instrumentation.
9+
*/
10+
public class CoveredClassAgent {
11+
12+
/**
13+
* The premain method that instruments classes.
14+
*
15+
* @param agentArgs agent options
16+
* @param inst the instrumentation
17+
*/
18+
public static void premain(String agentArgs, Instrumentation inst) {
19+
inst.addTransformer(new CoveredClassTransformer());
20+
}
21+
}

0 commit comments

Comments
 (0)