Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
cwe_checker
Commits
fd91fb5c
Unverified
Commit
fd91fb5c
authored
4 years ago
by
Melvin Klimke
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended cconv tests (#69)
parent
111ab158
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
3 deletions
+38
-3
cconv.ml
src/utils/cconv.ml
+3
-1
Makefile
test/unit/Makefile
+7
-1
unit_tests_cwe_checker.ml
test/unit/unit_tests_cwe_checker.ml
+22
-1
cconv_test.ml
test/unit/utils/cconv_test.ml
+0
-0
cconv_test.mli
test/unit/utils/cconv_test.mli
+6
-0
No files found.
src/utils/cconv.ml
View file @
fd91fb5c
...
...
@@ -79,7 +79,9 @@ let get_register_list (project : Project.t) (context : string) : string list =
let
arch
=
match
bap_arch
with
|
"i386"
|
"i686"
->
"x86"
|
"powerpc"
->
"ppc"
|
_
->
bap_arch
in
|
"powerpc64"
->
"ppc64"
|
"powerpc64le"
->
"ppc64le"
|
_
->
bap_arch
in
match
Stdlib
.
List
.
mem
arch
(
get_supported_architectures
()
)
with
|
true
->
begin
let
json_bin
=
Json_utils
.
get_bin_format_from_json
(
get_json
()
)
(
extract_bin_format
project
)
in
...
...
This diff is collapsed.
Click to expand it.
test/unit/Makefile
View file @
fd91fb5c
...
...
@@ -2,7 +2,13 @@ all:
bapbundle remove unit_tests_cwe_checker.plugin
bapbuild
-r
-Is
analysis,checkers,utils unit_tests_cwe_checker.plugin
-pkgs
alcotest,yojson,unix,ppx_jane,cwe_checker_core
bapbundle install unit_tests_cwe_checker.plugin
bap tmp/arrays_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
MemRegion,Cconv,TypeInference,CWE476
bap tmp/arrays_x86_64-w64-mingw32_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_i686-w64-mingw32_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_x86_clang.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_arm_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_mips64_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_powerpc_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
Cconv
bap tmp/arrays_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
MemRegion,TypeInference,CWE476
bap tmp/c_constructs_gcc.out
--pass
=
unit-tests-cwe-checker
--unit-tests-cwe-checker-tests
=
CWE560,AddrTrans
bapbundle remove unit_tests_cwe_checker.plugin
...
...
This diff is collapsed.
Click to expand it.
test/unit/unit_tests_cwe_checker.ml
View file @
fd91fb5c
...
...
@@ -37,11 +37,32 @@ let unit_test_list = [
]
let
check_for_cconv
(
project
:
Project
.
t
)
(
arch
:
string
)
=
match
arch
with
|
"i386"
|
"i686"
->
Cconv_test
.
example_cconv
:=
Project
.
get
project
Bap_abi
.
name
|
_
->
()
let
get_test_bin_format
(
project
:
Project
.
t
)
=
let
filename
=
match
(
Project
.
get
project
filename
)
with
|
Some
(
f
)
->
f
|
_
->
failwith
"Test file has no file name"
in
match
String
.
is_substring
filename
~
substring
:
"mingw32"
with
|
true
->
"pe"
|
false
->
"elf"
let
set_example_project
(
project
:
Project
.
t
)
(
tests
:
string
list
)
=
let
arch
=
Arch
.
to_string
(
Project
.
arch
project
)
in
List
.
iter
tests
~
f
:
(
fun
test
->
match
test
with
|
"TypeInference"
->
Type_inference_test
.
example_project
:=
Some
(
project
)
|
"Cconv"
->
Cconv_test
.
example_project
:=
Some
(
project
)
|
"Cconv"
->
begin
Cconv_test
.
example_project
:=
Some
(
project
);
Cconv_test
.
example_arch
:=
Some
(
arch
);
check_for_cconv
project
arch
;
Cconv_test
.
example_bin_format
:=
Some
(
get_test_bin_format
project
)
end
|
"CWE476"
->
Cwe_476_test
.
example_project
:=
Some
(
project
)
|
_
->
()
)
...
...
This diff is collapsed.
Click to expand it.
test/unit/utils/cconv_test.ml
View file @
fd91fb5c
This diff is collapsed.
Click to expand it.
test/unit/utils/cconv_test.mli
View file @
fd91fb5c
...
...
@@ -4,4 +4,10 @@ open Core_kernel
val
example_project
:
Project
.
t
option
ref
val
example_cconv
:
string
option
ref
val
example_arch
:
string
option
ref
val
example_bin_format
:
string
option
ref
val
tests
:
unit
Alcotest
.
test_case
list
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment