Skip to content

Commit

Permalink
Create jpf.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnabellaM authored May 24, 2024
1 parent d5d1b47 commit c4e09ad
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/jpf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run JPF

on:
push:

jobs:
run-jpf:
runs-on: ubuntu-20.04
strategy:
matrix:
java: [ '11' ]
name: Java ${{ matrix.java }} Run JPF

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Clone jpf-core
run: |
git clone https://github.com/javapathfinder/jpf-core.git /tmp/jpf-core
cd /tmp/jpf-core
./gradlew buildJars
- name: Compile Java sources
run: |
mkdir -p codes/java/build
find codes/java/ -name "*.java" | xargs javac -d codes/java/build -cp /tmp/jpf-core/build/jpf-classes.jar --enable-preview --release ${{ matrix.java }}
- name: Generate and Run JPF Configs
run: |
find codes/java/ -name "*.java" | while read -r file; do
# Extract package name from the Java file
package=$(grep "^package " "$file" | awk '{print $2}' | sed 's/;$//')
classname=$(basename "$file" .java)
if [ -n "$package" ]; then
fqcn="$package.$classname"
else
fqcn="$classname"
fi
dir=$(dirname "$file")
# Create .jpf file
echo "target=$fqcn" > $dir/$classname.jpf
echo "classpath=codes/java/build" >> $dir/$classname.jpf
echo "sourcepath=codes/java" >> $dir/$classname.jpf
echo "vm.por=true" >> $dir/$classname.jpf
echo "vm.version=${{ matrix.java }}" >> $dir/$classname.jpf
echo "jvm.insn_factory.class=gov.nasa.jpf.jvm.bytecode.InstructionFactory" >> $dir/$classname.jpf
echo "jpf.basedir=/tmp/jpf-core" >> $dir/$classname.jpf
echo "Generated JPF config for $fqcn"
java -jar /tmp/jpf-core/build/RunJPF.jar $dir/$classname.jpf --enable-preview
done

0 comments on commit c4e09ad

Please sign in to comment.