Skip to content

Test-gen support #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
506505e
 added test cases related to classes pattern and matcher
lucasccordeiro Feb 22, 2017
b6c54a6
 added test cases related to string methods replaceFirst, replaceAll …
lucasccordeiro Feb 22, 2017
9e6ea68
 added character static methods for testing characters and converting…
lucasccordeiro Feb 22, 2017
0b05615
 added test cases related to sringBuilder append methods
lucasccordeiro Feb 22, 2017
5018776
 added stringBuilder methods length, setLength, capacity and ensureCa…
lucasccordeiro Feb 22, 2017
c869809
 added stringBuilder methods charAt, setCharAt, getChars and reverse
lucasccordeiro Feb 22, 2017
c7bcdf4
 added test cases related to stringBuilder constructors
lucasccordeiro Feb 22, 2017
2026b14
 added stringBuilder methods insert, delete and deleteCharAt
lucasccordeiro Feb 22, 2017
77ca2d1
 added string methods equals, equalsIgnoreCase, compareTo and regionM…
lucasccordeiro Feb 22, 2017
48a1df8
 added test cases related to string method concat
lucasccordeiro Feb 22, 2017
cd1d392
 added test cases related to string class constructors
lucasccordeiro Feb 22, 2017
f0cffa6
 added string searching methods indexOf and lastIndexOf
lucasccordeiro Feb 22, 2017
b5d6a13
 added string methods length, position, replace, toUpperCase, toLower…
lucasccordeiro Feb 22, 2017
ccf8410
 added test cases related to string startsWith and endsWith
lucasccordeiro Feb 22, 2017
846f168
 added test cases related to string valueOf methods
lucasccordeiro Feb 22, 2017
47dbc2e
 added test cases related to string class substring methods
lucasccordeiro Feb 22, 2017
b8f2f5a
 added test cases related to StringTokenizer object used to tokenize …
lucasccordeiro Feb 22, 2017
02df7f1
 added test cases related to validate data from user using the Valida…
lucasccordeiro Feb 22, 2017
4fc5780
cleanup aa-path-symex and aa-symex
Feb 27, 2017
fdd8121
Fix failing travis tests after removal of aa-symex.
Feb 27, 2017
895f8a6
Skip already-loaded Java classes
smowton Oct 24, 2016
777d52e
Convert Java methods only when they have a caller
smowton Nov 1, 2016
b7a7bfb
Remove dead global variables
smowton Nov 1, 2016
caf804e
Restrict virtual method targets to known-created types
smowton Nov 2, 2016
6e1133d
Mark all classes in root jar reachable if it doesn't declare a main f…
smowton Nov 21, 2016
49bfea4
Add this-parameter before determining needed classes
smowton Nov 23, 2016
e12448b
Lazy method conversion: load callee parent classes
smowton Nov 30, 2016
d20bdc6
Always assume String, Class and Object are callable
smowton Jan 17, 2017
93af038
Don't try to call an abstract function
smowton Jan 17, 2017
21decbb
Make lazy method loading optional
smowton Jan 25, 2017
2f47cba
Add CBMC lazy-methods parameter
smowton Feb 6, 2017
311806e
Document lazy methods
smowton Feb 9, 2017
4910520
Style fixes
smowton Feb 9, 2017
9474d56
Add lazy loading tests
smowton Feb 9, 2017
5c5bd7a
Improve code style
smowton Feb 13, 2017
86bef23
Use safe pointers for optional arguments
smowton Feb 15, 2017
ffef5d7
Add lazy conversion documentation
smowton Feb 15, 2017
a30720b
Improve failed test printer
smowton Feb 15, 2017
8809a4c
Remove aa-symex from DIRS variable in Makefile
Feb 28, 2017
6c0ff32
Don't allowing functions called from _Start to be inlined
Nov 29, 2016
d47d503
Get symbol of member expression
dcattaruzza Oct 25, 2016
27153d1
Auxiliary function to check if the ssa has enough data to build an id…
dcattaruzza Oct 25, 2016
2987406
Bitwise operators for mpinteger
dcattaruzza Oct 25, 2016
d81dd75
Auxiliary function to retrieve tail of trace and added dead command t…
dcattaruzza Oct 25, 2016
7fb8174
Fix arithmetic shift operators
smowton Jan 13, 2017
fb616c5
Added a new class for handling the internals
Jan 16, 2017
fc756f3
Adding more symbols that should be excluded
Jan 16, 2017
2f5b866
Autocomplete script for bash
forejtv Jan 20, 2017
d485c88
Factor class identifier extraction out of remove virtuals
smowton Jan 25, 2017
99eb1a0
Discover lexical scopes for anonymous variables
smowton Jan 24, 2017
7ac505d
loop unwinding in static init of Java enum
mgudemann Jan 20, 2017
0cf34af
Support for Java assume
cristina-david Feb 9, 2017
1436e39
Regression tests for Java assume
cristina-david Feb 9, 2017
5c30907
Remove assume as coverage target
cristina-david Sep 20, 2016
e55f20b
output covered lines as CSV in show_properties
Feb 1, 2017
2ae1f47
compress list of lines into line ranges
Feb 13, 2017
f5f47a7
add regression test for coverage lines
Feb 15, 2017
02d2b9d
fix problem with missing comma / range fix for reaching end
Feb 17, 2017
b7d828b
Updated dump-C to use the new class
Jan 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ script:
make -C src minisat2-download &&
make -C src CXX=$COMPILER CXXFLAGS="-Wall -O2 -g -Werror -Wno-deprecated-register -pedantic -Wno-sign-compare" -j2 &&
env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test &&
make -C src CXX=$COMPILER CXXFLAGS=$FLAGS -j2 aa-symex.dir cegis.dir clobber.dir memory-models.dir musketeer.dir
make -C src CXX=$COMPILER CXXFLAGS=$FLAGS -j2 cegis.dir clobber.dir memory-models.dir musketeer.dir
Binary file added regression/cbmc-java/assume1/Assume1.class
Binary file not shown.
10 changes: 10 additions & 0 deletions regression/cbmc-java/assume1/Assume1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.cprover.CProver;

class Assume1
{
static void foo(int x)
{
CProver.assume(x>3);
assert x>0;
}
}
8 changes: 8 additions & 0 deletions regression/cbmc-java/assume1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
Assume1.class
--function Assume1.foo
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file added regression/cbmc-java/assume2/Assume2.class
Binary file not shown.
10 changes: 10 additions & 0 deletions regression/cbmc-java/assume2/Assume2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.cprover.CProver;

class Assume2
{
static void foo(int x)
{
CProver.assume(x>3);
assert x>4;
}
}
8 changes: 8 additions & 0 deletions regression/cbmc-java/assume2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
Assume2.class
--function Assume2.foo
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
--
^warning: ignoring
Binary file added regression/cbmc-java/assume3/Assume3.class
Binary file not shown.
10 changes: 10 additions & 0 deletions regression/cbmc-java/assume3/Assume3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.cprover.CProver;

class Assume3
{
public static void main(String[] args)
{
CProver.assume(false);
assert false;
}
}
8 changes: 8 additions & 0 deletions regression/cbmc-java/assume3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
Assume3.class

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file added regression/cbmc-java/covered1/covered1.class
Binary file not shown.
37 changes: 37 additions & 0 deletions regression/cbmc-java/covered1/covered1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
public class covered1
{
// this is a variable
int x=1;
//these are two, one line off the first
int y=2;
int z=3;
//this is part of static init
static int z0=0;

//another non-static
int a;
int b;
static boolean odd;

static
{
odd=(z0+1)%2==0;
}

covered1(int a, int b)
{
this.a=a*b;
this.b=a+b;
if(this.a==a)
z0++;
else
odd=!odd;
}
// at the back
int z1=2;
int z2=3;
int z3=4;
//
static int z4=5;
int z5=5;
}
19 changes: 19 additions & 0 deletions regression/cbmc-java/covered1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CORE
covered1.class
--cover location --json-ui --show-properties
^EXIT=0$
^SIGNAL=0$
.*\"coveredLines\": \"22\",$
.*\"coveredLines\": \"4,6,7,23-25,31-33,36\",$
.*\"coveredLines\": \"26\",$
.*\"coveredLines\": \"28\",$
.*\"coveredLines\": \"28\",$
.*\"coveredLines\": \"28\",$
.*\"coveredLines\": \"28\",$
.*\"coveredLines\": \"29\",$
.*\"coveredLines\": \"9,18\",$
.*\"coveredLines\": \"18\",$
.*\"coveredLines\": \"18\",$
.*\"coveredLines\": \"18,35\",$
--
^warning: ignoring
Binary file added regression/cbmc-java/lazyloading1/A.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading1/B.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading1/test.class
Binary file not shown.
8 changes: 8 additions & 0 deletions regression/cbmc-java/lazyloading1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
test.class
--lazy-methods --verbosity 10 --function test.main
^EXIT=0$
^SIGNAL=0$
elaborate java::A\.f:\(\)V
--
elaborate java::B\.g:\(\)V
21 changes: 21 additions & 0 deletions regression/cbmc-java/lazyloading1/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// The most basic lazy loading test: A::f is directly called, B::g should be unreachable

public class test
{
A a;
B b;
public static void main()
{
A.f();
}
}

class A
{
public static void f() {}
}

class B
{
public static void g() {}
}
Binary file added regression/cbmc-java/lazyloading2/A.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading2/B.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading2/test.class
Binary file not shown.
8 changes: 8 additions & 0 deletions regression/cbmc-java/lazyloading2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
test.class
--lazy-methods --verbosity 10 --function test.main
^EXIT=0$
^SIGNAL=0$
elaborate java::A\.f:\(\)V
--
elaborate java::B\.g:\(\)V
23 changes: 23 additions & 0 deletions regression/cbmc-java/lazyloading2/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This test checks that because A is instantiated in main and B is not,
// A::f is reachable and B::g is not

public class test
{
A a;
B b;
public static void main()
{
A a = new A();
a.f();
}
}

class A
{
public void f() {}
}

class B
{
public void g() {}
}
Binary file added regression/cbmc-java/lazyloading3/A.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading3/B.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading3/C.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading3/D.class
Binary file not shown.
Binary file added regression/cbmc-java/lazyloading3/test.class
Binary file not shown.
8 changes: 8 additions & 0 deletions regression/cbmc-java/lazyloading3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
test.class
--lazy-methods --verbosity 10 --function test.main
^EXIT=0$
^SIGNAL=0$
elaborate java::A\.f:\(\)V
--
elaborate java::B\.g:\(\)V
30 changes: 30 additions & 0 deletions regression/cbmc-java/lazyloading3/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This test checks that because `main` has a parameter of type C, which has a field of type A,
// A::f is considered reachable, but B::g is not.

public class test
{
public static void main(C c)
{
c.a.f();
}
}

class A
{
public void f() {}
}

class B
{
public void g() {}
}

class C
{
A a;
}

class D
{
B b;
}
22 changes: 12 additions & 10 deletions regression/failed-tests-printer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@

open LOG,"<tests.log" or die "Failed to open tests.log\n";

my $ignore = 1;
my $printed_this_test = 1;
my $current_test = "";

while (<LOG>) {
chomp;
if (/^Test '(.+)'/) {
$current_test = $1;
$ignore = 0;
} elsif (1 == $ignore) {
next;
$printed_this_test = 0;
} elsif (/\[FAILED\]\s*$/) {
$ignore = 1;
print "Failed test: $current_test\n";
my $outf = `sed -n '2p' $current_test/test.desc`;
$outf =~ s/\..*$/.out/;
system("cat $current_test/$outf");
print "\n\n";
if(0 == $printed_this_test) {
$printed_this_test = 1;
print "\n\n";
print "Failed test: $current_test\n";
my $outf = `sed -n '2p' $current_test/test.desc`;
$outf =~ s/\..*$/.out/;
system("cat $current_test/$outf");
print "\n\nFailed test.desc lines:\n";
}
print "$_\n";
}
}

Binary file not shown.
25 changes: 25 additions & 0 deletions regression/strings/RegexMatches01/RegexMatches01.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches01
{
public static void main(String[] args)
{
Pattern expression =
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d");

String string1 = "XXXX's Birthday is 05-12-75\n" +
"YYYY's Birthday is 11-04-68\n" +
"ZZZZ's Birthday is 04-28-73\n" +
"WWWW's Birthday is 12-17-77";

Matcher matcher = expression.matcher(string1);

while (matcher.find())
{
System.out.println(matcher.group());
String tmp=matcher.group();
assert tmp.equals("WWWW's Birthday is 12-17-77");
}
}
}
8 changes: 8 additions & 0 deletions regression/strings/RegexMatches01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
RegexMatches01.class
--string-refine --unwind 100
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file not shown.
25 changes: 25 additions & 0 deletions regression/strings/RegexMatches02/RegexMatches02.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches02
{
public static void main(String[] args)
{
Pattern expression =
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d");

String string1 = "XXXX's Birthday is 05-12-75\n" +
"YYYY's Birthday is 11-04-68\n" +
"ZZZZ's Birthday is 04-28-73\n" +
"WWWW's Birthday is 12-17-77";

Matcher matcher = expression.matcher(string1);

while (matcher.find())
{
System.out.println(matcher.group());
String tmp=matcher.group();
assert tmp.equals("WWWWW's Birthday is 12-17-77");
}
}
}
8 changes: 8 additions & 0 deletions regression/strings/RegexMatches02/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
RegexMatches02.class
--string-refine --unwind 100
^EXIT=0$
^SIGNAL=0$
^VERIFICATION FAILED$
--
^warning: ignoring
Binary file not shown.
39 changes: 39 additions & 0 deletions regression/strings/RegexSubstitution01/RegexSubstitution01.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import java.util.Arrays;

public class RegexSubstitution01
{
public static void main(String[] args)
{
String firstString = "DiffBlue ***";
String secondString = "Automatic Test Case Generation";

firstString = firstString.replaceAll("\\*", "^");

assert firstString.equals("DiffBlue ^^^");

secondString = secondString.replaceAll("Automatic", "Automated");

System.out.printf(
"\"Automatic\" substituted for \"Automated\": %s\n", secondString);
secondString.equals("Automated Test Case Generation");

System.out.printf("Every word replaced by \"word\": %s\n\n",
firstString.replaceAll("\\w+", "word"));

System.out.printf("Original String 2: %s\n", secondString);
secondString.equals("Automated Test Case Generation");

for (int i = 0; i < 3; i++)
secondString = secondString.replaceFirst("\\A", "automated");

assert secondString.equals("automatedautomatedautomatedAutomated Test Case Generation");

System.out.print("String split at commas: ");
String[] results = secondString.split(" \\s*");
System.out.println(Arrays.toString(results));
assert results[0].equals("automatedautomatedautomatedAutomated");
assert results[1].equals("Test");
assert results[2].equals("Case");
assert results[3].equals("Generation");
}
}
8 changes: 8 additions & 0 deletions regression/strings/RegexSubstitution01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
RegexSubstitution01.class
--string-refine
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file not shown.
Loading