Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
darshan
darshan
Commits
615f7363
Commit
615f7363
authored
Aug 01, 2019
by
Jakob Luettgau
Browse files
Replace with actual tests.
parent
ff8e0a65
Changes
8
Hide whitespace changes
Inline
Side-by-side
darshan-util/pydarshan/Makefile
View file @
615f7363
...
...
@@ -30,7 +30,7 @@ lint: ## check style with flake8
flake8 darshan tests
test
:
##
run tests quickly with the default Python
py.test
py.test
--verbose
test-all
:
##
run tests on every Python version with tox
tox
...
...
darshan-util/pydarshan/darshan/parser_cffi.py
View file @
615f7363
...
...
@@ -24,7 +24,7 @@ libdutil = ffi.dlopen(DARSHAN_PATH + "/lib/libdarshan-util.so")
#print(DARSHAN_PATH + "/lib/libdarshan-util.so")
modules
=
{}
#
modules = {}
def
log_open
(
filename
):
...
...
@@ -51,7 +51,7 @@ def log_close(log):
Closes the logfile and releases allocated memory.
"""
libdutil
.
darshan_log_close
(
log
)
modules
=
{}
#
modules = {}
return
...
...
@@ -120,6 +120,8 @@ def log_get_modules(log):
dict: Modules with additional info for current log.
"""
modules
=
{}
mods
=
ffi
.
new
(
"struct darshan_mod_info **"
)
cnt
=
ffi
.
new
(
"int *"
)
libdutil
.
darshan_log_get_modules
(
log
,
mods
,
cnt
)
...
...
@@ -171,6 +173,8 @@ def log_get_generic_record(log, mod_name, mod_type):
{'counters': array([...], dtype=uint64), 'fcounters': array([...])}
"""
modules
=
log_get_modules
(
log
)
rec
=
{}
buf
=
ffi
.
new
(
"void **"
)
r
=
libdutil
.
darshan_log_get_record
(
log
,
modules
[
mod_name
][
'idx'
],
buf
)
...
...
@@ -325,6 +329,9 @@ def log_get_apxc_record(log):
dict: log record
"""
rec
=
{}
modules
=
log_get_modules
(
log
)
memory_modes
=
[
'unknown'
,
'flat'
,
'equal'
,
'split'
,
'cache'
]
cluster_modes
=
[
'unknown'
,
'all2all'
,
'quad'
,
'hemi'
,
'snc4'
,
'snc2'
]
buf
=
ffi
.
new
(
"void **"
)
...
...
darshan-util/pydarshan/examples/stdio_segfault.ph
deleted
100755 → 0
View file @
ff8e0a65
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
darshan
log
=
darshan
.
log_open
(
"example.darshan"
)
record
=
darshan
.
log_get_stdio_record
(
log
)
record
[
'counters'
]
dict
(
zip
(
darshan
.
counter_names
(
"STDIO"
),
record
[
'counters'
]))
record
=
darshan
.
log_get_stdio_record
(
log
)
record
[
'counters'
]
dict
(
zip
(
darshan
.
counter_names
(
"STDIO"
),
record
[
'counters'
]))
darshan-util/pydarshan/tests/test_discoverdarshan.py
deleted
100644 → 0
View file @
ff8e0a65
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `pydarshan` package."""
import
pytest
import
darshan
@
pytest
.
fixture
def
response
():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def
test_load
(
response
):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
assert
darshan
.
dummy_load
()
==
42
darshan-util/pydarshan/tests/test_general.py
deleted
100644 → 0
View file @
ff8e0a65
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `pydarshan` package."""
import
pytest
import
darshan
@
pytest
.
fixture
def
response
():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def
test_load
(
response
):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
assert
darshan
.
dummy_load
()
==
42
darshan-util/pydarshan/tests/test_modmpiio.py
View file @
615f7363
...
...
@@ -15,17 +15,39 @@ def response():
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
pass
def
test_load
(
response
):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
def
test_counters
():
"""Sample for an expected property in counters."""
assert
darshan
.
dummy_load
()
==
42
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_mpiio_record
(
log
)
assert
rec
[
'counters'
][
1
]
==
2048
def
test_fcounters
():
"""Sample for an expected property in fcounters."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_mpiio_record
(
log
)
assert
rec
[
'fcounters'
][
1
]
==
2.04800000e+03
def
test_repeated_access
():
""" Check if repeated access is working."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec1
=
darshan
.
log_get_mpiio_record
(
log
)
rec2
=
darshan
.
log_get_mpiio_record
(
log
)
assert
rec1
==
rec2
def
test_ishouldrun
():
assert
1
darshan-util/pydarshan/tests/test_modposix.py
View file @
615f7363
...
...
@@ -5,27 +5,45 @@
import
pytest
import
darshan
@
pytest
.
fixture
def
response
():
def
init
():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
pass
def
test_counters
():
"""Sample for an expected property in counters."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_posix_record
(
log
)
assert
rec
[
'counters'
][
0
]
==
2049
def
test_fcounters
():
"""Sample for an expected property in fcounters."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_posix_record
(
log
)
assert
rec
[
'fcounters'
][
0
]
==
2.04900000e+03
def
test_load
(
response
):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
def
test_repeated_access
():
""" Check if repeated access is working."""
assert
darshan
.
dummy_load
()
==
42
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec1
=
darshan
.
log_get_posix_record
(
log
)
rec2
=
darshan
.
log_get_posix_record
(
log
)
assert
rec1
==
rec2
def
test_ishouldrun
():
assert
1
darshan-util/pydarshan/tests/test_modstdio.py
View file @
615f7363
...
...
@@ -15,17 +15,41 @@ def response():
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
pass
def
test_load
(
response
):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
assert
darshan
.
dummy_load
()
==
42
def
test_counters
():
"""Sample for an expected property in counters."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_stdio_record
(
log
)
assert
rec
[
'counters'
][
1
]
==
18446744073709551615
def
test_fcounters
():
"""Sample for an expected property in fcounters."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec
=
darshan
.
log_get_stdio_record
(
log
)
assert
rec
[
'fcounters'
][
3
]
==
6.
def
test_repeated_access
():
""" Check if repeated access is working."""
log
=
darshan
.
log_open
(
"tests/input/sample.darshan"
)
rec1
=
darshan
.
log_get_stdio_record
(
log
)
rec2
=
darshan
.
log_get_stdio_record
(
log
)
assert
rec1
==
rec2
def
test_ishouldrun
():
import
time
time
.
sleep
(
1
)
assert
1
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