Skip to content

Commit

Permalink
initialize pointer and add missing nvml python test
Browse files Browse the repository at this point in the history
  • Loading branch information
samcmill committed Apr 6, 2020
1 parent a7afb11 commit fae1db4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data/nvml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace wassail {

private:
#ifdef WITH_DATA_NVML
void *handle; /*!< Library handle */
void *handle = nullptr; /*!< Library handle */

void device_query(nvmlDevice_t device);
nvml::impl::nvlink nvlink_query(nvmlDevice_t device, unsigned int link);
Expand Down
12 changes: 12 additions & 0 deletions test/python/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def test_getrlimit(self):
with self.assertRaises(RuntimeError):
d.evaluate()

def test_nvml(self):
"""nvml data source"""
d = wassail.data.nvml()
if d.enabled():
d.evaluate()
s = str(d)
j = json.loads(s)
self.assertEqual(j['name'], 'nvml')
else:
with self.assertRaises(RuntimeError):
d.evaluate()

def test_pciaccess(self):
"""pciaccess data source"""
d = wassail.data.pciaccess()
Expand Down

0 comments on commit fae1db4

Please sign in to comment.