Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError [Bears benchmark] [openmrs-openmrs-module-webservices.rest-455565885-458312291 bug] #22

Open
jose opened this issue Apr 10, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jose
Copy link
Member

jose commented Apr 10, 2020

Context

When applied to the openmrs-openmrs-module-webservices.rest-455565885-458312291 bug of the Bears benchmark, GZoltar rans out of memory. As it runs of out of memory, it is not possible to check whether GZoltar works as expected.

Steps to Reproduce

$ rm -rf "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue"
$ mkdir "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue"
$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue"

Get openmrs-openmrs-module-webservices.rest-455565885-458312291 bug from Bears benchmark

$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue"
$ git clone https://github.com/bears-bugs/bears-benchmark.git
$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark"
$ git checkout openmrs-openmrs-module-webservices.rest-455565885-458312291
$ buggy_commit=$(git log --format=format:%H --grep='Changes in the tests') # git log --format=format:%H --grep='Changes in the tests'  **or**  git log --format=format:%H --grep='Bug commit'
$ git checkout "$buggy_commit"

Compile openmrs-openmrs-module-webservices.rest-455565885-458312291 bug from Bears benchmark

$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark"
$ mvn clean package -DskipTests=true # Compile the entire project
$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9"
$ mvn clean package -DskipTests=true # Compile the buggy module

Run tests of the buggy module of the openmrs-openmrs-module-webservices.rest-455565885-458312291 bug from Bears benchmark

$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9"
$ mvn test

...
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   ObsController1_9Test.getObs_shouldCreateAnObsWhenTheQuestionConceptIsSetAsAMapContainingTheUuid:214->RestControllerTestUtils.handle:98 » Conversion
[INFO]
[ERROR] Tests run: 675, Failures: 0, Errors: 1, Skipped: 3
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  48.347 s
[INFO] Finished at: 2020-04-09T11:00:55+01:00
[INFO] ------------------------------------------------------------------------

Get GZoltar

$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue"
$ git checkout https://github.com/GZoltar/gzoltar.git
$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/gzoltar"
$ mvn clean package -DskipTests=true
$ export GZOLTAR_CLI_JAR="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/gzoltar/com.gzoltar.cli/target/com.gzoltar.cli-1.7.3-SNAPSHOT-jar-with-dependencies.jar"
$ export GZOLTAR_AGENT_JAR="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/gzoltar/com.gzoltar.agent.rt/target/com.gzoltar.agent.rt-1.7.3-SNAPSHOT-all.jar"

Perform fault localization

$ cd "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9"

$ classpath=$(mvn dependency:build-classpath | grep -v "\[INFO\]" | grep -v "\[WARNING\]")
$ test_classes_dir="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target/test-classes"
$ src_classes_dir="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target/classes"
Find list of test cases to run
$ list_of_tests_to_run_file="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target/tests_to_run.txt"
$ rm -f "$list_of_tests_to_run_file"

$ java -cp $src_classes_dir:$test_classes_dir:$classpath:$GZOLTAR_CLI_JAR \
    com.gzoltar.cli.Main listTestMethods \
      "$test_classes_dir" \
      --outputFile "$list_of_tests_to_run_file" \
      --includes "org.openmrs.module.webservices.rest.*"

$ cat "$list_of_tests_to_run_file"
Collect coverage
$ ser_file="/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target/gzoltar.ser"
$ rm -f "$ser_file"
$ classes_to_debug="org.openmrs.module.webservices.rest.web.v1_0.*"

$ java -XX:MaxPermSize=2048M -javaagent:$GZOLTAR_AGENT_JAR=destfile=$ser_file,buildlocation=$src_classes_dir,includes=$classes_to_debug,excludes="",inclnolocationclasses=false,output="FILE" \
        -cp $src_classes_dir:$test_classes_dir:$classpath:$GZOLTAR_CLI_JAR \
        com.gzoltar.cli.Main runTestMethods \
          --testMethods "$list_of_tests_to_run_file" \
          --collectCoverage
Create fault localization report
$ java -cp $src_classes_dir:$test_classes_dir:$classpath:$GZOLTAR_CLI_JAR \
      com.gzoltar.cli.Main faultLocalizationReport \
        --buildLocation "$src_classes_dir" \
        --granularity "line" \
        --inclPublicMethods \
        --inclStaticConstructors \
        --inclDeprecatedMethods \
        --dataFile "$ser_file" \
        --outputDirectory "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target" \
        --family "sfl" \
        --formula "ochiai" \
        --metric "entropy" \
        --formatter "txt"

$ grep ",FAIL," "/tmp/openmrs-openmrs-module-webservices.rest-455565885-458312291_issue/bears-benchmark/omod-1.9/target/sfl/txt/tests.csv" | cut -f1 -d','

Environment (please complete the following information, if relevant):

  • OS: MacOS and Linux
  • Commit: 310fba7
$ java -version
java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)

$ mvn -version
Apache Maven 3.6.1
@jose jose self-assigned this Apr 10, 2020
@jose jose added the bug Something isn't working label May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant