CBMC for Java regression testing

git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@2533 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
This commit is contained in:
kroening 2013-06-02 08:27:37 +00:00
parent 0300b522b0
commit f524dc1cdf
10 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,14 @@
default: tests.log
test:
@../test.pl -c ../../../src/cbmc/cbmc
tests.log: ../test.pl
@../test.pl -c ../../../src/cbmc/cbmc
show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.java" "$$dir/*.out"; \
fi; \
done;

Binary file not shown.

View File

@ -0,0 +1,13 @@
class assert1
{
public static void main(String[] args)
{
java.util.Random random = new java.util.Random(42);
int i=random.nextInt();
if(i>=10)
assert i>=20; // should hold
}
}

View File

@ -0,0 +1,8 @@
CORE
assert1.class
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring

Binary file not shown.

View File

@ -0,0 +1,13 @@
class assert2
{
public static void main(String[] args)
{
java.util.Random random = new java.util.Random(42);
int i=random.nextInt();
if(i>=1000)
assert i>1000; // should fail
}
}

View File

@ -0,0 +1,8 @@
CORE
helloworld.class
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring

View File

@ -0,0 +1,8 @@
CORE
basic.class
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring

View File

@ -0,0 +1,8 @@
CORE
loop1.class
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring

View File

@ -54,7 +54,7 @@ sub test($$$$$) {
$options =~ s/$ign//g if(defined($ign)); $options =~ s/$ign//g if(defined($ign));
my $output = $input; my $output = $input;
$output =~ s/\.(c|i|cpp|ii|xml)$/.out/; $output =~ s/\.(c|i|cpp|ii|xml|class)$/.out/;
if($output eq $input) { if($output eq $input) {
print("Error in test file -- $test\n"); print("Error in test file -- $test\n");
@ -169,7 +169,7 @@ follows the format specified below. Any line starting with // will be ignored.
where where
<level> is one of CORE, THOROUGH, FUTURE or KNOWNBUG <level> is one of CORE, THOROUGH, FUTURE or KNOWNBUG
<main source> is a file with extension .c/.i/.cpp/.ii/.xml <main source> is a file with extension .c/.i/.cpp/.ii/.xml/.class
<options> additional options to be passed to CMD <options> additional options to be passed to CMD
<required patterns> one or more lines of regualar expressions that must occur in the output <required patterns> one or more lines of regualar expressions that must occur in the output
<disallowed patterns> one or more lines of expressions that must not occur in output <disallowed patterns> one or more lines of expressions that must not occur in output