A docker image to run the Juliet Test Suite for Java
143
Creating environments to deal with the Juliet Test Suite for Java, v1.3-
The image automatically builds the test cases using ant to generate the .class files of the .java test cases.
The WORKING DIRECTORY is /juliet/java
docker pull stefadp/juliet-java:latest
To use the files from other repositories, you can simply create a shared volume on your host and copy there the folders and files present in /juliet/java/Java/src, namely testcases and testcasesupport
For example, consider the situation in which someone wants to analyze the performance of a static analysis tool such as JBMC on the Juliet Test Suite. A container can exists containing all the dependencies and programs to run the tool. In this example we use the stefadp/jbmc as image for the container.
First
docker pull stefadp/juliet-java:latest
then open your terminal and create a folder to share among containers:
sudo mkdir <path-to-desired-location>/hostvolume
Next, launch a container named juliet-test and map /hostvolume on the host to a volume on the container with the command:
sudo docker run -it --name juliet-test -v <path-to-desired-location>/hostvolume:/shared stefadp/juliet-java:latest
In this case we created a folder /shared as volume on the container. That folder does not exists in the container and is automatically generated when running the command above.
Once you are at the new container's command prompt, move to root folder with: cd /
You can now copy the test cases (or a set of them) to the shared volume with the command:
cp -a /juliet/java/Java/src/. /shared
Detach from the container with Ctrl-p + Ctrl-q and return to the host machine's command prompt. Once there, list the files in the shared volume (/hostvolume) with the command:
sudo ls <path-to-desired-location>/hostvolume
You will see the folders we copied from the container.
First run
docker pull stefadp/jbmc:latest
Next, launch a container named jbmc-test and map /hostvolume on the host to a volume on the container with the command:
sudo docker run -it --name juliet-test -v <path-to-desired-location>/hostvolume:/shared stefadp/juliet-java:latest
In this case we created a folder /shared as volume on the container (note: the name can differ from the /shared in the previous container) .
That folder does not exists in the container and is automatically generated when running the command above.
Once you are at the new container's command prompt, list the files in the shared volume with the command:
ls /shared
You will see the test cases which we copied on the host in the previous steps.
Let's use jbmc. Move to the CWE111_Unsafe_JNI directory with:
cd /shared/testcases/CWE111_Unsafe_JNI/antbuild/testcases/CWE111_Unsafe_JNI
Run jbmc on function bad() present in the class CWE111_Unsafe_JNI__console_01.java with the command:
jbmc CWE111_Unsafe_JNI__console_01.class --function testcases.CWE111_Unsafe_JNI.CWE111_Unsafe_JNI__console_01.bad --unwind 10
If you want to store the results in the shared volume, run:
mkdir /shared/results
jbmc CWE111_Unsafe_JNI__console_01.class --function testcases.CWE111_Unsafe_JNI.CWE111_Unsafe_JNI__console_01.bad --unwind 100 >> /shared/results/results.txt
They will automatically being copied on the host machine.
Content type
Image
Digest
Size
390.2 MB
Last updated
about 7 years ago
docker pull stefadp/juliet-java