Skip to content

Commit a17900e

Browse files
committed
aws_hash_ptr + aws_hash_c_string
1 parent faeb95b commit a17900e

File tree

6 files changed

+122
-0
lines changed

6 files changed

+122
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use
4+
# this file except in compliance with the License. A copy of the License is
5+
# located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed on an
10+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11+
# implied. See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
###########
15+
MAX_STRING_SIZE ?= 4
16+
DEFINES += -DMAX_STRING_SIZE=$(MAX_STRING_SIZE)
17+
18+
UNWINDSET += strlen.0:$(shell echo $$(( $(MAX_STRING_SIZE) + 1)))
19+
20+
21+
CBMCFLAGS +=
22+
23+
DEPENDENCIES += $(HELPERDIR)/source/make_common_data_structures.c
24+
DEPENDENCIES += $(HELPERDIR)/source/proof_allocators.c
25+
DEPENDENCIES += $(HELPERDIR)/source/utils.c
26+
DEPENDENCIES += $(HELPERDIR)/stubs/error.c
27+
DEPENDENCIES += $(SRCDIR)/source/common.c
28+
DEPENDENCIES += $(SRCDIR)/source/hash_table.c
29+
30+
ENTRY = aws_hash_c_string_harness
31+
###########
32+
33+
include ../Makefile.common
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is
6+
* located at
7+
*
8+
* http://aws.amazon.com/apache2.0/
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed on an
11+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
* implied. See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
#include <aws/common/hash_table.h>
17+
#include <aws/common/private/hash_table_impl.h>
18+
#include <proof_helpers/make_common_data_structures.h>
19+
#include <proof_helpers/proof_allocators.h>
20+
#include <proof_helpers/utils.h>
21+
22+
void aws_hash_c_string_harness() {
23+
const char* str = make_arbitrary_c_str(MAX_STRING_SIZE);
24+
/* This function has no pre or post conditions */
25+
uint64_t rval = aws_hash_c_string(str);
26+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
jobos: ubuntu16
2+
cbmcflags: "--bounds-check;--div-by-zero-check;--float-overflow-check;--nan-check;--pointer-check;--pointer-overflow-check;--signed-overflow-check;--undefined-shift-check;--unsigned-overflow-check;--unwind;1;--unwinding-assertions;--unwindset;strlen.0:5;--object-bits;8"
3+
goto: aws_hash_c_string_harness.goto
4+
expected: "SUCCESSFUL"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use
4+
# this file except in compliance with the License. A copy of the License is
5+
# located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed on an
10+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11+
# implied. See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
###########
15+
16+
CBMCFLAGS +=
17+
18+
DEPENDENCIES += $(HELPERDIR)/source/utils.c
19+
DEPENDENCIES += $(HELPERDIR)/stubs/error.c
20+
DEPENDENCIES += $(SRCDIR)/source/common.c
21+
DEPENDENCIES += $(SRCDIR)/source/hash_table.c
22+
23+
ENTRY = aws_hash_ptr_harness
24+
###########
25+
26+
include ../Makefile.common
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is
6+
* located at
7+
*
8+
* http://aws.amazon.com/apache2.0/
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed on an
11+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
* implied. See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
#include <aws/common/hash_table.h>
17+
#include <aws/common/private/hash_table_impl.h>
18+
#include <proof_helpers/make_common_data_structures.h>
19+
#include <proof_helpers/proof_allocators.h>
20+
#include <proof_helpers/utils.h>
21+
22+
/**
23+
* Runtime: 4.5s
24+
*/
25+
void aws_hash_ptr_harness() {
26+
void* ptr;
27+
/* This function has no pre or post conditions */
28+
uint64_t rval = aws_hash_ptr(ptr);
29+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
jobos: ubuntu16
2+
cbmcflags: "--bounds-check;--div-by-zero-check;--float-overflow-check;--nan-check;--pointer-check;--pointer-overflow-check;--signed-overflow-check;--undefined-shift-check;--unsigned-overflow-check;--unwind;1;--unwinding-assertions;--object-bits;8"
3+
goto: aws_hash_ptr_harness.goto
4+
expected: "SUCCESSFUL"

0 commit comments

Comments
 (0)