-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5d1b47
commit c4e09ad
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |