Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
e3-require
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESS EPICS Environment
wrappers
e3-require
Commits
7e63c2e7
Commit
7e63c2e7
authored
3 years ago
by
Simon Rose
Browse files
Options
Downloads
Patches
Plain Diff
Added test for header installation
parent
6281688b
No related branches found
No related tags found
1 merge request
!67
E3-665: Add tests for KEEP_HEADER_SUBDIRS
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/test_build.py
+28
-4
28 additions, 4 deletions
tests/test_build.py
tests/test_e3.py
+3
-3
3 additions, 3 deletions
tests/test_e3.py
tests/utils.py
+16
-1
16 additions, 1 deletion
tests/utils.py
with
47 additions
and
8 deletions
tests/test_build.py
+
28
−
4
View file @
7e63c2e7
import
re
from
pathlib
import
Path
import
pytest
from
.utils
import
TEST_MODULE_NAME
,
run_make
from
.utils
import
TEST_MODULE_NAME
,
get_env_var
,
run_make
MODULE_VERSION
=
"
0.0.0+0
"
MODULE_VERSION_NO_BUILD
=
"
0.0.0
"
...
...
@@ -56,7 +57,7 @@ def test_patch(wrapper):
E3_MODULE_VERSION
=
MODULE_VERSION
,
)
assert
rc
==
0
assert
"
You are in the local source mode
"
in
outs
.
decode
(
"
utf-8
"
)
assert
"
You are in the local source mode
"
in
outs
rc
,
_
,
_
=
run_make
(
wrapper
,
"
patch
"
,
E3_MODULE_VERSION
=
MODULE_VERSION
)
assert
rc
==
0
...
...
@@ -85,7 +86,7 @@ def test_missing_dbd_file(wrapper):
assert
rc
==
2
assert
re
.
search
(
RE_MISSING_FILE
.
format
(
filename
=
re
.
escape
(
"
../nonexistent.dbd
"
)),
errs
.
decode
(
"
utf-8
"
)
,
errs
,
)
...
...
@@ -100,7 +101,7 @@ def test_missing_source_file(wrapper):
assert
rc
==
2
assert
re
.
search
(
RE_MISSING_FILE
.
format
(
filename
=
re
.
escape
(
"
nonexistent.o
"
)),
errs
.
decode
(
"
utf-8
"
)
,
errs
,
)
...
...
@@ -111,3 +112,26 @@ def test_missing_requirement(wrapper):
rc
,
_
,
errs
=
run_make
(
wrapper
,
"
build
"
)
assert
rc
==
2
assert
"
REQUIRED module
'
foo
'
version
''
does not exist
"
in
errs
.
decode
(
"
utf-8
"
)
def
test_header_install_location
(
wrapper
):
subdir
=
wrapper
/
TEST_MODULE_NAME
/
"
db
"
/
"
subdir
"
subdir
.
mkdir
(
parents
=
True
)
extensions
=
[
"
h
"
,
"
hpp
"
,
"
hxx
"
,
"
hh
"
]
with
open
(
wrapper
/
f
"
{
TEST_MODULE_NAME
}
.Makefile
"
,
"
a
"
)
as
f
:
for
ext
in
extensions
:
f
.
write
(
f
"
HEADERS += db/subdir/header.
{
ext
}
\n
"
)
f
.
write
(
"
KEEP_HEADER_SUBDIRS += db
\n
"
)
for
extension
in
extensions
:
with
open
(
subdir
/
f
"
header.
{
extension
}
"
,
"
w
"
)
as
f
:
pass
rc
,
_
,
_
=
run_make
(
wrapper
,
"
cellinstall
"
)
assert
rc
==
0
cell_path
=
get_env_var
(
wrapper
,
"
E3_MODULES_INSTALL_LOCATION
"
)
for
ext
in
extensions
:
assert
(
Path
(
cell_path
)
/
"
include
"
/
"
subdir
"
/
f
"
header.
{
ext
}
"
).
is_file
()
This diff is collapsed.
Click to expand it.
tests/test_e3.py
+
3
−
3
View file @
7e63c2e7
...
...
@@ -11,7 +11,7 @@ from .utils import run_make
def
test_loc
(
wrapper
):
rc
,
_
,
errs
=
run_make
(
wrapper
,
"
build
"
,
E3_MODULE_SRC_PATH
=
"
test-loc
"
)
assert
rc
==
2
assert
'
Local source mode
"
-loc
"
has been deprecated
'
in
errs
.
decode
(
"
utf-8
"
)
assert
'
Local source mode
"
-loc
"
has been deprecated
'
in
errs
def
test_sitelibs
(
wrapper
):
...
...
@@ -34,11 +34,11 @@ include $(REQUIRE_CONFIG)/RULES_DEV
)
rc
,
_
,
errs
=
run_make
(
wrapper
,
"
build
"
)
assert
rc
==
2
assert
"
RULES_E3 should only be loaded from RULES_SITEMODS
"
in
errs
.
decode
(
"
utf-8
"
)
assert
"
RULES_E3 should only be loaded from RULES_SITEMODS
"
in
errs
def
test_incorrect_module_name
(
wrapper
):
module_name
=
"
ADCore
"
rc
,
_
,
errs
=
run_make
(
wrapper
,
"
build
"
,
E3_MODULE_NAME
=
module_name
)
assert
rc
==
2
assert
f
"
E3_MODULE_NAME
'
{
module_name
}
'
is not valid
"
in
errs
.
decode
(
"
utf-8
"
)
assert
f
"
E3_MODULE_NAME
'
{
module_name
}
'
is not valid
"
in
errs
This diff is collapsed.
Click to expand it.
tests/utils.py
+
16
−
1
View file @
7e63c2e7
...
...
@@ -49,12 +49,27 @@ def run_make(path, *args, **kwargs):
test_env
[
kw
]
=
kwargs
[
kw
]
make_cmd
=
[
"
make
"
,
"
-C
"
,
path
]
+
list
(
args
)
p
=
subprocess
.
Popen
(
make_cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
test_env
make_cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
test_env
,
encoding
=
"
utf-8
"
,
)
outs
,
errs
=
p
.
communicate
()
return
p
.
returncode
,
outs
,
errs
def
get_env_var
(
path
,
var
:
str
):
"""
Fetch an environment variable from the module build environment
"""
_
,
out
,
_
=
run_make
(
path
,
"
cellvars
"
)
for
line
in
out
.
split
(
"
\n
"
):
if
line
.
startswith
(
var
):
return
line
.
split
(
"
=
"
)[
1
].
strip
()
assert
False
def
run_ioc_get_output
(
version
,
cell_path
):
"""
Run an IOC and try to load the test module
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment