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

Inconsistency in reported result and my running result on D4J 2.0.0 Chart 1 #78

Open
BEbillionaireUSD opened this issue Oct 20, 2024 · 0 comments

Comments

@BEbillionaireUSD
Copy link

BEbillionaireUSD commented Oct 20, 2024

Context

I refer to this code #30 (comment) and run Gzoltar on Defects4j 2.0

Steps to Reproduce

  1. checkout -p Chart -v 1b -w checkouts/Chart_1_buggy
  2. Run the following commands
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
export GZOLTAR_AGENT_JAR="/gzoltar/com.gzoltar.agent.rt/target/com.gzoltar.agent.rt-1.7.3-SNAPSHOT-all.jar"
export GZOLTAR_CLI_JAR="/gzoltar/com.gzoltar.cli/target/com.gzoltar.cli-1.7.3-SNAPSHOT-jar-with-dependencies.jar"
export TZ='America/Los_Angeles'
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

export D4J_HOME="/defects4j"
proj_dir="/defects4j/checkouts/${PID}_${BID}_buggy"

cd "$proj_dir"
test_classpath=$($D4J_HOME/framework/bin/defects4j export -p cp.test)
src_classes_dir=$($D4J_HOME/framework/bin/defects4j export -p dir.bin.classes)
src_classes_dir="$proj_dir/$src_classes_dir"
test_classes_dir=$($D4J_HOME/framework/bin/defects4j export -p dir.bin.tests)
test_classes_dir="$proj_dir/$test_classes_dir"
echo "${PID}_${BID}_buggy's classpath: $test_classpath" >&2
echo "${PID}_${BID}_buggy's bin dir: $src_classes_dir" >&2
echo "${PID}_${BID}_buggy's test bin dir: $test_classes_dir" >&2

cd "$proj_dir"
unit_tests_file="$proj_dir/unit_tests.txt"
relevant_tests="*"

java -cp "$D4J_HOME/framework/projects/lib/junit-4.11.jar:$test_classpath:$test_classes_dir:$GZOLTAR_CLI_JAR" \
  com.gzoltar.cli.Main listTestMethods \
    "$test_classes_dir" \
    --outputFile "$unit_tests_file" \
    --includes "$relevant_tests"

echo ">>>>> Unit Test File!"
head "$unit_tests_file"

cd "$proj_dir"
loaded_classes_file="$D4J_HOME/framework/projects/$PID/loaded_classes/$BID.src"
normal_classes=$(cat "$loaded_classes_file" | sed 's/$/:/' | sed ':a;N;$!ba;s/\\n//g')
inner_classes=$(cat "$loaded_classes_file" | sed 's/$/$*:/' | sed ':a;N;$!ba;s/\\n//g')
classes_to_debug="$normal_classes$inner_classes"
echo "Likely faulty classes: $classes_to_debug" >&2

ser_file="$proj_dir/gzoltar.ser"
export _JAVA_OPTIONS="-Xmx6144M -XX:MaxHeapSize=4096M"
java -javaagent:$GZOLTAR_AGENT_JAR=destfile=$ser_file,buildlocation=$src_classes_dir,includes=$classes_to_debug,excludes="",inclnolocationclasses=false,output="FILE" \
 -cp "$src_classes_dir:$D4J_HOME/framework/projects/lib/junit-4.11.jar:$test_classpath:$GZOLTAR_CLI_JAR" \
 com.gzoltar.cli.Main runTestMethods \
 --testMethods "$unit_tests_file" \
 --collectCoverage

cd "$proj_dir"
java -cp "$src_classes_dir:$D4J_HOME/framework/projects/lib/junit-4.11.jar:$test_classpath:$GZOLTAR_CLI_JAR" \
 com.gzoltar.cli.Main faultLocalizationReport \
 --buildLocation "$src_classes_dir" \
 --granularity "line" \
 --inclPublicMethods \
 --inclStaticConstructors \
      --inclDeprecatedMethods \
      --dataFile "$ser_file" \
      --outputDirectory "$proj_dir" \
      --family "sfl" \
      --formula "ochiai" \
      --metric "entropy" \
      --formatter "txt"

if [ $? -ne 0 ]; then
    echo "Error: Failed to list test methods."
    exit 1
fi
  1. check the sfl/txt.ochiai.ranking.csv

Expected behaviour

As reported in https://bitbucket.org/rjust/fault-localization-data/src/master/analysis/pipeline-scripts/buggy-lines/Chart-1.buggy.lines, the suspicious line should be 1797
Howeve, sfl/txt.ochiai.ranking.csv shows that the faulty line is 1793.
截屏2024-10-20 下午10 01 49

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

  • Linux

Additional comments

I'm wondering what causes such a gap. Is it natural, or do I make some mistakes? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant