Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fact_pdf_report
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
fact_pdf_report
Commits
8e6defeb
Commit
8e6defeb
authored
Jul 17, 2019
by
dorp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary script and fix test
parent
697fc7db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
63 deletions
+1
-63
report.py
report.py
+0
-62
test_generator.py
test/unit/test_generator.py
+1
-1
No files found.
report.py
deleted
100755 → 0
View file @
697fc7db
#!/usr/bin/env python3
'''
fact_pdf_report
Copyright (C) 2015-2019 Fraunhofer FKIE
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import
argparse
import
logging
import
sys
from
common_helper_files
import
create_dir_for_file
from
pdf_generator.generator
import
generate_report
PROGRAM_NAME
=
'FACT PDF Report Generator'
PROGRAM_VERSION
=
'0.1'
PROGRAM_DESCRIPTION
=
'Generates an analysis PDF report'
def
setup_argparser
():
parser
=
argparse
.
ArgumentParser
(
description
=
'{} - {}'
.
format
(
PROGRAM_NAME
,
PROGRAM_DESCRIPTION
))
parser
.
add_argument
(
'-V'
,
'--version'
,
action
=
'version'
,
version
=
'{} {}'
.
format
(
PROGRAM_NAME
,
PROGRAM_VERSION
))
parser
.
add_argument
(
'-l'
,
'--log_file'
,
help
=
'path to log file'
)
parser
.
add_argument
(
'-L'
,
'--log_level'
,
help
=
'define the log level [DEBUG,INFO,WARNING,ERROR]'
)
parser
.
add_argument
(
'-d'
,
'--debug'
,
action
=
'store_true'
,
default
=
False
,
help
=
'print debug messages'
)
parser
.
add_argument
(
'UID'
,
help
=
'firmware analysis UID'
)
return
parser
.
parse_args
()
def
setup_logging
(
debug_flag
=
False
):
log_format
=
logging
.
Formatter
(
fmt
=
'[
%(asctime)
s][
%(module)
s][
%(levelname)
s]:
%(message)
s'
,
datefmt
=
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
logger
=
logging
.
getLogger
(
''
)
logger
.
setLevel
(
logging
.
DEBUG
)
create_dir_for_file
(
'/tmp/pdf_generator.log'
)
file_log
=
logging
.
FileHandler
(
'/tmp/pdf_generator.log'
)
file_log
.
setLevel
(
logging
.
INFO
)
file_log
.
setFormatter
(
log_format
)
logger
.
addHandler
(
file_log
)
console_log
=
logging
.
StreamHandler
()
console_log
.
setLevel
(
logging
.
DEBUG
if
debug_flag
else
logging
.
INFO
)
console_log
.
setFormatter
(
log_format
)
logger
.
addHandler
(
console_log
)
if
__name__
==
'__main__'
:
ARGS
=
setup_argparser
()
setup_logging
(
ARGS
.
debug
)
sys
.
exit
(
generate_report
(
ARGS
.
UID
))
test/unit/test_generator.py
View file @
8e6defeb
...
...
@@ -28,7 +28,7 @@ def exec_mock(*_, **__):
def
test_execute_latex
(
monkeypatch
,
tmpdir
):
monkeypatch
.
setattr
(
'pdf_generator.generator.execute_shell_command
_get_return_code
'
,
exec_mock
)
monkeypatch
.
setattr
(
'pdf_generator.generator.execute_shell_command'
,
exec_mock
)
execute_latex
(
str
(
tmpdir
))
assert
Path
(
str
(
tmpdir
),
'test'
)
.
exists
()
...
...
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