forked from cvc5/cvc5
-
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.
(Java) Added test cases for sosy-lab/java-smt#310
- Loading branch information
1 parent
ee6fab5
commit de8dc61
Showing
4 changed files
with
159 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
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,52 @@ | ||
/****************************************************************************** | ||
* Test for JavaSMT bug #310 | ||
* https://github.com/sosy-lab/java-smt/issues/310 | ||
*/ | ||
|
||
package tests; | ||
|
||
import io.github.cvc5.*; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.Future; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class JavaSmtParallelBug1 { | ||
@Test | ||
public void javaSmtParallelBug1Broken() throws InterruptedException, ExecutionException { | ||
Solver solver = new Solver(); | ||
|
||
ExecutorService exec = Executors.newSingleThreadExecutor(); | ||
Future<?> result = | ||
exec.submit( | ||
() -> { | ||
// FIXME: SEGFAULT (without -ea) | ||
// Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) | ||
// C [libcvc5.so.1+0x5e44c2] cvc5::Solver::getBooleanSort() const+0x12 | ||
// Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) | ||
// j io.github.cvc5.Solver.getBooleanSort(J)J+0 | ||
// j io.github.cvc5.Solver.getBooleanSort()Lio/github/cvc5/Sort;+5 | ||
// j tests.JavaSmtParallelBug1.lambda$bug1$0(Lio/github/cvc5/Solver;)Ljava/lang/Object;+1 | ||
|
||
// FIXME: ABORT (with -ea) | ||
// Fatal failure within | ||
// static cvc5::internal::TypeNode | ||
// cvc5::internal::expr::TypeChecker::computeType( | ||
// cvc5::internal::NodeManager*, | ||
// cvc5::internal::TNode, | ||
// bool, | ||
// std::ostream* | ||
// ) | ||
// at /home/daniel/workspace/cvc5/build/src/expr/type_checker.cpp:2828 | ||
// Unhandled case encountered VARIABLE | ||
Sort sortBool = solver.getBooleanSort(); | ||
return null; | ||
}); | ||
|
||
assert result.get() == null; | ||
solver.deletePointer(); | ||
} | ||
} |
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,45 @@ | ||
/****************************************************************************** | ||
* Test for JavaSMT bug #310 | ||
* https://github.com/sosy-lab/java-smt/issues/310 | ||
*/ | ||
|
||
package tests; | ||
|
||
import io.github.cvc5.*; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.Future; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class JavaSmtParallelBug2 { | ||
@Test | ||
public void javaSmtParallelBug2Broken() throws InterruptedException, ExecutionException { | ||
Solver solver = new Solver(); | ||
Term formula = solver.mkFalse(); | ||
|
||
ExecutorService executor = Executors.newSingleThreadExecutor(); | ||
Future<?> result = | ||
executor.submit( | ||
() -> { | ||
Solver prover = new Solver(); | ||
|
||
// FIXME: Exception (only with -ea) | ||
// io.github.cvc5.CVC5ApiException: | ||
// Given term is not associated with the node manager of this solver | ||
// at io.github.cvc5.Solver.assertFormula(Native Method) | ||
// at io.github.cvc5.Solver.assertFormula(Solver.java:1511) | ||
// at org.sosy_lab.java_smt.solvers.cvc5.CVC5NativeAPITest | ||
// at ..here | ||
prover.assertFormula(formula); | ||
|
||
prover.deletePointer(); | ||
return null; | ||
}); | ||
|
||
assert result.get() == null; | ||
solver.deletePointer(); | ||
} | ||
} |
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,55 @@ | ||
/****************************************************************************** | ||
* Test for JavaSMT bug #310 | ||
* https://github.com/sosy-lab/java-smt/issues/350 | ||
*/ | ||
|
||
package tests; | ||
|
||
import io.github.cvc5.*; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.Future; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class JavaSmtParallelBug3 { | ||
@Test | ||
public void javaSmtParallelBug3Broken() throws InterruptedException, ExecutionException { | ||
Solver solver = new Solver(); | ||
Term varA = solver.mkConst(solver.getBooleanSort(), "a"); | ||
|
||
solver.assertFormula(varA); | ||
|
||
ExecutorService exec = Executors.newSingleThreadExecutor(); | ||
Future<?> task1 = | ||
exec.submit( | ||
() -> { | ||
// FIXME: SEGFAULT (without -ea) | ||
// Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) | ||
// C [libcvc5.so.1+0x5fb5e6] cvc5::Solver::push(unsigned int) const+0x36 | ||
// Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) | ||
// j io.github.cvc5.Solver.push(JI)V+0 | ||
// j io.github.cvc5.Solver.push(I)V+13 | ||
// j io.github.cvc5.Solver.push()V+2 | ||
|
||
// FIXME: SIGABRT (with -ea) | ||
// Fatal failure within | ||
// static cvc5::internal::TypeNode | ||
// cvc5::internal::expr::TypeChecker::computeType( | ||
// cvc5::internal::NodeManager*, | ||
// cvc5::internal::TNode, | ||
// bool, | ||
// std::ostream* | ||
// ) | ||
// at /home/daniel/workspace/cvc5/build/src/expr/type_checker.cpp:2828 | ||
// Unhandled case encountered VARIABLE | ||
solver.push(); | ||
return null; | ||
}); | ||
|
||
assert task1.get() == null; | ||
solver.deletePointer(); | ||
} | ||
} |