Skip to content

Commit e656833

Browse files
authored
Merge branch 'epfl-lara:master' into master
2 parents 61ad97f + 358d3f1 commit e656833

File tree

14 files changed

+121
-20
lines changed

14 files changed

+121
-20
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: scala-smtlib CI
2+
on: [push, pull_request]
3+
jobs:
4+
tests:
5+
# the CI is small enough that we can run on draft PRs as well without issue
6+
# if: github.event.pull_request.draft == false
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
java-version: [ 17, 21 ]
11+
env:
12+
# define Java options for both official sbt and sbt-extras
13+
JAVA_OPTS: -Xss64M -Xms1024M -Xmx8G
14+
JVM_OPTS: -Xss64M -Xms1024M -Xmx8G
15+
# solver versions to test against
16+
Z3_VER: 4.15.1
17+
CVC4_VER: 1.8
18+
CVC5_VER: 1.2.1
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
- name: Setup JDK
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: temurin
28+
java-version: ${{ matrix.java-version }}
29+
- name: Install and unpack sbt
30+
run: |
31+
./scripts/install_sbt.sh
32+
echo "PATH=./sbt/bin/:$PATH" >> "$GITHUB_ENV"
33+
- name: Install solvers
34+
run: ./scripts/install_solvers.sh $GITHUB_WORKSPACE/.local/bin $Z3_VER $CVC4_VER $CVC5_VER
35+
- name: Add solvers to PATH
36+
run: echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
37+
- name: Test solvers availability
38+
run: cvc5 --version && z3 --version && cvc4 --version
39+
- name: Run Tests
40+
run: sbt -Dtest-parallelism=10 -batch test
41+
- name: Run integration tests
42+
run: sbt -Dtest-parallelism=10 -batch it:test
43+
- name: Clean up
44+
run: rm -rf $JAVA_OPTS_TMP_DIR

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Test / parallelExecution := true
1818
lazy val commonSettings = Seq(
1919
organization := "com.regblanc",
2020
name := "scala-smtlib",
21-
scalaVersion := "3.3.0",
21+
scalaVersion := "3.7.0",
2222
)
2323

2424
lazy val root = (project in file(".")).

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.7.3
1+
sbt.version=1.11.1

scripts/install_sbt.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env sh
2+
3+
SBT_VER="$(grep 'sbt.version' project/build.properties | cut -d= -f2)"
4+
if [ -z "$SBT_VER" ]; then
5+
echo "sbt.version not found in project/build.properties"
6+
exit 1
7+
fi
8+
wget -c https://github.com/sbt/sbt/releases/download/v${SBT_VER}/sbt-${SBT_VER}.tgz -q
9+
tar xfz "sbt-${SBT_VER}.tgz"

scripts/install_solvers.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env sh
2+
3+
TEMP_DIR="$(pwd)/temp"
4+
SOLVERS_DIR=${1:-"$(pwd)/solvers"}
5+
6+
Z3_VER=${2:-"4.15.1"}
7+
CVC4_VER=${3:-"1.8"}
8+
CVC5_VER=${4:-"1.2.1"}
9+
10+
ARCH=$(uname -m)
11+
# short arch name as used by z3 builds
12+
SHORT_ARCH=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/;')
13+
14+
# libc linked against z3
15+
# (glibc for Linux, osx for macOS)
16+
LIBC_NAME=$(uname -s | tr '[:upper:]' '[:lower:]' | sed 's/darwin/osx/;s/linux/glibc/;')
17+
18+
mkdir -p "$SOLVERS_DIR"
19+
mkdir -p "$TEMP_DIR"
20+
# cvc5
21+
wget -c "https://github.com/cvc5/cvc5/releases/download/cvc5-${CVC5_VER}/cvc5-Linux-${ARCH}-static.zip" -O "$TEMP_DIR/cvc5.zip" -q
22+
unzip "$TEMP_DIR/cvc5.zip" -d "$TEMP_DIR"
23+
CVC5_DIR=$(find "$TEMP_DIR" -mindepth 1 -maxdepth 1 -type d -name "*cvc5*")
24+
mv "$CVC5_DIR/bin/cvc5" "$SOLVERS_DIR/cvc5"
25+
chmod +x "$SOLVERS_DIR/cvc5"
26+
rm -rf "$TEMP_DIR"
27+
28+
# # CVC4
29+
wget -c "https://cvc4.cs.stanford.edu/downloads/builds/x86_64-linux-opt/cvc4-${CVC4_VER}-x86_64-linux-opt" -O "$SOLVERS_DIR/cvc4" -q
30+
chmod +x "$SOLVERS_DIR/cvc4"
31+
32+
# z3
33+
mkdir -p "$TEMP_DIR"
34+
Z3_FILE_PREFIX="z3-${Z3_VER}-${SHORT_ARCH}-${LIBC_NAME}"
35+
Z3_URL=$(
36+
curl -s "https://api.github.com/repos/Z3Prover/z3/releases/tags/z3-${Z3_VER}" | # get release info
37+
grep "browser_download_url.*${Z3_FILE_PREFIX}" | #| # find url for the correct build
38+
sed 's/^.*: //;s/^"//;s/"$//' # strip non-url
39+
)
40+
wget -c "${Z3_URL}" -O "$TEMP_DIR/z3.zip" -q
41+
unzip "$TEMP_DIR/z3.zip" -d "$TEMP_DIR"
42+
Z3_DIR=$(find "$TEMP_DIR" -mindepth 1 -maxdepth 1 -type d -name "*z3*")
43+
mv "$Z3_DIR/bin/z3" "$SOLVERS_DIR/z3"
44+
chmod +x "$SOLVERS_DIR/z3"
45+
rm -rf "$TEMP_DIR"
46+
47+
echo "************** Solvers Installed **************"
48+
exit 0

src/main/scala/smtlib/common/Positions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ case class Position(line: Int, col: Int) extends Ordered[Position] {
3232
*/
3333
trait Positioned {
3434

35-
private[this] var _pos: Option[Position] = None
35+
private var _pos: Option[Position] = None
3636

3737
def setPos(pos: Position): this.type = {
3838
_pos = Some(pos)

src/main/scala/smtlib/interpreters/ProcessInterpreter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ object ProcessInterpreter {
130130
private def ctorHelper(executable: String,
131131
args: Array[String],
132132
parserCtor: BufferedReader => Parser): (Parser, Process, BufferedWriter, BufferedReader, BufferedReader) = {
133-
val process = java.lang.Runtime.getRuntime.exec((executable :: args.toList).mkString(" "))
133+
val process = java.lang.Runtime.getRuntime.exec(executable +: args)
134134
val in = new BufferedWriter(new OutputStreamWriter(process.getOutputStream))
135135
val out = new BufferedReader(new InputStreamReader(process.getInputStream))
136136
val err = new BufferedReader(new InputStreamReader(process.getErrorStream))

src/main/scala/smtlib/parser/ParserCommands.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import trees.Commands._
77

88
import scala.collection.mutable.ListBuffer
99

10-
trait ParserCommands { this: ParserCommon with ParserTerms =>
10+
trait ParserCommands { this: ParserCommon & ParserTerms =>
1111

1212
import Parser._
1313

src/main/scala/smtlib/parser/ParserCommandsResponses.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import trees.CommandsResponses._
77

88
import scala.collection.mutable.ListBuffer
99

10-
trait ParserCommandsResponses { this: ParserCommon with ParserTerms with ParserCommands =>
10+
trait ParserCommandsResponses { this: ParserCommon & ParserTerms & ParserCommands =>
1111

1212
import Parser._
1313

src/main/scala/smtlib/parser/ParserCommon.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ trait ParserCommon {
164164
case Tokens.StringLitKind => parseString
165165
case Tokens.SymbolLitKind => parseSymbol
166166
case Tokens.OParen => parseSList
167-
case _ => expected(peekToken, attributeValuesTokenKinds:_*)
167+
case _ => expected(peekToken, attributeValuesTokenKinds*)
168168
}
169169
}
170170
def tryParseAttributeValue: Option[AttributeValue] = {

0 commit comments

Comments
 (0)