<commit_before># OpenJDK Code coverage

Here’s the Adopt OpenJDK’s jab at [code-coverage](https://java.net/projects/adoptopenjdk/pages/Codecoverage).

Recently we have enabled code coverage on our Adopt OpenJDK build farms running a CI build of OpenJDK8 and OpenJDK9, publishing jcov reports for [OpenJDK8](https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/openjdk-1.8-linux-x86_64/ws/testoutput/jdk_core/JTreport/jcov/index.html) and [OpenJDK9](https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/openjdk-1.9-linux-x86_64/ws/testoutput/jdk_core/JTreport/jcov/index.html) respectively.

**Build running tests with code-coverage enabled**

Ensure your have the lastest ```jdk``` images built in tge build folder of ```OpenJDK9``` (see [Build your own OpenJDK](binaries/build_your_own_openjdk.md)).

Install ```jtreg with the jcov```, see [How to use JTReg... > Preparations](advanced-steps/preparations.md).

Apply these exports to your ```.bash_xxx``` profile:

```
export SOURCE_CODE=/home/<username>/workspace/jdk9/
export JTREG_INSTALL=/home/<username>/workspace/jtreg
export JT_HOME=$JTREG_INSTALL
export JTREG_HOME=$JTREG_INSTALL
export PRODUCT_HOME=$SOURCE_CODE/build/linux-x86_64-normal-server-release/images/jdk 
export JPRT_JTREG_HOME=${JT_HOME}
export JPRT_JAVA_HOME=${PRODUCT_HOME}
export JTREG_TIMEOUT_FACTOR=5
export CONCURRENCY=8
```
```
$ cd $SOURCES/jdk9/jdk/test
```

Edit the ```Makefile``` and add the following, just before the line  ```# Make sure jtreg exists```:

```
jdkroot=<hardcoded path to your jdk9, see above>

JTREG_TEST_OPTIONS += -jcov/classes:$(jdkroot)/build/linux-x86_64-normal-server-release/jdk/modules/java.base
JTREG_TEST_OPTIONS += -jcov/source:$(jdkroot)/jdk/src/java.base/share/classes
JTREG_TEST_OPTIONS += -jcov/include:*
```
```
$ cd ..
$ make test
```
See also [Building jcov](building_jcov.md).<commit_msg>Update openjdk_code_coverage.md<commit_after># OpenJDK Code coverage

Here’s the Adopt OpenJDK’s jab at [code-coverage](https://java.net/projects/adoptopenjdk/pages/Codecoverage).

Recently we have enabled code coverage on our Adopt OpenJDK build farms running a CI build of OpenJDK8 and OpenJDK9, publishing jcov reports for [OpenJDK8](https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/openjdk-1.8-linux-x86_64/ws/testoutput/jdk_core/JTreport/jcov/index.html) and [OpenJDK9](https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/openjdk-1.9-linux-x86_64/ws/testoutput/jdk_core/JTreport/jcov/index.html) respectively.

**Build running tests with code-coverage enabled**

* Ensure your have the lastest ```jdk``` images built in tge build folder of ```OpenJDK9``` (see [Build your own OpenJDK](binaries/build_your_own_openjdk.md)).

* Install ```jtreg with the jcov```, see [How to use JTReg... > Preparations](advanced-steps/preparations.md).

* Apply these exports to your ```.bash_xxx``` profile:

```
export SOURCE_CODE=/home/<username>/workspace/jdk9/
export JTREG_INSTALL=/home/<username>/workspace/jtreg
export JT_HOME=$JTREG_INSTALL
export JTREG_HOME=$JTREG_INSTALL
export PRODUCT_HOME=$SOURCE_CODE/build/linux-x86_64-normal-server-release/images/jdk 
export JPRT_JTREG_HOME=${JT_HOME}
export JPRT_JAVA_HOME=${PRODUCT_HOME}
export JTREG_TIMEOUT_FACTOR=5
export CONCURRENCY=8
```
```
$ cd $SOURCES/jdk9/jdk/test
```

* Edit the ```Makefile``` and add the following, just before the line  ```# Make sure jtreg exists```:

```
jdkroot=<hardcoded path to your jdk9, see above>

JTREG_TEST_OPTIONS += -jcov/classes:$(jdkroot)/build/linux-x86_64-normal-server-release/jdk/modules/java.base
JTREG_TEST_OPTIONS += -jcov/source:$(jdkroot)/jdk/src/java.base/share/classes
JTREG_TEST_OPTIONS += -jcov/include:*
```
```
* Run tests in debug mode
$ cd ..
$ make test LOG=debug
```
See also [Building jcov](building_jcov.md).
{'fraction_non_alphanumeric': 0.14010554089709762, 'fraction_numerical': 0.0158311345646438, 'mean_word_length': 5.721631205673759, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1199322', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1415, 'n_words': 280}