binaryeq / jcompile

scripts to compile Java projects with different compilers to create a data set of comparable binaries
Apache License 2.0
0 stars 0 forks source link

Report main or test #54

Closed wtwhite closed 11 months ago

wtwhite commented 11 months ago

Resolves #49, #44.

I decided to just treat *-tests.jar as ordinary jars like any other -- the only issue seems to be that their metadata lives in files based on the "base" jar filename.

TODO: Change COMPONENT_NAME in Utils.java, maybe by extracting the -tests fragment and appending it to the component name. The important thing is to not treat -tests as the version. Promoted to its own issue, #55.

wtwhite commented 11 months ago

Run on a cut-down dataset with just 3 compiler versions:

wtwhite@wtwhite-vuw-vm:~/code/jcompile/oracle-construction$ mkdir small_jars_with_tests
wtwhite@wtwhite-vuw-vm:~/code/jcompile/oracle-construction$ cp -a ../runs/26_full_run_with_compiled_tests/jars/openjdk-{11.0.19,17.0.7,8.0.372} small_jars_with_tests
wtwhite@wtwhite-vuw-vm:~/code/jcompile/oracle-construction$ time java -cp target/jcompile.jar nz.ac.wgtn.shadedetector.jcompile.oracles.SameArtifactDifferentCompilerClassOracle small_jars_with_tests > small_jars_with_tests.txt
--snip--
real    0m39.489s
user    0m45.412s
sys 0m5.086s

Frequencies for all metadata combinations, showing that we get a variety of combinations for both test and main scopes, indicating that metadata is being picked up correctly for test classes:

wtwhite@wtwhite-vuw-vm:~/code/jcompile/oracle-construction$ cut -f 5- small_jars_with_tests.txt |sort|uniq -c
    971 antlr   antlr   false   false   false   false   main    main
  13588 -   -   false   false   false   false   main    main
  17712 -   -   false   false   false   false   test    test
    218 -   -   false   false   false   true    main    main
     97 -   -   false   false   false   true    test    test
    516 -   -   false   false   true    true    main    main
   1593 -   -   false   false   true    true    test    test
      1 generated_by_1  generated_by_2  bytecode_jep181_1   bytecode_jep181_2   bytecode_jep280_1   bytecode_jep280_2   scope_1 scope_2
     38 javacc  javacc  false   false   false   false   main    main
    604 -   -   true    true    false   false   main    main
    191 -   -   true    true    false   false   test    test
     23 -   -   true    true    false   true    main    main
      3 -   -   true    true    false   true    test    test
     23 -   -   true    true    true    true    main    main
      6 -   -   true    true    true    true    test    test
wtwhite@wtwhite-vuw-vm:~/code/jcompile/oracle-construction$ cut -f 5- small_jars_with_tests.txt |sort|uniq -c|grep test
  17712 -   -   false   false   false   false   test    test
     97 -   -   false   false   false   true    test    test
   1593 -   -   false   false   true    true    test    test
    191 -   -   true    true    false   false   test    test
      3 -   -   true    true    false   true    test    test
      6 -   -   true    true    true    true    test    test