Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
67cfd90b
Commit
67cfd90b
authored
Oct 29, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module.py: reorder and add tests.
parent
903d3803
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
21 deletions
+102
-21
module.py
hdlmake/module/module.py
+23
-21
Makefile.ref
testsuite/088bad_file_abs/Makefile.ref
+55
-0
Manifest.py
testsuite/088bad_file_abs/Manifest.py
+8
-0
Manifest.py
testsuite/089missing_file/Manifest.py
+8
-0
test_all.py
testsuite/test_all.py
+8
-0
No files found.
hdlmake/module/module.py
View file @
67cfd90b
...
@@ -129,6 +129,23 @@ class Module(object):
...
@@ -129,6 +129,23 @@ class Module(object):
logging
.
debug
(
"Module
%
s (parent:
%
s) is NOT fetched."
,
logging
.
debug
(
"Module
%
s (parent:
%
s) is NOT fetched."
,
url
,
self
.
parent
.
path
)
url
,
self
.
parent
.
path
)
def
process_manifest
(
self
):
"""Process the content section of the manifest_dict"""
logging
.
debug
(
"Process manifest at: "
+
os
.
path
.
dirname
(
self
.
path
))
self
.
_process_manifest_universal
()
self
.
_process_manifest_files
()
self
.
_process_manifest_modules
()
self
.
_process_manifest_makefiles
()
def
_process_manifest_universal
(
self
):
"""Method processing the universal manifest directives;
set library (inherited if not set)."""
# Libraries
if
"library"
in
self
.
manifest_dict
:
self
.
library
=
self
.
manifest_dict
[
"library"
]
elif
self
.
parent
:
self
.
library
=
self
.
parent
.
library
def
_check_filepath
(
self
,
filepath
):
def
_check_filepath
(
self
,
filepath
):
"""Check the provided filepath against several conditions"""
"""Check the provided filepath against several conditions"""
if
filepath
:
if
filepath
:
...
@@ -150,23 +167,6 @@ class Module(object):
...
@@ -150,23 +167,6 @@ class Module(object):
self
.
path
,
filepath
)
self
.
path
,
filepath
)
return
True
return
True
def
process_manifest
(
self
):
"""Process the content section of the manifest_dict"""
logging
.
debug
(
"Process manifest at: "
+
os
.
path
.
dirname
(
self
.
path
))
self
.
_process_manifest_universal
()
self
.
_process_manifest_files
()
self
.
_process_manifest_modules
()
self
.
_process_manifest_makefiles
()
def
_process_manifest_universal
(
self
):
"""Method processing the universal manifest directives;
set library (inherited if not set)."""
# Libraries
if
"library"
in
self
.
manifest_dict
:
self
.
library
=
self
.
manifest_dict
[
"library"
]
elif
self
.
parent
:
self
.
library
=
self
.
parent
.
library
def
_make_list_of_paths
(
self
,
list_of_paths
):
def
_make_list_of_paths
(
self
,
list_of_paths
):
"""Get a list with only the valid absolute paths from the provided"""
"""Get a list with only the valid absolute paths from the provided"""
paths
=
[]
paths
=
[]
...
@@ -211,17 +211,19 @@ class Module(object):
...
@@ -211,17 +211,19 @@ class Module(object):
"""Process the files instantiated by the HDLMake module"""
"""Process the files instantiated by the HDLMake module"""
from
..sourcefiles.sourcefileset
import
SourceFileSet
from
..sourcefiles.sourcefileset
import
SourceFileSet
# HDL files provided by the module
# HDL files provided by the module
if
"files"
not
in
self
.
manifest_dict
:
files
=
self
.
manifest_dict
.
get
(
'files'
)
if
files
is
None
:
self
.
files
=
SourceFileSet
()
self
.
files
=
SourceFileSet
()
logging
.
debug
(
"No files in the manifest at
%
s"
,
self
.
path
or
'?'
)
logging
.
debug
(
"No files in the manifest at
%
s"
,
self
.
path
or
'?'
)
else
:
else
:
self
.
manifest_dict
[
"files"
]
=
path_mod
.
flatten_list
(
# Be sure it is a list.
self
.
manifest_dict
[
"files"
])
files
=
path_mod
.
flatten_list
(
files
)
self
.
manifest_dict
[
"files"
]
=
files
logging
.
debug
(
"Files in
%
s:
%
s to library
%
s"
,
logging
.
debug
(
"Files in
%
s:
%
s to library
%
s"
,
self
.
path
,
self
.
path
,
str
(
self
.
manifest_dict
[
"files"
]),
str
(
self
.
manifest_dict
[
"files"
]),
self
.
library
)
self
.
library
)
paths
=
self
.
_make_list_of_paths
(
self
.
manifest_dict
[
"files"
]
)
paths
=
self
.
_make_list_of_paths
(
files
)
self
.
files
=
self
.
_create_file_list_from_paths
(
paths
=
paths
)
self
.
files
=
self
.
_create_file_list_from_paths
(
paths
=
paths
)
def
fetchto
(
self
):
def
fetchto
(
self
):
...
...
testsuite/088bad_file_abs/Makefile.ref
0 → 100644
View file @
67cfd90b
########################################
# This file was generated by hdlmake #
# http://ohwr.org/projects/hdl-make/ #
########################################
TOP_MODULE
:=
gate
MODELSIM_INI_PATH
:=
$(HDLMAKE_MODELSIM_PATH)
/..
VCOM_FLAGS
:=
-quiet
-modelsimini
modelsim.ini
VSIM_FLAGS
:=
VLOG_FLAGS
:=
-quiet
-modelsimini
modelsim.ini
VMAP_FLAGS
:=
-modelsimini
modelsim.ini
#target for performing local simulation
local
:
sim_pre_cmd simulation sim_post_cmd
VERILOG_SRC
:=
VERILOG_OBJ
:=
VHDL_SRC
:=
../files/gate.vhdl
\
VHDL_OBJ
:=
work/gate/.gate_vhdl
\
INCLUDE_DIRS
:=
LIBS
:=
work
LIB_IND
:=
work/.work
simulation
:
modelsim.ini $(LIB_IND) $(VERILOG_OBJ) $(VHDL_OBJ)
$(VERILOG_OBJ)
:
modelsim.ini
$(VHDL_OBJ)
:
$(LIB_IND) modelsim.ini
modelsim.ini
:
$(MODELSIM_INI_PATH)/modelsim.ini
cp
$<
.
2>&1
work/.work
:
(
vlib work
&&
vmap
$(VMAP_FLAGS)
work
&&
touch
work/.work
)||
rm
-rf
work
work/gate/.gate_vhdl
:
../files/gate.vhdl
vcom
$(VCOM_FLAGS)
-work
work
$<
@
mkdir
-p
$
(
dir
$@
)
&&
touch
$@
# USER SIM COMMANDS
sim_pre_cmd
:
sim_post_cmd
:
CLEAN_TARGETS
:=
$(LIBS)
modelsim.ini transcript
clean
:
rm
-rf
$(CLEAN_TARGETS)
mrproper
:
clean
rm
-rf
*
.vcd
*
.wlf
.PHONY
:
mrproper clean sim_pre_cmd sim_post_cmd simulation
testsuite/088bad_file_abs/Manifest.py
0 → 100644
View file @
67cfd90b
action
=
"simulation"
sim_tool
=
"modelsim"
sim_path
=
"fake_bin"
top_module
=
"gate"
files
=
[
"/ignore/abs/file.vhdl"
,
"../files/gate.vhdl"
]
testsuite/089missing_file/Manifest.py
0 → 100644
View file @
67cfd90b
action
=
"simulation"
sim_tool
=
"modelsim"
sim_path
=
"fake_bin"
top_module
=
"gate"
files
=
[
"missing_gate.vhdl"
]
testsuite/test_all.py
View file @
67cfd90b
...
@@ -474,6 +474,14 @@ def test_err_ise_no_family():
...
@@ -474,6 +474,14 @@ def test_err_ise_no_family():
def
test_many_modules
():
def
test_many_modules
():
run_compare
(
path
=
"087many_modules"
)
run_compare
(
path
=
"087many_modules"
)
def
test_file_abs
():
run_compare
(
path
=
"088bad_file_abs"
)
def
test_err_missing_file
():
with
pytest
.
raises
(
SystemExit
)
as
_
:
run
([],
path
=
"089missing_file"
)
assert
False
@
pytest
.
mark
.
xfail
@
pytest
.
mark
.
xfail
def
test_xfail
():
def
test_xfail
():
"""This is a self-consistency test: the test is known to fail"""
"""This is a self-consistency test: the test is known to fail"""
...
...
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