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-depend
cwe_checker
Commits
734e5f75
Commit
734e5f75
authored
Oct 28, 2020
by
Enkelmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Ghidra-based acceptance checks to CI pipeline (#91)
parent
730bc805
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
11 deletions
+22
-11
.travis_run_tests.sh
.travis_run_tests.sh
+2
-1
Cargo.toml
Cargo.toml
+1
-1
Makefile
Makefile
+5
-0
main.rs
caller/src/main.rs
+6
-9
Cargo.toml
test/Cargo.toml
+8
-0
lib.rs
test/src/lib.rs
+0
-0
No files found.
.travis_run_tests.sh
View file @
734e5f75
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
docker run
--rm
-t
cwe-checker make codestyle-check
\
docker run
--rm
-t
cwe-checker make codestyle-check
\
&&
docker run
--rm
-t
cwe-checker cargo
test
\
&&
docker run
--rm
-t
cwe-checker cargo
test
\
&&
docker run
--rm
-t
cwe-checker dune runtest
\
&&
docker run
--rm
-t
cwe-checker dune runtest
\
&&
pytest
&&
pytest
\
&&
docker run
--rm
-t
cwe-checker-ghidra cargo
test
--no-fail-fast
-p
acceptance_tests_ghidra
--
--show-output
--ignored
--test-threads
1
Cargo.toml
View file @
734e5f75
[workspace]
[workspace]
members
=
[
"cwe_checker_rs"
,
"caller"
]
members
=
[
"cwe_checker_rs"
,
"caller"
,
"test"
]
Makefile
View file @
734e5f75
...
@@ -24,10 +24,15 @@ endif
...
@@ -24,10 +24,15 @@ endif
test
:
test
:
cargo
test
cargo
test
ifeq
(,$(wildcard
${HOME}/.config/cwe_checker/ghidra.json))
cd
test/unit/
&&
./specify_test_files_for_compilation.sh
cd
test/unit/
&&
./specify_test_files_for_compilation.sh
dune
runtest
dune
runtest
cd
test/artificial_samples;
scons;
cd
../..
cd
test/artificial_samples;
scons;
cd
../..
pytest
-v
--ignore
=
_build
pytest
-v
--ignore
=
_build
else
cd
test/artificial_samples;
scons;
cd
../..
cargo
test
--no-fail-fast
-p
acceptance_tests_ghidra
--
--show-output
--ignored
endif
codestyle-check
:
codestyle-check
:
cargo fmt
--
--check
cargo fmt
--
--check
...
...
caller/src/main.rs
View file @
734e5f75
...
@@ -197,20 +197,17 @@ fn get_project_from_ghidra(file_path: &Path) -> Project {
...
@@ -197,20 +197,17 @@ fn get_project_from_ghidra(file_path: &Path) -> Project {
.unwrap
()
.unwrap
()
.as_millis
()
.as_millis
()
);
);
let
output_filename
=
format!
(
let
filename
=
file_path
"{}_{}.json"
,
.file_name
()
file_path
.expect
(
"Invalid file name"
)
.file_name
()
.to_string_lossy
();
.expect
(
"Invalid file name"
)
let
output_filename
=
format!
(
"{}_{}.json"
,
filename
,
timestamp_suffix
);
.to_string_lossy
(),
timestamp_suffix
);
let
output_path
=
tmp_folder
.join
(
output_filename
);
let
output_path
=
tmp_folder
.join
(
output_filename
);
let
ghidra_plugin_path
=
get_ghidra_plugin_path
(
"p_code_extractor"
);
let
ghidra_plugin_path
=
get_ghidra_plugin_path
(
"p_code_extractor"
);
// Execute Ghidra
// Execute Ghidra
let
output
=
Command
::
new
(
&
headless_path
)
let
output
=
Command
::
new
(
&
headless_path
)
.arg
(
&
tmp_folder
)
// The folder where temporary files should be stored
.arg
(
&
tmp_folder
)
// The folder where temporary files should be stored
.arg
(
format!
(
"PcodeExtractor_{}
"
,
timestamp_suffix
))
// The name of the temporary Ghidra Project.
.arg
(
format!
(
"PcodeExtractor_{}
_{}"
,
filename
,
timestamp_suffix
))
// The name of the temporary Ghidra Project.
.arg
(
"-import"
)
// Import a file into the Ghidra project
.arg
(
"-import"
)
// Import a file into the Ghidra project
.arg
(
file_path
)
// File import path
.arg
(
file_path
)
// File import path
.arg
(
"-postScript"
)
// Execute a script after standard analysis by Ghidra finished
.arg
(
"-postScript"
)
// Execute a script after standard analysis by Ghidra finished
...
...
test/Cargo.toml
0 → 100644
View file @
734e5f75
[package]
name
=
"acceptance_tests_ghidra"
version
=
"0.1.0"
authors
=
[
"Enkelmann <nils-edvin.enkelmann@fkie.fraunhofer.de>"
]
edition
=
"2018"
[dependencies]
colored
=
"2.0"
test/src/lib.rs
0 → 100644
View file @
734e5f75
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