diff options
author | Tushar Gohad <tushar.gohad@intel.com> | 2015-03-08 00:53:43 -0700 |
---|---|---|
committer | Tushar Gohad <tushar.gohad@intel.com> | 2015-03-08 00:56:09 -0700 |
commit | 232209ce610ee5cc14b47d9e9ce345cdb08eda4e (patch) | |
tree | 219f7a977c1495c30a1ba4c40b29ac781bdd0149 | |
parent | 2e4705e6d04abbb463d46e4039de82191fd8821b (diff) | |
download | pyeclib-232209ce610ee5cc14b47d9e9ce345cdb08eda4e.tar.gz |
test: Use real backend names in _available_backends
-rw-r--r-- | test/test_pyeclib_api.py | 11 | ||||
-rw-r--r-- | test/test_pyeclib_c.py | 12 |
2 files changed, 16 insertions, 7 deletions
diff --git a/test/test_pyeclib_api.py b/test/test_pyeclib_api.py index c7c5681..1131423 100644 --- a/test/test_pyeclib_api.py +++ b/test/test_pyeclib_api.py @@ -104,14 +104,15 @@ class TestPyECLibDriver(unittest.TestCase): pass def test_valid_algo(self): - for _type in VALID_EC_TYPES: + print("") + for _type in PyECLib_EC_Types.names(): # Check if this algo works + if _type not in _available_backends: + print("Skipping test for %s backend" % _type) + continue try: if _type is 'shss': - if PyECLib_EC_Types.shss in _available_backends: - _instance = ECDriver(k=10, m=4, ec_type=_type) - else: - continue + _instance = ECDriver(k=10, m=4, ec_type=_type) else: _instance = ECDriver(k=10, m=5, ec_type=_type) except ECDriverError: diff --git a/test/test_pyeclib_c.py b/test/test_pyeclib_c.py index 4cd122d..ea90111 100644 --- a/test/test_pyeclib_c.py +++ b/test/test_pyeclib_c.py @@ -40,7 +40,8 @@ def collect_available_backends(): handle = pyeclib_c.init(10, 5, ec_type.value, 3) else: handle = pyeclib_c.init(10, 4, ec_type.value) - available_backends.append(ec_type) + available_backends.append(ec_type.name) + print ec_type.name except: pass return available_backends @@ -289,6 +290,8 @@ class TestPyECLib(unittest.TestCase): return format(throughput, '.10g') + @skipIf("flat_xor_hd" not in _available_backends, + "xor backend is not available in your enviromnet") def test_xor_code(self): for (ec_type, k, m, hd) in self.xor_types: print(("\nRunning tests for %s k=%d, m=%d, hd=%d" % (ec_type, k, m, hd))) @@ -316,7 +319,7 @@ class TestPyECLib(unittest.TestCase): print("Reconstruct (%s): %s" % (size_str, self.get_throughput(avg_time, size_str))) - @skipIf(PyECLib_EC_Types.shss not in _available_backends, + @skipIf("shss" not in _available_backends, "shss backend is not available in your enviromnet") def test_shss(self): for (ec_type, k, m) in self.shss: @@ -386,6 +389,11 @@ class TestPyECLib(unittest.TestCase): def test_codes(self): for ec_type in self.rs_types: + + if ec_type.name not in _available_backends: + print("%s backend is not available in your enviromnet, skipping test" % ec_type.name) + continue + print(("\nRunning tests for %s" % (ec_type))) for i in range(len(self.num_datas)): |