Skip to content

Commit

Permalink
Recency checks (#609)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Michael Ernst <[email protected]>
  • Loading branch information
rjust and mernst authored Sep 13, 2024
1 parent 2afac7e commit f22e707
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 192 deletions.
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@ Each bug has the following properties:
The (b)uggy and (f)ixed program revisions are labelled with `<id>b` and
`<id>f`, respectively (`<id>` is an integer).

Reproducibility
================

#### Java version
All bugs have been reproduced and triggering tests verified, using the latest
version of Java 11.
Using a different version of Java might result in unexpected failing tests
and/or non-reproducible bugs.

#### Locale
Defects4J uses the JDK-8 compatible locale service provider to ensure
reproducibility of bugs.

If you are using the bugs _outside_ of the Defects4J framework, [set the
JVM's locale service provider to
COMPAT](https://docs.oracle.com/en%2Fjava%2Fjavase%2F11%2Fdocs%2Fapi%2F%2F/java.base/java/util/spi/LocaleServiceProvider.html)
Specifically, use `java -Djava.locale.providers=COMPAT` to ensure
reproducibility. Not setting this option results in unexpected failing tests!

#### Timezone
Defects4J generates and executes tests in the timezone `America/Los_Angeles`.

If you are using the bugs _outside_ of the Defects4J framework, set the `TZ`
environment variable to `America/Los_Angeles` and export it.

Setting up Defects4J
================
Expand All @@ -77,19 +101,9 @@ Requirements
- `cpanm`

Defects4J version 2.x required Java 1.8.
Defects4J version 1.x and 0.x required Java 1.7.


#### Java version
All bugs have been reproduced and triggering tests verified, using the latest
version of Java 11.
Using a different version of Java might result in unexpected failing tests on a fixed
program version.
Defects4J version 1.x and 0.x required Java 1.7.

#### Timezone
Defects4J generates and executes tests in the timezone `America/Los_Angeles`.
If you are using the bugs outside of the Defects4J framework, set the `TZ`
environment variable to `America/Los_Angeles` and export it.

#### Perl dependencies
All required Perl modules are listed in [cpanfile](https://github.com/rjust/defects4j/blob/master/cpanfile).
Expand Down
5 changes: 3 additions & 2 deletions framework/bug-mining/create-project.pl
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,6 @@ =head1 DESCRIPTION
close(OUT);

# Clone the repository
system("mkdir -p $repo_dir && git clone --bare $URL $repo_dir/$NAME.git 2>&1"
. " && echo $NAME: Cloned from $URL >> $repo_dir/README") == 0 or die "Failed to clone repository";
Utils::exec_cmd("mkdir -p $repo_dir && cp $REPO_DIR/README $repo_dir", "Prepare repository directory");
Utils::exec_cmd("git clone --bare $URL $repo_dir/$NAME.git 2>&1", "Clone repository from $URL");
Utils::exec_cmd("echo $NAME: Cloned from $URL >> $repo_dir/README", "Update repository metadata");
15 changes: 11 additions & 4 deletions framework/core/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,29 @@ if ($java_version_output =~ 'version "?(?:1\.)?(\K\d+)') {
# - External libraries (test generation) available?
#
_repos_available()
or die("Couldn't find project repositories! Did you (re)run 'defects4j/init.sh'?\n\n");
or die("Couldn't find up-to-date project repositories! Did you (re)run 'defects4j/init.sh'?\n\n");

-e "$MAJOR_ROOT/bin/ant"
or die("Couldn't find Major mutation framework! Did you (re)run 'defects4j/init.sh'?\n\n");

-d "$TESTGEN_LIB_DIR"
or die("Couldn't find test generation tools! Did you (re)run 'defects4j/init.sh'?\n\n");

-d "$BUILD_SYSTEMS_LIB_DIR"
or die("Couldn't find build system tools! Did you (re)run 'defects4j/init.sh'?\n\n");

-d "$BUILD_SYSTEMS_LIB_DIR/gradle/dists"
or die("Couldn't find gradle distributions! Did you (re)run 'defects4j/init.sh'?\n\n");

-d "$BUILD_SYSTEMS_LIB_DIR/gradle/deps"
or die("Couldn't find gradle dependencies! Did you (re)run 'defects4j/init.sh'?\n\n");

sub _repos_available {
opendir(my $dh, "$REPO_DIR") or die "Cannot read $REPO_DIR: $!";
# The repos directory by default only contains a helper script
return scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh)) > 1;
-e "$REPO_DIR/README" or return 0;
open(IN, "<$REPO_DIR/README") or return 0;
my $line = <IN>;
close(IN);
$line =~ /Defects4J version 3/ or return 0;
}

# Add script and core directory to @INC
Expand Down
Loading

0 comments on commit f22e707

Please sign in to comment.