Wiki

Clone wiki

e0210-project / Ant Script

1. Script Description:

The script run.xml is used to run and verify the test cases automatically. The script takes two arguments:

  1. project: Specify on which project you want to run this script on out of the 4 projects (Ex: project-1).
  2. testcase: Specify the testcase you want to run this script on out of the 20 public testcases (Ex: test20)

You can run the script in 2 modes:

  1. run (default)
  2. test

run:

This is the default mode i.e. the script will run in this mode if you do not specify the mode. This will take the byte code of the test case and it will run it though SOOT. SOOT will output the modified byte code of the test case.

test:

This mode is used to test if the modified byte code by SOOT is correct for the given test case. To verify the correctness, the modified byte code is executed and the output is recorded. The recorded output is compared against the expected output specified for the given test case. If the output is correct, the script will display "PASS". Else it will display "FAIL".


1.1 Command to run the script:

ant -f run.xml MODE ARGS

where * MODE is either run or test. * ARGS is project and testcase.

Example:

ant -f run.xml run -Dproject=project-1 -Dtestcase=test1


1.2 testall:

To test all of the test cases present for a specified project, you can give the test case as "testall".

ant -f run.xml run -Dproject=project-1 -Dtestcase=testall


1.3 Repository structure:

In this section I will give a brief description of the folder structure of the repository.

src/
This is the folder where you write your analysis. The SOOT pass is executed from Main.java. You are strictly instructed to not change the name of this file. Other than this, you can use the full functionality of JAVA to create class hierarchies files or any other type of files needed. By default, the SOOT pass starts from the execution of internalTransform method in Analysis.java. ProcessOutput.java is executed on the output generated by the execution of the modified bytecode as part of post-processing the output generated.
lib/
All the third-party library files including the SOOT jar is present in this folder. If you use any third-party libraries in your analysis, you need to add the third party jar file in this folder. Note: If you modify your eclipse build-path to use any third-party libraries, you need to export the build.xml file again using the eclipse export option.
Testcases/
Home folder which contains all the public test cases.
Testcases/output
This folder contains the expected output for all the test cases in each project. You can check the file in this folder to verify if your modified byte code of the test case after post-processing also produces the same output.
Testcases/project-1
This is the home folder of all the public test cases for project-1. The explanation for this directory holds the same for the home folder of other projects as well.
Testcases/project-1/src
JAVA files of all the public testcases.
Testcases/project-1/bin
Byte code of the test cases.
Testcases/project-1/project-1.jar
The jar file containing the source file and the class file (byte code) for all the test cases.
Testcases/project-1/sootBin
Modified byte code of the test case after passing it through SOOT.
Testcases/project-1/input
Input used to execute the test case from its modified byte code.
Testcases/project-1/output
Output produced after executing the test case from its modified byte code. Note that only the standard output will be redirected to this file.
Testcases/project-1/processed-output
This folder contains the modified output file after doing some post-processing. The output file from Testcases/project-1/output folder will be passed through e0210.ProcessOutput.java and the processed output file will be placed in this directory. This output is compared against the expected output present in the Testcases/output folder.

Updated